Skip to content

Commit

Permalink
chore(infrastructure): Switch to poetry for manage library requirements.
Browse files Browse the repository at this point in the history
As well as,

- Make `aiohttp-middlewares` PEP-561 compatible
- Use Circle CI 2.0 configuration
- Drop aiohttp 2 support
- Ensure Python 3.7 support
  • Loading branch information
playpauseandstop committed Oct 23, 2018
1 parent d1925fd commit a35dd49
Show file tree
Hide file tree
Showing 17 changed files with 809 additions and 133 deletions.
89 changes: 89 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
version: 2
jobs:
lint:
docker: &py37
- image: circleci/python:3.7.0
steps:
- checkout
- run: &install_poetry
name: Install poetry
command: pip install --user poetry
- run: &update_path
name: Update path
command: |
echo 'export PATH=$HOME/.local/bin:$PATH' >> $BASH_ENV
source $BASH_ENV
- run: make lint
test35:
docker:
- image: circleci/python:3.5.6
steps:
- checkout
- run: *install_poetry
- run: *update_path
- run: TOXENV=py35-aiohttp{30,31,32,33,34} make test
- run: mkdir -p test-results/nosetests
- run: "[ -r nosetests.xml ] && mv nosetests.xml test-results/nosetests/results.xml || :"
- store_test_results:
path: test-results
test36:
docker:
- image: circleci/python:3.6.6
steps:
- checkout
- run: *install_poetry
- run: *update_path
- run: TOXENV=py36-aiohttp30,py36-aiohttp31,py36-aiohttp32,py36-aiohttp33,py36-aiohttp34 make test
- run: mkdir -p test-results/nosetests
- run: "[ -r nosetests.xml ] && mv nosetests.xml test-results/nosetests/results.xml || :"
- store_test_results:
path: test-results
test37:
docker: *py37
steps:
- checkout
- run: *install_poetry
- run: *update_path
- run: TOXENV=py37-aiohttp30,py37-aiohttp31,py37-aiohttp32,py37-aiohttp33,py37-aiohttp34 make test
- run: mkdir -p test-results/nosetests
- run: "[ -r nosetests.xml ] && mv nosetests.xml test-results/nosetests/results.xml || :"
- store_test_results:
path: test-results
- run: make coveralls
deploy:
docker: *py37
steps:
- checkout
- run: *install_poetry
- run: *update_path
- run: make install deploy
workflows:
version: 2
ci:
jobs:
- lint:
filters: &all_tags_and_branches
tags:
only: /.*/
- test35:
requires:
- lint
filters: *all_tags_and_branches
- test36:
requires:
- lint
filters: *all_tags_and_branches
- test37:
requires:
- lint
filters: *all_tags_and_branches
- deploy:
requires:
- test35
- test36
- test37
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
application-import-names = aiohttp_middlewares
import-order-style = smarkets
max-complexity = 15
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*.egg
*.egg-info
*.egg*
*.py[co]

.coverage
Expand All @@ -13,3 +12,4 @@ dist/
docs/_build/
env/
.tox/
.venv/
11 changes: 11 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
0.2.0 (In Development)
======================

0.2.0a1 (2018-10-23)
--------------------

- Ensure Python 3.7 support
- Drop aiohttp 2 support
- Ensure support latest aiohttp version (``3.4.4``)
- Make library [PEP-561](https://www.python.org/dev/peps/pep-0561/) compatible

0.1.1 (2018-05-25)
==================

Expand Down
48 changes: 12 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
.PHONY: clean coveralls deploy distclean docs install lint setup-pyenv test
.PHONY: clean coveralls deploy distclean docs install lint test

# Project settings
PROJECT = aiohttp_middlewares

# Virtual environment settings
ENV ?= env
VENV = $(shell python -c "import sys; print(int(hasattr(sys, 'real_prefix')));")

# Python commands
ifeq ($(VENV),1)
COVERALLS = coveralls
PYTHON = python
SPHINXBUILD = sphinx-build
else
COVERALLS = $(ENV)/bin/coveralls
PYTHON = $(ENV)/bin/python
SPHINXBUILD = `pwd`/$(ENV)/bin/sphinx-build
endif

# Bootstrapper args
ifeq ($(CIRCLECI),true)
bootstrapper_args = --ignore-activated
endif
POETRY ?= poetry
PYTHON ?= $(POETRY) run python
SPHINXBUILD ?= $(POETRY) run sphinx-build

# Tox args
ifneq ($(TOXENV),)
Expand All @@ -34,7 +19,7 @@ clean:
find . \( -name __pycache__ -o -type d -empty \) -exec rm -rf {} + 2> /dev/null

coveralls:
-$(COVERALLS)
-$(PYTHON) -m coveralls

deploy:
ifeq ($(TWINE_USERNAME),)
Expand All @@ -45,36 +30,27 @@ ifeq ($(TWINE_PASSWORD),)
# TWINE_PASSWORD env var should be supplied
exit 1
endif
ifeq ($(CIRCLECI),)
ifneq ($(CIRCLECI),)
$(MAKE) test
endif
rm -rf build/ dist/
python setup.py sdist bdist_wheel
$(PYTHON) -m twine upload dist/*

distclean: clean
rm -rf build/ dist/ *.egg*/ $(ENV)/
rm -rf build/ dist/ *.egg*/ .venv/

docs: .install
$(MAKE) -C docs/ SPHINXBUILD=$(SPHINXBUILD) html
$(MAKE) -C docs/ SPHINXBUILD="$(SPHINXBUILD)" html

install: .install
.install: setup.py requirements-dev.txt
python -m bootstrapper -r requirements-dev.txt -e $(ENV)/ $(bootstrapper_args)
.install: poetry.lock pyproject.toml
$(POETRY) install
touch $@

lint:
TOXENV=lint $(MAKE) test

list-outdated: .install
$(PYTHON) -m pip list -lo

setup-pyenv:
ifneq ($(CIRCLECI),)
pyenv local 3.5.3 3.6.2
else
pyenv local 3.5.4 3.6.4
endif
poetry.lock:
$(POETRY) install

test: .install clean
$(PYTHON) -m tox $(tox_args) $(TOX_ARGS) -- $(TEST_ARGS)
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
aiohttp-middlewares
===================

.. image:: https://img.shields.io/circleci/project/playpauseandstop/aiohttp-middlewares/master.svg?maxAge=2592000
.. image:: https://img.shields.io/circleci/project/github/playpauseandstop/aiohttp-middlewares/master.svg
:target: https://circleci.com/gh/playpauseandstop/aiohttp-middlewares
:alt: CircleCI

Expand Down Expand Up @@ -32,6 +32,6 @@ applications.
- Works on Python 3.5+
- BSD licensed
- Latest documentation `on Read The Docs
<http://aiohttp-middlewares.readthedocs.io/>`_
<https://aiohttp-middlewares.readthedocs.io/>`_
- Source, issues, and pull requests `on GitHub
<https://github.com/playpauseandstop/aiohttp-middlewares>`_
Empty file added aiohttp_middlewares/py.typed
Empty file.
2 changes: 1 addition & 1 deletion aiohttp_middlewares/shield.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
r"""
==========================
aiohttp_middlewares.shield
==========================
Expand Down
27 changes: 0 additions & 27 deletions circle.yml

This file was deleted.

2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Sphinx==1.8.1
sphinx_autodoc_typehints==1.3.0

0 comments on commit a35dd49

Please sign in to comment.