Skip to content

Commit

Permalink
Merge pull request #47 from mintel/poetry
Browse files Browse the repository at this point in the history
Replace Pipenv with Poetry
  • Loading branch information
jtdoepke committed Jun 1, 2021
2 parents 659e0e7 + 7fea9d9 commit 83ac2a5
Show file tree
Hide file tree
Showing 38 changed files with 1,636 additions and 1,165 deletions.
10 changes: 0 additions & 10 deletions .bumpversion.cfg

This file was deleted.

4 changes: 0 additions & 4 deletions .coveragerc

This file was deleted.

12 changes: 1 addition & 11 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,11 @@ trim_trailing_whitespace = true
[*.{py,md,rst}]
indent_style = space

[.coveragerc]
indent_style = tab

[*.{ini,cfg,bat}]
indent_style = tab

[{Makefile,.coveragerc}]
indent_style = tab

[.bumpversion.cfg]
[Makefile]
indent_style = tab
# .bumpversion.cfg gets rewritten by Python ConfigParser.
# Ignore any changes to whitespace.
trim_trailing_whitespace = false
insert_final_newline = false

[*.{yml,yaml}]
indent_style = space
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ celerybeat-schedule
.venv
venv/
ENV/
.install.stamp

# Spyder project settings
.spyderproject
Expand Down
15 changes: 11 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ repos:
hooks:
- id: fmt
name: fmt-local
description: 'Format Python code by running "make fmt"'
description: 'Format Python code'
language: system
types: [python]
entry: make fmt lint
entry: make fmt
pass_filenames: false
- id: lint
name: lint-local
description: 'Lint Python code'
language: system
types: [python]
entry: make lint
pass_filenames: false

- repo: git@github.com:pre-commit/pre-commit-hooks
sha: v1.1.1
- repo: https://github.com/pre-commit/pre-commit-hooks
sha: v4.0.1
hooks:
- id: check-ast
- id: check-case-conflict
Expand Down
111 changes: 53 additions & 58 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,66 @@
dist: xenial
dist: focal
services:
- docker
- docker
language: python
python:
- '3.6'
- '3.7'
- '3.8'
- '3.9-dev'

- '3.6'
- '3.7'
- '3.8'
- '3.9'
- 3.10-dev
matrix:
fast_finish: true
allow_failures:
- python: 3.9-dev

- python: 3.10-dev
stages:
- lint
- test
- deploy

- lint
- test
- deploy
before_install:
- pip install --upgrade pipenv
# Numpy isn't needed by pytest-localstack, but it comes preinstalled in Travis.
# `pipenv check` complains if numpy<=1.16.0.
- pip install 'numpy>1.16.0'
- pipenv --version

- pip install --upgrade poetry
- poetry --version
- docker login --username "$DOCKER_HUB_USERNAME" --password "$DOCKER_HUB_PASSWORD"
install:
# Do this instead of `make env` so we always test with latest versions
# of packages.
- pipenv install --dev --pre codecov pytest-cov pytest-xdist

- make install
script:
- pytest --version
- pytest tests/unit -ra --cov=pytest_localstack/ --cov-config .coveragerc -n auto
- pytest tests/integration -ra --cov=pytest_localstack/ --cov-config .coveragerc --cov-append -n auto
- pytest tests/functional -ra --cov=pytest_localstack/ --cov-config .coveragerc --cov-append

- poetry run pytest --version
- poetry run pytest tests/unit -ra --cov=pytest_localstack/ -n auto
- poetry run pytest tests/integration -ra --cov=pytest_localstack/ --cov-append -n
auto
- poetry run pytest tests/functional -ra --cov=pytest_localstack/ --cov-append
after_success:
- codecov

- codecov
jobs:
include:
- stage: lint
python: 3.8
services: []
install: make env
script:
- make lint
- make docs
after_success: []
deploy: []

- stage: deploy
if: tag =~ ^v
python: '3.8'
services: []
before_install: []
install: []
script: 'true'
after_success: []
deploy:
provider: pypi
user: jdoepke_mintel
password:
secure: fMzAGIp0OJQI5GdeiN0u6g2uTUvlHmGskWfvvaNF+xM4/J3o33LWqyRjRa7m07Mv+2XtuUaFyh5s/wcHlro4Ianx7c3hRa6gx+MxB4akgj8H0xgFrKduZfOcruNGcz0qOwk9PsYSk+KBdfESy0SHotoOZdYT4rB3i12PJgCrO3Dn466qbeNYdWEO+1nZMkGjkGPmGTgann9d2HbRZP1Eu/0ehIU02Gvs0uPzNpq2UBtE6XpAPu7O/yq7l02m21hj1GuMJq86wNHkVi9LGvSvDBIF+iZSvrRSM6/+DYzCq5UKnQy1gPHUVWkZXWcuDrJW5ODZzlG0JHbagLdl4gQKU/0giMHCo9g3f6X7jeFUIAYMKEmwsU6qOO31KiAat7mWMI07peD4SCexQxksVYcUeuriF8A+AkG8qDaeJKdX3wDpOMpi4aWYt2KvIUEyPiHeGruv5y1NIwTQrcpkOxYcZ4/nwrMTph0vvAJsgOCg6NueIQLq2ungeBbXRarg9afU16j5ODWWDNLvJSVE02VgAkKc8Gw7EvtyWRmsr/aV86UXHZ85VImDKvIA1pdJAypa+PjdsVNnfDtcfsDnkROu18dJCBy0tXNuHtsHOjESHrODHBfGh/Wr4/qVO4CQVloB+NIIZNLv9QvbFQV5jfiyLALCIGCw3mujp3y5kJBE2zI=
distributions: 'sdist bdist_wheel'
skip_existing: true
on:
tags: true
all_branches: true
- stage: lint
python: 3.8
services: []
install: make install
script:
- make lint
- make docs
after_success: []
deploy: []
- stage: deploy
if: tag =~ ^v
python: '3.8'
services: []
before_install: []
install: []
script: 'true'
after_success: []
deploy:
provider: pypi
user: jdoepke_mintel
password:
secure: fMzAGIp0OJQI5GdeiN0u6g2uTUvlHmGskWfvvaNF+xM4/J3o33LWqyRjRa7m07Mv+2XtuUaFyh5s/wcHlro4Ianx7c3hRa6gx+MxB4akgj8H0xgFrKduZfOcruNGcz0qOwk9PsYSk+KBdfESy0SHotoOZdYT4rB3i12PJgCrO3Dn466qbeNYdWEO+1nZMkGjkGPmGTgann9d2HbRZP1Eu/0ehIU02Gvs0uPzNpq2UBtE6XpAPu7O/yq7l02m21hj1GuMJq86wNHkVi9LGvSvDBIF+iZSvrRSM6/+DYzCq5UKnQy1gPHUVWkZXWcuDrJW5ODZzlG0JHbagLdl4gQKU/0giMHCo9g3f6X7jeFUIAYMKEmwsU6qOO31KiAat7mWMI07peD4SCexQxksVYcUeuriF8A+AkG8qDaeJKdX3wDpOMpi4aWYt2KvIUEyPiHeGruv5y1NIwTQrcpkOxYcZ4/nwrMTph0vvAJsgOCg6NueIQLq2ungeBbXRarg9afU16j5ODWWDNLvJSVE02VgAkKc8Gw7EvtyWRmsr/aV86UXHZ85VImDKvIA1pdJAypa+PjdsVNnfDtcfsDnkROu18dJCBy0tXNuHtsHOjESHrODHBfGh/Wr4/qVO4CQVloB+NIIZNLv9QvbFQV5jfiyLALCIGCw3mujp3y5kJBE2zI=
distributions: sdist bdist_wheel
skip_existing: true
on:
tags: true
all_branches: true
env:
global:
- secure: e3NdHXhVSa0RKUGupcrSsYKAVeKBdDLU5sf37csaiJ/D03bKDn0RQLudeF9R2aumY05ICUOdY3MRhCnEGNp8ptYqGzZpZVlauVApQeZhLV/v+ov8OxdjhVO5ZWlniGAwGdUR9s3z+gIY5hxiZ6qYkEY129K3qwy9twdkn5ay8dtsoBMnA1Ea6DhvWCAWEUsszyz8jzqui6hUO1GXS8yUd2FZFuyy0fLLZ9WHKnByIp7B29zvDQTPZx6lfu4QYOOrCGTUo/oN8cl10njldty/12ITqSLYjQdceIRWlT3vS6i9UtHeIFNIq1tvGG6FzeV+Wp0/5x6E+6Thudr/qQUKsOSrw/Nx90/BZbiTFViAoT7qem1CZfkLFfo73D9t1LbdbakMMBayeDvd/R6yHGfQjQUMjFHVeXcKyHxGAq+wdS96+1f3hS0iCD0DPJdWBojSdq0+4/AbBpk7dUQ5qTc2NlUUkc4oZcRtamBSacCz/lNmdC2Mh8/tdubZp0A5tfZ4ao450WXUnH2+37DHlOvJ3AIrTZ0Psdfw/KQI/yE0gOSn+VU285i0tj9FJumH4JToSL3WNnJqSc2HJudte6IkxNZBaFeugjs24Ie/BvcDmki0L8h/KQ8DYZC8qIRc7owQeWLRCFsAMTFbUr1FxVR42FYgaPZkr1FhSNf1V9fIfKY=
- secure: TWuqQB5EqgJNbT7ucY0omr2R6C11h968ouUY+wM2h2I+B/h2A4JgAfb3EkF38MbijxSJw77lT+FT4k6ShdTluhkbQSRNxopWEgqSsKNiKvjBRv/3gDrtNGFiucs9PkSyYA7Z29g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aeKNzyH3Dr+xCT4cO7xh2nh3FI8hMKlTHxniWo2hhl+tnb1jJzoZJDLo37AgwGGg67l85jBxzCQJWJF6nrVJ3vXIOw9bqK8+x75bFmJc71oUZixblbVWpyFNPicdQRAvSad/lobVodItsfy/+WPqbCAOcWUd90I7UIusKwyM=
8 changes: 0 additions & 8 deletions MANIFEST.in

This file was deleted.

134 changes: 53 additions & 81 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,61 +1,75 @@
VIRTUALENV := $(shell python -c 'from __future__ import print_function; import sys; print(sys.prefix if hasattr(sys, "real_prefix") or (hasattr(sys, "base_prefix") and sys.base_prefix != sys.prefix) else "", end="")')
ifeq ($(VIRTUALENV),)
VIRTUALENV := .venv
endif
NAME := pytest_localstack

PIPENV_VARS := PIPENV_VENV_IN_PROJECT=1
PIPENV := $(PIPENV_VARS) pipenv
PIPENV_RUN := $(PIPENV) run
INSTALL_STAMP := .install.stamp
POETRY := $(shell command -v poetry 2> /dev/null)

T := $(shell tput sgr0)
TBOLD := $(shell tput bold)
TGREEN := $(shell tput setaf 2)
TRED := $(shell tput setaf 1)

BLACK_TARGETS := $(shell find . -name "*.py" -not -path "*/.venv/*")

.DEFAULT_GOAL := help

.PHONY: help
help: ## print this help
@# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: help


env: $(VIRTUALENV) ## create development virtualenv
.PHONY: env
$(VIRTUALENV): $(VIRTUALENV)/bin/activate
$(VIRTUALENV)/bin/activate: Pipfile.lock
$(PIPENV) install --dev --deploy
touch $(VIRTUALENV)/bin/activate
Pipfile.lock: Pipfile setup.py
$(PIPENV) lock


test: $(VIRTUALENV) ## run tests
$(PIPENV_RUN) pytest
.PHONY: ftest
.PHONY: install ## create development virtualenv
install: $(INSTALL_STAMP)
$(INSTALL_STAMP): pyproject.toml poetry.lock
@if [ -z $(POETRY) ]; then echo "Poetry could not be found. See https://python-poetry.org/docs/"; exit 2; fi
$(POETRY) install
@touch $(INSTALL_STAMP)

.PHONY: clean
clean: ## remove all build, test, coverage and Python artifacts
rm -rf \
$(INSTALL_STAMP) \
.coverage \
.mypy_cache \
.venv/ \
build/ \
dist/ \
.eggs/ \
.tox/ \
.coverage \
htmlcov/ \
coverage.xml \
junit.xml \
junit-*.xml
find . \( \
-name "*.egg-info" \
-o -name "*.egg" \
-o -name "*.pyc" \
-o -name "*.pyo" \
-o -name "*~" \
-o -name "__pycache__" \
\) \
-exec rm -fr {} +

lint: $(VIRTUALENV) ## check code style
$(PIPENV) check
@echo "$(TBOLD)Checking style style…$(T)"
@$(PIPENV_RUN) black --check $(BLACK_TARGETS)
.PHONY: lint
lint: $(INSTALL_STAMP) ## check code style
$(POETRY) run isort --check-only ./tests/ $(NAME)
$(POETRY) run black --check ./tests/ $(NAME) --diff
$(POETRY) run pflake8 ./tests/ $(NAME)
$(POETRY) run mypy ./tests/ $(NAME) --ignore-missing-imports
$(POETRY) run bandit -r $(NAME) -s B608


fmt: $(VIRTUALENV) ## apply code style formatting
$(PIPENV_RUN) isort --apply $(BLACK_TARGETS)
$(PIPENV_RUN) black $(BLACK_TARGETS)
.PHONY: fmt
fmt: $(INSTALL_STAMP) ## apply code style formatting
$(POETRY) run isort --profile=black --lines-after-imports=2 ./tests/ $(NAME)
$(POETRY) run black ./tests/ $(NAME)

.PHONY: test
test: $(INSTALL_STAMP) ## run tests
$(POETRY) run pytest

docs: $(VIRTUALENV)
$(PIPENV_RUN) $(MAKE) -C docs html
.PHONY: docs
docs: $(INSTALL_STAMP) ## build documentation
$(POETRY) run $(MAKE) -C docs html


docs-live: $(VIRTUALENV) ## build and view docs in real-time
$(PIPENV_RUN) sphinx-autobuild -b html \
.PHONY: docs-live
docs-live: $(INSTALL_STAMP) ## build and view docs in real-time
$(POETRY) run sphinx-autobuild -b html \
-p 0 \
--open-browser \
--watch ./ \
Expand All @@ -76,45 +90,3 @@ docs-live: $(VIRTUALENV) ## build and view docs in real-time
--ignore "setup.cfg" \
--ignore "Pipfile*" \
docs docs/_build/html
.PHONY: docs-live


lock: $(VIRTUALENV) ## regenerate Pipfile.lock file
$(PIPENV) lock
.PHONY: lock


clean: clean-build clean-pyc clean-env clean-test ## remove all build, test, coverage and Python artifacts
.PHONY: clean


clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
.PHONY: clean-build


clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
.PHONY: clean-pyc


clean-env: ## remove development virtualenv
pipenv --rm || true
.PHONY: clean-env


clean-test: ## remove test and coverage artifacts
rm -rf .tox/ \
.coverage \
htmlcov/ \
coverage.xml \
junit.xml \
junit-*.xml
.PHONY: clean-test
22 changes: 0 additions & 22 deletions Pipfile

This file was deleted.

0 comments on commit 83ac2a5

Please sign in to comment.