Skip to content

Change to using automatic versioning from Git tags#213

Merged
JeanLucPons merged 6 commits intomainfrom
automatic-versioning
Mar 9, 2026
Merged

Change to using automatic versioning from Git tags#213
JeanLucPons merged 6 commits intomainfrom
automatic-versioning

Conversation

@TeresiaOlsson
Copy link
Contributor

I have added automatic versioning from Git tags in the pyproject.toml. Advantages of this:

  • There is no hardcoded version number that needs to be manually bumped when making a new release. Instead the release can be built based on a Git tag which simplifies the release workflow.

  • If you install directly from the Git repository you will get a version number based on the next release number + the commit number making it easier to distinguish between the developer version and the released version. This helps to know which version you have installed when debugging. For example it might look like this in pip list:

accelerator-middle-layer  0.2.4.dev166+g983a827d1.d20260309

@JeanLucPons
Copy link
Contributor

If you want to implement auto-versioning using git-tag, please do not forget to update the CONTRIBUTING.md file.
Thanks

@TeresiaOlsson
Copy link
Contributor Author

If you want to implement auto-versioning using git-tag, please do not forget to update the CONTRIBUTING.md file. Thanks

Good reminder. I will do that when I managed to get it to work. Currently trying to figure out what to do to get the documentation to still build since hatch doesn't seem to automatically add the __version__ attribute in the way I expected.

@TeresiaOlsson TeresiaOlsson marked this pull request as draft March 9, 2026 12:41
@gubaidulinvadim
Copy link
Contributor

@TeresiaOlsson my llm-driven exploration was suggesting to use comittizen with hatch to build automatic versions.

@TeresiaOlsson
Copy link
Contributor Author

@TeresiaOlsson my llm-driven exploration was suggesting to use comittizen with hatch to build automatic versions.

I think the solution is at this page https://github.com/ofek/hatch-vcs. Trying to use my llm exploration to understand what it actually means what is said about versions on that page ;)

@TeresiaOlsson
Copy link
Contributor Author

I think I have fixed all problems now. At least all workflows runs successfully. So it's ready to reviewed.

@TeresiaOlsson TeresiaOlsson marked this pull request as ready for review March 9, 2026 13:34
gupichon
gupichon previously approved these changes Mar 9, 2026
Copy link
Contributor

@gupichon gupichon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok to me

@JeanLucPons
Copy link
Contributor

JeanLucPons commented Mar 9, 2026

Did you forget to add pyaml/_verion.py ?

[tool.hatch.build.hooks.vcs]
version-file = "pyaml/_version.py"

@gubaidulinvadim
Copy link
Contributor

@TeresiaOlsson could you also rename the merge request? So, the name is more descriptive of what you actually did? (automatic versioning)

@JeanLucPons JeanLucPons requested a review from gupichon March 9, 2026 14:32
@gupichon
Copy link
Contributor

gupichon commented Mar 9, 2026

Did you forget to add pyaml/_verion.py ?

[tool.hatch.build.hooks.vcs]
version-file = "pyaml/_version.py"

As I understand it, it is generated, right?

@JeanLucPons
Copy link
Contributor

If it is a generated file, please add it in .gitignore.

@TeresiaOlsson
Copy link
Contributor Author

If it is a generated file, please add it in .gitignore.

Yes, it's generated. I will add it to .gitignore.

@TeresiaOlsson TeresiaOlsson changed the title Remove unused __version__. Change to using automatic versioning from Git tags Mar 9, 2026
Copy link
Contributor

@gupichon gupichon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally. Works fine.

@JeanLucPons JeanLucPons merged commit b7659c1 into main Mar 9, 2026
3 checks passed
@JeanLucPons JeanLucPons deleted the automatic-versioning branch March 9, 2026 16:48
@gubaidulinvadim gubaidulinvadim added the invalid This doesn't seem right label Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants