-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
pass ScmVersion
to dump_version to provide scm_version as extra template variable
#854
Conversation
Signed-off-by: Zhiyuan Chen <chenzhiyuan@dp.tech>
Signed-off-by: Zhiyuan Chen <chenzhiyuan@dp.tech>
for more information, see https://pre-commit.ci
src/setuptools_scm/__init__.py
Outdated
parsed_version, | ||
version_scheme=config.version_scheme, | ||
local_scheme=config.local_scheme, | ||
) | ||
if config.write_to is not None: | ||
dump_version( | ||
root=config.root, | ||
version=version_string, | ||
version=parsed_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.
i recommend using the name scm_version or parsed_version as input names so it can be distinguished
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 for preparing this
unfortunately the argument rename is a breaking change that will get downstreams by surprise
as such the old name needs to stay and the new object needs to go in by a different name
there may be need for extra considerations wrt what attributes to put on ScmVersion to help formatting
Version
to dump_versionScmVersion
to dump_version to provide scm_version as extra template variable
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.
this looks much better now, thanks!
for completeness i would recommend to add a unit-test that uses a custom template to dump the node in addition to the normal version and checks for it
with the addition of a changelog note on the feature addition this would be ready to merge then
i presume the pdb calls will go away then
👍
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
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.
I took note that adding the parameter as is, does a avoidable breaking change
I recommend changing it to a optional keyword only parameter
As for testing,there is need for a own test that uses a custom template that's actually using data from the SCM version
testing/test_basic_api.py
Outdated
dump_version(tmp_path, "1.0.1+g4ac9d2c", "second.py") | ||
version = "1.0.1+g4ac9d2c" | ||
scm_version = meta("1.0.1", node="g4ac9d2c", config=c) | ||
dump_version(tmp_path, version, scm_version, "second.py") |
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.
Unfortunately this doesn't Test The new feature
Signed-off-by: Zhiyuan Chen <chenzhiyuan@dp.tech>
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.
Excellent work, thanks
Please confirm if i should squash or merge
I'll give it a last look over once I return to the computer
Signed-off-by: Zhiyuan Chen <chenzhiyuan@dp.tech>
for more information, see https://pre-commit.ci
Thanks~ I believe it's better to squash the changes, as most commits are redundant" |
Thanks for enabling this |
fixes #853
related to #818
related to #577