Repository navigation
Releases
Releases · timepieces141/dynamic-versioning
Dynamic Versioning 1.1.0
Version 1.1.0 (#8) * Egg info refactor (#7) * major refactor for PEP 517 Hopefully this refactor buys some time until setuptools removes the code that still supports executing setup.py directly. Afte that, we'll see if there is even anything left to hook into. If not, I guess I am writing my own build-backend! Changes: dev-requirements.txt: Added a few linters I've grown accustom to using through work. I could give or take mypy, but I'll use it until it pisses me off. requirements.txt: Added toml for parsing pyproject.toml and Deprecated to deprecate the configure() function. setup.py: Yeah, we'll punt on trying to use the current version to dynamically bump the version - a bit cart before the horse. __init__.py: A lot less to export. commands.py: Major refactor. Highlights include: - Only need to override egg_info class/command because that is where version is determined. - No more command line arguments - they don't work. Now we pull the values from configuration first, overriden by the environment. - we determine the version during egg_info's call to tagged_version() instead of during run(). The setuptools documentation suggested overriding finalize_options() but the version is determined mid way through, so this approach has us reimplementing the least amount of setuptools code. configuration.py: Major refactor here, too, as most of the previous code here had to do with allowing a version.py file in the top level package to act as an override. This seemed useless so that functionality has gone away. We do load either a dynamic_versioning.ini file, or the pyproject.toml file if the INI file is not found. The configure() function is no longer needed, so it has been marked for deprecation, which will probably happen in a few versions. utils.py: Broke up the git_describe() function into a couple of smaller functions (also renamed it). And all of the version bumping and string formatting is not encapsulated in a new class. All three test files overhauled to match the new functionality. run_tests.sh: My updated test script to run all the linters. New Files: - conftest.py: auto use fixture to give each test a fresh environment - .isort.cfg and mypy.ini: config for those linters * Publish to PyPI; docs; current-version config.yml: added jobs to publish to PyPI (and test PyPI) on the appropriate branches. Need to update to do this only when certain files are changed, though. README.md: Completely overhauled for the new functionality. commands.py: added current-version field, validation for it, docs on when it gets used, and now call `utils.get_version_from_git()` with it. utils.py: rearranged PATCH to be the default; added loging to `get_version_from_git() to use the fallback current version when there is an error trying to do git describe. This should be good for creating source distro packages which will then be turned into wheels by pip on the target machine. Updated tests for those changes. Added a CHANGELOG and py.typed, since we are trying to adhere to typing hints. * Unit tests that don't need git present CHANGELOG.md: looks like we're publishing on the 7th instead configuration.py: after wrapping the configure() function signature I had to relocate the pylint disable for the unused arguments. utils.py: Not re-raising SystemExit, so no need to capture it as a variable. Replaced SystemExit in git_describe() since we don't actually exit if an error is raised from this function. Created a base exception and a new exception to take its place. test_utils.py: We now mock Popen itself (as a context manager) so we don't attempt to call the git fetch or git describe during tests. With the old way, we were, we just ignored its output in favor of our mocked communicate. Now, no subprocess is actually created, which is more correct and definitely cleaner.