Skip to content

Commit

Permalink
Use poetry for packaging & dependency management
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudgelas committed Nov 10, 2021
1 parent b4b718c commit d65c279
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 37 deletions.
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
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

# 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
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 -
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

0 comments on commit d65c279

Please sign in to comment.