-
-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow Custom Version Scheme Outside setup.py (resolves #781) #803
Allow Custom Version Scheme Outside setup.py (resolves #781) #803
Conversation
for more information, see https://pre-commit.ci
…b.com:schang412/setuptools_scm into feature/custom_version_scheme_outside_setuppy
for more information, see https://pre-commit.ci
Thanks for having a look at this I'll have to investigate how that would integrate with the delayed simplify_types branch |
Looking at the branch in your fork, it seems like the changes just need to be moved to a different file. If you'd like, after merging simplify_types, I can update my PR to reflect the changes necessary. |
I'll enable that I intend to completely change how version schemes work, so people can pick and choose them with extra configuration instead of dropping into functions most of the time |
its merged, please have a look |
Hi, I updated my branch. Please let me know if there’s any issues or anything I should change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One item that's missing is a unit or acceptance test for the behaviour
Sure, I can make one. Is testing/test_config.py the most appropriate place? |
Most likely for now |
testing/test_version.py
Outdated
format_version( | ||
version, | ||
local_scheme="no-local-version", | ||
version_scheme="setuptools_scm.version:guess_next_dev_version", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should pick a non-default version scheme and check that it is actually used
Hi, I updated it to use a non-default version scheme, and merged the latest main branch in but some tests are failing for windows now. I'm not sure why. Curiously, one of the Windows tests passed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Currently, there is no way to specify a custom version_scheme if you are not using setup.py. When provided a string that does not match the name of a valid entrypoint, the main version is assigned
None
and fails the assert.This patch provides a method to specify a qualified name for a function using the same syntax as an console script entrypoint:
In order to accomplish this, when going through the available version schemes, if no version scheme is found, it treats the string as a qualified function name, and tries to load it using
importlib.metadata.EntryPoint
. If this does not lead to a valid function, it will maintain current behavior.