Closed ohmycaptainnemo closed 1 year ago
I don't like repeating either. Taking files
as array makes a lot sense here. One problem is, the search/replace keywords has to be same for all the files, which might not be the case always.
I'd suggest an extension of your proposition
[[tool.poetry_bumpversion.replacements]]
files = ["file_1.py", "file_2.py"]
search = '__version__ = "{current_version}"'
replace = '__version__ = "{new_version}"'
[[tool.poetry_bumpversion.replacements]]
files = ["README.md"]
search = 'version: "{current_version}"'
replace = 'version: "{new_version}"'
This way we can also keep the backward compatibility of tool.poetry_bumpversion.file
syntax.
I don't like repeating either. Taking
files
as array makes a lot sense here. One problem is, the search/replace keywords has to be same for all the files, which might not be the case always.I'd suggest an extension of your proposition
[[tool.poetry_bumpversion.replacements]] files = ["file_1.py", "file_2.py"] search = '__version__ = "{current_version}"' replace = '__version__ = "{new_version}"' [[tool.poetry_bumpversion.replacements]] files = ["README.md"] search = 'version: "{current_version}"' replace = 'version: "{new_version}"'
This way we can also keep the backward compatibility of
tool.poetry_bumpversion.file
syntax.
I see. The search/replace keyword does not have to be the same for all the files. What I mean is that if the search/replace keyword for all the files is the same, then put the files under the same section, like how you have done in the first paragraph of your code above. If the search/replace keywords are not the same, then one can put them in a new section like how you have the README file in the second paragraph. If you think about it realistically, there would not be many practical applications anyways when the user would like to have more than two separate versions to change in a single app.
This feature is now available in version 0.2.0
Thank you for the legendary effort.
Just letting you know that version 0.2.0 does not seem to be installable. When I try to install it I get an error saying no versions matching 0.2.0 were found. Also, I think using the new method you introduced, the version in your files always lags behind the pyproject.toml version. However, this was not an issue with the first approach before this change. If you give the new way a go, you should see what I mean. If not, I am happy to elaborate more.
This version uses the same method as previous version, it just adds a new feature to it. So previous features should work as it was. I can also install it with no issues.
Thank you.
Hi @monim67
Love your work.
Correct me if I am mistaken, but currently, if one would like to bump the version in say two separate files (i.e. file_1.py and file_2.py), one needs to add two code blocks like this:
I was hoping we could avoid this repetition and instead of doing what I showed above, we do something like this:
What are your thoughts?