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
  • Loading branch information
Darren Weber committed Jun 6, 2021
1 parent 2a7c7f5 commit a3aea42
Show file tree
Hide file tree
Showing 9 changed files with 2,804 additions and 120 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@ 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 setuptools pip twine poetry
make init
poetry show -t --no-dev
make flake mototest
pre-deploy:
Expand Down Expand Up @@ -68,7 +65,9 @@ jobs:
python-version: 3.8
- name: Make sdist
run:
python setup.py sdist
python -m pip install -U setuptools pip twine poetry
poetry build
poetry check
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
Expand All @@ -86,7 +85,9 @@ jobs:
python-version: 3.8
- name: Install twine
run: |
python -m pip install twine
python -m pip install -U setuptools pip twine poetry
poetry build
poetry check
- name: Download dists
uses: actions/download-artifact@v2
with:
Expand All @@ -97,4 +98,4 @@ jobs:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload 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.6 (older version are not supported).
For example using *virtualenvwrapper* commands could look like::

$ cd aiobotocore
$ mkvirtualenv --python=`which python3.5` aiobotocore
$ mkvirtualenv --python=`which python3.6` 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
41 changes: 32 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@

FLAGS=

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

init: poetry
@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
@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
Expand All @@ -25,7 +27,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=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 +50,26 @@ doc:
make -C docs html
@echo "open file://`pwd`/docs/_build/html/index.html"

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

package: clean
@poetry check
@poetry build

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

poetry:
@if ! command -v poetry > /dev/null; then \
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -o /tmp/get-poetry.py; \
python /tmp/get-poetry.py; \
fi

poetry-export:
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 a3aea42

Please sign in to comment.