Skip to content

Commit

Permalink
Use poetry to manage the project
Browse files Browse the repository at this point in the history
- poetry manages all aspects of project
  metadata and dependencies in pyproject.toml
- Pipfile is obsolete
- setup.py is obsolete
- project might only support python >=3.7,<4.0 now?
  - tests will not run in python 3.6.x
  - contributions require python 3.8
  • Loading branch information
Darren Weber committed Aug 25, 2021
1 parent 247b7ac commit ea83ed1
Show file tree
Hide file tree
Showing 10 changed files with 2,912 additions and 313 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ jobs:
env:
COLOR: 'yes'
run: |
pip install -U setuptools pip
pip install -U pipenv codecov
pipenv lock
pipenv sync --dev
pipenv check || true
pipenv graph
python -m pip install -U pip setuptools twine
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
source "${HOME}/.poetry/env"
poetry run pip install --upgrade pip setuptools twine
poetry install -v --no-interaction --extras boto3
poetry show -t --no-dev
make flake mototest
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1.5.2
Expand Down Expand Up @@ -79,7 +79,10 @@ jobs:
python-version: 3.8
- name: Make sdist
run:
python setup.py sdist
python -m pip install -U setuptools pip twine poetry
poetry check
poetry build
poetry run twine check dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
Expand All @@ -97,7 +100,7 @@ jobs:
python-version: 3.8
- name: Install twine
run: |
python -m pip install twine
python -m pip install -U setuptools pip twine poetry
- name: Download dists
uses: actions/download-artifact@v2
with:
Expand All @@ -108,4 +111,8 @@ jobs:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload dist/*
python -m pip install -U setuptools pip twine poetry
poetry check
poetry build
poetry run twine check dist/*
poetry publish
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
hooks:
- id: check-yaml
args: [--unsafe]
exclude: '.*templates.*.yaml'
- id: end-of-file-fixer
exclude: 'CHANGELOG.md'
- id: trailing-whitespace
exclude: 'CHANGELOG.md'
- id: check-ast
- repo: https://github.com/gruntwork-io/pre-commit
rev: v0.1.9
hooks:
- id: shellcheck
- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black
5 changes: 3 additions & 2 deletions .pyup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ label_prs: deps-update

schedule: every week

# https://github.com/pyupio/pyup/issues/332 ??
# Or use poetry export to create requirements.txt
requirements:
- Pipfile
- docs/requirements.txt
- Poetry
12 changes: 7 additions & 5 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ Fist of all just clone repository::

$ git clone git@github.com:aio-libs/aiobotocore.git

Create virtualenv with at least python3.5 (older version are not supported).
Create virtualenv with at least python3.8 for development purposes.
For example using *virtualenvwrapper* commands could look like::

$ cd aiobotocore
$ mkvirtualenv --python=`which python3.5` aiobotocore
$ mkvirtualenv --python=`which python3.8` aiobotocore

After that please install libraries required for development. The
`make init` recipe will install [poetry](https://python-poetry.org/)
and then invoke a `poetry install` to install the required
dependencies for the library development.

After that please install libraries required for development::

$ pipenv sync --dev
$ make init

Congratulations, you are ready to run the test suite::

Expand Down
47 changes: 37 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@

FLAGS=

flake: checkrst
pipenv run python3 -m flake8 --format=abspath
LIB=aiobotocore

init: poetry
poetry run pip install --upgrade pip
poetry install -v --no-interaction --extras boto3

flake: package-check
poetry run python3 -m flake8 --format=abspath

test: flake
pipenv run python3 -Wd -m pytest -s -vv $(FLAGS) ./tests/
poetry run python3 -Wd -m pytest -s -vv $(FLAGS) ./tests/

vtest:
pipenv run python3 -Wd -X tracemalloc=5 -X faulthandler -m pytest -s -vv $(FLAGS) ./tests/

checkrst:
pipenv run python3 setup.py check -rms
poetry run python3 -Wd -X tracemalloc=5 -X faulthandler -m pytest -s -vv $(FLAGS) ./tests/

cov cover coverage: flake
pipenv run python3 -Wd -m pytest -s -vv --cov-report term --cov-report html --cov aiobotocore ./tests
@echo "open file://`pwd`/htmlcov/index.html"
poetry run python3 -Wd -m pytest -s -vv --cov-report term --cov-report html --cov $(LIB) ./tests
echo "open file://`pwd`/htmlcov/index.html"

# BOTO_CONFIG solves https://github.com/travis-ci/travis-ci/issues/7940
mototest:
Expand All @@ -25,7 +28,6 @@ mototest:
BOTO_CONFIG=/dev/null pipenv run python3 -Wd -X tracemalloc=5 -X faulthandler -m pytest -vv -m moto -n auto --cov-report term --cov-report html --cov-report xml --cov=aiobotocore --cov=tests --log-cli-level=DEBUG aiobotocore tests
@echo "open file://`pwd`/htmlcov/index.html"


clean:
rm -rf `find . -name __pycache__`
rm -rf `find . -name .pytest_cache`
Expand All @@ -49,4 +51,29 @@ doc:
make -C docs html
@echo "open file://`pwd`/docs/_build/html/index.html"

typehint: clean poetry
poetry run mypy --follow-imports=skip $(LIB) tests

package: clean poetry
poetry check
poetry build

package-check: package
poetry run twine check dist/*

publish: package-check
poetry publish

poetry:
@if ! command -v poetry > /dev/null; then \
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - ; \
source "$(HOME)/.poetry/env" ; \
fi

poetry-export: poetry
poetry export --without-hashes -f requirements.txt -o requirements.txt
sed -i -e 's/^-e //g' requirements.txt


.PHONY: init typehint package package-check poetry poetry-export
.PHONY: all flake test vtest cov clean doc
26 changes: 0 additions & 26 deletions Pipfile

This file was deleted.

Loading

0 comments on commit ea83ed1

Please sign in to comment.