Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use poetry for packaging & dependency management #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install poetry
uses: snok/[email protected]
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Setup
run: bash setup.sh
- name: Analysing the code with pylint
run: |
python -m pylint --fail-under=9 `find -regextype egrep -regex '(.*.py)$'`
run: poetry run pylint ./src
34 changes: 15 additions & 19 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,23 @@ jobs:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: Set up Python 3.7
uses: actions/[email protected]
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
python-version: 3.9
- name: Install poetry
uses: snok/[email protected]
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Setup
run: bash setup.sh
- name: Build
run: poetry build
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
run: poetry publish
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need the setup.py and requirements.txt files, I guess they are deprecated with your PR, no?
And is the publish doing the same things, for example is the README used as the description on pypi?

with:
password: ${{ secrets.PYPI_API_TOKEN }}
6 changes: 3 additions & 3 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ extension-pkg-whitelist=
fail-on=

# Specify a score threshold to be exceeded before program exits with error.
fail-under=10.0
fail-under=9.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are making pylint less strict?


# Files or directories to be skipped. They should be base names, not paths.
ignore=CVS
ignore=

# Add files or directories matching the regex patterns to the ignore-list. The
# regex matches against paths.
ignore-paths=
ignore-paths=.venv/*, .git/*, .github/*

# Files or directories matching the regex patterns are skipped. The regex
# matches against base names, not paths.
Expand Down
29 changes: 24 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
[tool.poetry]
name = "opensignals"
version = "0.0.2"
description = ""
authors = ["Jordi Villar <[email protected]>"]

[tool.poetry.urls]
Issues = "https://github.com/councilofelders/opensignals/issues"

[tool.poetry.dependencies]
python = ">=3.8,<3.11"
docopt = "^0.6.2"
pandas = "^1.3.4"
numpy = "^1.21.3"
pyarrow = "^6.0.0"
requests = "^2.26.0"
tqdm = "^4.62.3"

[tool.poetry.dev-dependencies]
pylint = "^2.11.1"

[build-system]
requires = [
'setuptools>=42',
'wheel'
]
build-backend = 'setuptools.build_meta'
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

19 changes: 19 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#! /usr/bin/bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume, we should all run this script to setup our dev environment. Could you add a short section to the README file to explain this?

echo "install poetry if not in path"
if ! command -v poetry &> /dev/null
then
echo "poetry is missing. Installing ..."
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

executing some remote file is not exactly the safest way of installing things. Any other options of getting poetry, pip install poetry maybe? :-)

source "$HOME/.poetry/env"
fi

echo "setting up poetry config"
poetry config virtualenvs.path .venv
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true

echo "installing dependencies"
poetry install --no-interaction --no-root

echo "installing libraries"
poetry install --no-interaction