diff --git a/.gitignore b/.gitignore index be6d5ab..e1fc810 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,13 @@ *.egg-info/ -*.py[cod] +*.py[rcod] .cache/ .coverage .eggs/ .tox/ +.venv/ +build/ +coverage.* +dist/ doc/build/ +htmlcov/ +pip-wheel-metadata/ diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..66460d4 --- /dev/null +++ b/.python-version @@ -0,0 +1,2 @@ +3.7.6 +3.6.7 diff --git a/doc/source/development.rst b/doc/source/development.rst index 2f58a13..4724c13 100644 --- a/doc/source/development.rst +++ b/doc/source/development.rst @@ -37,21 +37,12 @@ Tag the release and push to github.com Upload to `PyPI`_ ^^^^^^^^^^^^^^^^^ -* Install `Twine`_ using `pip`. - - .. code-block:: bash - - $ pip install twine - * Upload to `PyPI`_. .. code-block:: bash - $ cd /path/to/gilt - $ rm -rf build/ dist/ - $ python setup.py sdist bdist_wheel - $ twine upload dist/* - $ rm -rf build/ dist/ + $ tox -e build-dists + $ tox -e publish-dists Post-release ------------ @@ -65,4 +56,3 @@ Roadmap .. _`PyPI`: https://pypi.python.org/pypi/python-gilt .. _`ISSUES`: https://github.com/metacloud/gilt/issues -.. _`Twine`: https://pypi.python.org/pypi/twine diff --git a/gilt/__init__.py b/gilt/__init__.py index 6975223..4a1c3ca 100644 --- a/gilt/__init__.py +++ b/gilt/__init__.py @@ -20,7 +20,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import pbr.version +try: + import pkg_resources -version_info = pbr.version.VersionInfo('python-gilt') # noqa -__version__ = version_info.release_string() + __version__ = pkg_resources.get_distribution('gilt').version +except Exception: # pragma: no cover + __version__ = 'unknown' diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6bfbd72 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,8 @@ +[build-system] +requires = [ + 'setuptools >= 41.0.0', + 'setuptools_scm >= 1.15.0', + 'setuptools_scm_git_archive >= 1.0', + 'wheel', +] +build-backend = 'setuptools.build_meta' diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 9364580..0000000 --- a/requirements.txt +++ /dev/null @@ -1,7 +0,0 @@ -click -colorama -fasteners -git-url-parse -pbr -PyYAML -sh diff --git a/setup.cfg b/setup.cfg index e91dce8..087daea 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,10 +1,16 @@ +[aliases] +dists = clean --all sdist bdist_wheel + +[bdist_wheel] +universal = 1 + [metadata] name = python-gilt summary = gilt - A GIT layering tool. description-file = README.rst author = John Dewey -author-email = jodewey@cisco.com -home-page = https://github.com/metacloud/gilt +author-email = john@dewey.ws +home-page = https://github.com/retr0h/gilt classifier = Development Status :: 4 - Beta Environment :: Console @@ -15,29 +21,52 @@ classifier = License :: OSI Approved :: MIT License Natural Language :: English Operating System :: OS Independent - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 Topic :: System :: Systems Administration Topic :: Utilities -[pbr] -skip_authors = True -skip_changelog = True -warnerrors = True +[options] +use_scm_version = True +python_requires = >=3.6 +packages = find: +include_package_data = True +zip_safe = False + +# These are required during `setup.py` run: +setup_requires = + setuptools_scm >= 1.15.0 + setuptools_scm_git_archive >= 1.0 + +# These are required in actual runtime: +install_requires = + click + colorama + fasteners + git-url-parse + PyYAML + sh -[global] -setup-hooks = - pbr.hooks.setup_hook +[options.extras_require] +# These are required during test: +test = + flake8 + hacking + pep517 + pytest + pytest-cov + pytest-helpers-namespace + pytest-mock + twine + yapf==0.16.3 -[entry_points] +[options.entry_points] console_scripts = gilt = gilt.shell:main -[files] -packages = - gilt +[options.packages.find] +where = . [build_sphinx] all_files = 1 diff --git a/setup.py b/setup.py index 9793a62..4be3fd1 100644 --- a/setup.py +++ b/setup.py @@ -22,4 +22,7 @@ import setuptools -setuptools.setup(setup_requires=['pbr'], pbr=True) +if __name__ == "__main__": + setuptools.setup( + use_scm_version=True, setup_requires=["setuptools_scm"], + ) diff --git a/test-requirements.txt b/test-requirements.txt deleted file mode 100644 index cbe8719..0000000 --- a/test-requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -flake8 -pytest -pytest-cov -pytest-helpers-namespace -pytest-mock -yapf==0.16.3 diff --git a/tox.ini b/tox.ini index b1f3018..b642221 100644 --- a/tox.ini +++ b/tox.ini @@ -1,18 +1,17 @@ [tox] minversion = 1.8 envlist = - py{27,36}-unit - py{27,36}-lint + py{36,37}-unit + py{36,37}-lint doc [testenv] passenv = * -deps = - -rrequirements.txt - -rtest-requirements.txt commands = unit: py.test --runslow -vv {posargs} lint: flake8 +extras = + test [testenv:format] commands = @@ -24,3 +23,31 @@ deps= -rdoc-requirements.txt commands= python setup.py build_sphinx --builder=html + +[testenv:build-dists-local] +usedevelop = false +skip_install = true +commands = + python -m pep517.build \ + --source \ + --binary \ + --out-dir {toxinidir}/dist/ \ + {toxinidir} + +[testenv:build-dists] +commands = + rm -rfv {toxinidir}/dist/ + {[testenv:build-dists-local]commands} +whitelist_externals = + rm + +[testenv:publish-dists] +commands = + bash -c '\ + twine upload {toxinidir}/dist/*.whl \ + -u $TWINE_USERNAME \ + -p $TWINE_PASSWORD \ + --repository-url $TWINE_REPOSITORY \ + ' +whitelist_externals = + bash