From 741af3e67e0463fdf3d67b4713540472ed09e107 Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Sun, 30 Oct 2016 14:41:33 +0200 Subject: [PATCH 1/6] Add makefile with publish command --- Makefile | 6 ++++++ docs/main/changelog.rst | 1 + setup.py | 25 ------------------------- 3 files changed, 7 insertions(+), 25 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..5fb0b204 --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ +VERSION:=$(shell python setup.py --version) + +publish: + python setup.py sdist upload + git tag -a $(VERSION) -m 'version $(VERSION)' + git push --tags diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index 4de4f4e6..6c3161de 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -10,6 +10,7 @@ follows `Semantic versioning`_ Development version ------------------- - Remove ``@inject`` decorator. +- Add makefile. .. - No features. diff --git a/setup.py b/setup.py index 5a11962c..f6472771 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,8 @@ """`Dependency injector` setup script.""" -import os import re from setuptools import setup -from setuptools import Command # Getting description: @@ -20,26 +18,6 @@ with open('dependency_injector/__init__.py') as init_file: version = re.search('VERSION = \'(.*?)\'', init_file.read()).group(1) -class PublishCommand(Command): - """Setuptools `publish` command.""" - - description = "Publish current distribution to PyPi and create tag" - user_options = [] - - def initialize_options(self): - """Init options.""" - - def finalize_options(self): - """Finalize options.""" - - def run(self): - """Command execution.""" - self.run_command('sdist') - self.run_command('upload') - os.system('git tag -a {0} -m \'version {0}\''.format(version)) - os.system('git push --tags') - - setup(name='dependency-injector', version=version, description='Dependency injection microframework for Python', @@ -58,9 +36,6 @@ setup(name='dependency-injector', platforms=['any'], zip_safe=True, install_requires=requirements, - cmdclass={ - 'publish': PublishCommand, - }, keywords=[ 'DI', 'Dependency injection', From cad0a849460864b2dbe96696d01e40e9a4b9d253 Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Sun, 30 Oct 2016 23:59:42 +0200 Subject: [PATCH 2/6] Add clean & tests commands to makefile --- Makefile | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5fb0b204..46b84088 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,35 @@ VERSION:=$(shell python setup.py --version) -publish: +clean: + # Clean sources + find dependency_injector -name '*.py[co]' -delete + find dependency_injector -name '__pycache__' -delete + find dependency_injector -name '*.c' -delete + find dependency_injector -name '*.so' -delete + # Clean tests + find tests -name '*.py[co]' -delete + find tests -name '__pycache__' -delete + # Clean examples + find examples -name '*.py[co]' -delete + find examples -name '__pycache__' -delete + +tests: clean + # Unit tests with coverage report + coverage erase + coverage run --rcfile=./.coveragerc -m unittest2 discover tests + coverage report --rcfile=./.coveragerc + coverage html --rcfile=./.coveragerc + coverage erase + # Static analysis + flake8 --max-complexity=10 dependency_injector/ + flake8 --max-complexity=10 examples/ + # Code style analysis + pydocstyle dependency_injector/ + pydocstyle examples/ + +publish: clean + # Create and upload build python setup.py sdist upload + # Create and upload tag git tag -a $(VERSION) -m 'version $(VERSION)' git push --tags From a7dea88063060d2ee8e809f162384fa4033e1eee Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Mon, 31 Oct 2016 00:00:19 +0200 Subject: [PATCH 3/6] Change path to unit tests coverage report --- .coveragerc | 3 +++ .gitignore | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.coveragerc b/.coveragerc index f7b135a6..9369b60a 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,3 +1,6 @@ [run] include = dependency_injector/* omit = tests/* + +[html] +directory=reports/unittests/ diff --git a/.gitignore b/.gitignore index a1c86b0b..54f697ba 100644 --- a/.gitignore +++ b/.gitignore @@ -33,7 +33,7 @@ pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports -htmlcov/ +reports/ .tox/ .coverage .cache @@ -62,8 +62,5 @@ venv/ # SQLite *.db -# JointJS Experiments -jointjs/ - # Vim Rope .ropeproject/ From a04740a27e43c5c85d452deec27fb9ad4bae78b7 Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Mon, 31 Oct 2016 00:00:41 +0200 Subject: [PATCH 4/6] Update list of development requirements --- requirements-dev.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/requirements-dev.txt b/requirements-dev.txt index d00c58f7..2b71e644 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -4,3 +4,6 @@ sphinx sphinx_rtd_theme sphinx_autobuild autodoc +coverage +flake8 +pydocstyle From 78f68468ce55e56b51dc81470fe2028e9294b830 Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Mon, 31 Oct 2016 00:00:54 +0200 Subject: [PATCH 5/6] Remove dev environment from tox --- tox.ini | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/tox.ini b/tox.ini index 2b8649a7..df81f63a 100644 --- a/tox.ini +++ b/tox.ini @@ -8,24 +8,6 @@ deps= commands= unit2 discover tests [] -[testenv:dev] -basepython=python2.7 -deps= - {[testenv]deps} - coverage - flake8 - pydocstyle -commands= - coverage erase - coverage run --rcfile=./.coveragerc -m unittest2 discover tests [] - coverage html --rcfile=./.coveragerc - - flake8 --max-complexity=10 dependency_injector/ - flake8 --max-complexity=10 examples/ - - pydocstyle dependency_injector/ - pydocstyle examples/ - [testenv:coveralls] basepython=python2.7 passenv=TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH From 9b7d266e71143ae0a05d740e3e0c9f51cf8c2c1c Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Mon, 31 Oct 2016 00:01:17 +0200 Subject: [PATCH 6/6] Update changelog with makefile changes --- docs/main/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index 6c3161de..f0db1f01 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -10,7 +10,7 @@ follows `Semantic versioning`_ Development version ------------------- - Remove ``@inject`` decorator. -- Add makefile. +- Add makefile (``clean``, ``tests`` & ``publish`` commands). .. - No features.