Skip to content

feat: replace hardcoded __version__ with git-tag-based versioning - #88

Merged
lasch merged 2 commits into
IBM:mainfrom
aryanputta:feat/git-tag-versioning
Mar 25, 2026
Merged

lasch merged 2 commits into
IBM:mainfrom
aryanputta:feat/git-tag-versioning

Conversation

@aryanputta

Copy link
Copy Markdown
Contributor

Fixes #45

Description

The version number in this package was hardcoded as a string in src/aiu_trace_analyzer/__init__.py. This means every release requires a manual commit to bump it, which is error-prone and easy to forget.

This PR switches to git-tag-based versioning using setuptools-scm. The version is now derived automatically from the current git tag. If the package is installed from a checkout that is not on a tagged commit, the version will include a dev suffix. If the package is not installed at all, it falls back to "unknown".

Changes Made

  • pyproject.toml: added setuptools-scm>=8 to build requirements and added an empty [tool.setuptools_scm] section to activate git-tag versioning
  • src/aiu_trace_analyzer/__init__.py: replaced __version__ = "1.0.2" with an importlib.metadata lookup that reads the version from the installed package metadata

How Was This Tested?

  • Manual Verification: Confirmed the package still imports correctly and version resolves to the expected value when installed.

AI Usage Disclosure

  • No AI used.

@lasch

lasch commented Mar 23, 2026

Copy link
Copy Markdown
Member

@aryanputta thank you for starting this effort, really appreciated!

There are a few minor things to address to make the build process and checks happy.

  • the DCO check complains about some of the commits missing a 'sign-off'
  • the build process complains about simultaneous use of 'setuptools.dynamic' and 'setuptools-scm'.

@aryanputta

Copy link
Copy Markdown
Contributor Author

Will check right now and fix it also just started doing open source so any advice will be great.

@lasch

lasch commented Mar 23, 2026

Copy link
Copy Markdown
Member

NP. Take it easy.

  • to fix the sign-off thing, you'll probably need to rebase your commits and use the --signoff flag. I think, clicking on that DCO has explanations of the processes.
  • the other item seems to indicate that removing the last 2 lines from the pyproject.toml could do the trick, but I haven't checked that.

@aryanputta

Copy link
Copy Markdown
Contributor Author

Yeah I'll work on it , thanks for the advice. If you have any other things you'd like me to work on after this let me know. Thanks!

@aryanputta
aryanputta force-pushed the feat/git-tag-versioning branch from 30f7195 to 56b9566 Compare March 23, 2026 19:39

@lasch lasch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

An appreciated addition. Looks good. Thx.

Before merging, it requires the commits to have both:

  • sign-off and
  • verified signature
    The first version had the verified signature but no sign-off, this time it's the other way around.
    Should be an easy fix. Otherwise, good to go.

@aryanputta
aryanputta force-pushed the feat/git-tag-versioning branch from 56b9566 to 917a702 Compare March 23, 2026 20:26
@aryanputta aryanputta closed this Mar 23, 2026
@aryanputta
aryanputta force-pushed the feat/git-tag-versioning branch from a161f54 to 917a702 Compare March 23, 2026 20:27
Signed-off-by: aryan <aryansputta@gmail.com>
Signed-off-by: aryan <aryansputta@gmail.com>
@aryanputta aryanputta reopened this Mar 23, 2026
@lasch
lasch merged commit bed6073 into IBM:main Mar 25, 2026
3 checks passed
@aryanputta
aryanputta deleted the feat/git-tag-versioning branch April 20, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

version number based on git commit/tags

2 participants