From 7dcdb4982f291aaa5f8438869a4bb09e0ee1664c Mon Sep 17 00:00:00 2001 From: Marcel Loose <loose@astron.nl> Date: Wed, 11 Jan 2023 15:38:29 +0000 Subject: [PATCH] Integrate setuptools_scm --- .gitignore | 3 +++ MANIFEST.in | 1 - README.md | 4 ++-- VERSION | 1 - {map => my_awesome_app}/__init__.py | 0 {map => my_awesome_app}/cool_module.py | 0 pyproject.toml | 14 ++++++++++++-- setup.cfg | 1 - tests/test_cool_module.py | 2 +- tox.ini | 4 ++-- 10 files changed, 20 insertions(+), 10 deletions(-) delete mode 100644 VERSION rename {map => my_awesome_app}/__init__.py (100%) rename {map => my_awesome_app}/cool_module.py (100%) diff --git a/.gitignore b/.gitignore index 4af2633..f886c6f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,9 @@ dist/* coverage.xml htmlcov/* +# Setuptools SCM +my_awesome_app/_version.py + # IDE configuration .vscode .idea diff --git a/MANIFEST.in b/MANIFEST.in index b13ed9c..c4a3399 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,5 @@ include LICENSE include README.md -include VERSION recursive-include docs * recursive-exclude tests * diff --git a/README.md b/README.md index 979ee10..d52dc03 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,12 @@ If you find some missing functionality with regards to CI/CD, testing, linting o ## Installation ``` -pip install map +pip install . ``` ## Usage ``` -from map import cool_module +from my_awesome_app import cool_module cool_module.greeter() # prints "Hello World" ``` diff --git a/VERSION b/VERSION deleted file mode 100644 index ceab6e1..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.1 \ No newline at end of file diff --git a/map/__init__.py b/my_awesome_app/__init__.py similarity index 100% rename from map/__init__.py rename to my_awesome_app/__init__.py diff --git a/map/cool_module.py b/my_awesome_app/cool_module.py similarity index 100% rename from map/cool_module.py rename to my_awesome_app/cool_module.py diff --git a/pyproject.toml b/pyproject.toml index 3588ce5..0dac729 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,13 @@ [build-system] -requires = ['setuptools>=42', 'wheel'] -build-backend = 'setuptools.build_meta' +requires = [ + "setuptools>=45", + "setuptools_scm[toml]>=6.2", + "wheel" +] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +write_to = "my_awesome_app/_version.py" + +[tool.pylint] +ignore = "_version.py" diff --git a/setup.cfg b/setup.cfg index 49a4e69..97e129f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,5 @@ [metadata] name = my-awesome-app -version = file: VERSION description = An example package for CI/CD working group long_description = file: README.md long_description_content_type = text/markdown diff --git a/tests/test_cool_module.py b/tests/test_cool_module.py index da1002b..4ab4889 100644 --- a/tests/test_cool_module.py +++ b/tests/test_cool_module.py @@ -1,7 +1,7 @@ """Testing of the Cool Module""" from unittest import TestCase -from map.cool_module import greeter +from my_awesome_app.cool_module import greeter class TestCoolModule(TestCase): diff --git a/tox.ini b/tox.ini index c053064..d538894 100644 --- a/tox.ini +++ b/tox.ini @@ -34,8 +34,8 @@ commands = black: {envpython} -m black --version black: {envpython} -m black --check --diff . pylint: {envpython} -m pylint --version - pylint: {envpython} -m pylint map tests - format: {envpython} -m autopep8 -v -aa --in-place --recursive map + pylint: {envpython} -m pylint my_awesome_app tests + format: {envpython} -m autopep8 -v -aa --in-place --recursive my_awesome_app format: {envpython} -m autopep8 -v -aa --in-place --recursive tests format: {envpython} -m black -v . -- GitLab