Closed jsolbrig closed 1 year ago
Thanks for this suggestion :) I think this is a good way to handle your use case in #146.
I've added support for the following:
[tool.poetry-dynamic-versioning.files."package/_version.py"]
persistent-substitution = true
initial-content = """
__version__ = "0.0.0"
__version_tuple__ = (0, 0, 0)
"""
It will create/reinitialize the file first, then apply the normal substitutions to it. Since */_version.py
is one of the default paths for substitutions, the above section may be all you need to add.
This is now available in v1.1.0.
Thank you for doing this. That was really quick turnaround!
I'll try to test this out this afternoon and see how it goes.
It would be very helpful if there an option could be added that would allow creating version files rather than requiring templates. This would improve interaction with version control by removing the requirement to have dynamic files checked in and would allow
pip install -e .
to work correctly (see #146). I'd like to see this operate in a similar way tosetuptools_scm
which creates the version files rather than templating them.It could probably be done in the current structure by adding options to the
tool.poetry-dynamic-versioning.substitution
table. Alternatively, it could be done under a new table such astool.poetry-dynamic-versioning.create
.If done under a new table, I imagine it might look like this:
If you like the idea, I might be able to find the time to implement it.