Skip to content

Generate version string dynamically #180

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

Merged
merged 4 commits into from
Apr 7, 2025

Conversation

Pennycook
Copy link
Contributor

Related issues

Proposed changes

  • Use importlib to extract the version metadata from whatever pip labelled the package when it was installed.
  • Configure setuptools-scm to generate the version string automatically from the latest semver tag and git status.
  • Move codebasin.version to codebasin.__version__ to align with the convention used by other packages.
  • Fix cbi-tree --version, which used the string "CBI Coverage Tool" by mistake.

The new behavior in action:

>>> import codebasin
>>> codebasin.__version__
'1.2.1.dev313+g63df3e8'
$ codebasin --version
Code Base Investigator 1.2.1.dev313+g63df3e8
$ cbi-cov --version
CBI Coverage Tool 1.2.1.dev313+g63df3e8
$ cbi-tree --version
CBI Tree Tool 1.2.1.dev313+g63df3e8

Many other packages use this convention.

Signed-off-by: John Pennycook <[email protected]>
Copy-paste resulted in it identifying itself as cbi-cov.

Signed-off-by: John Pennycook <[email protected]>
@Pennycook Pennycook added the enhancement New feature or request label Apr 4, 2025
@Pennycook Pennycook added this to the 2.0.0 milestone Apr 4, 2025
@Pennycook Pennycook requested a review from laserkelvin April 4, 2025 08:51
@Pennycook
Copy link
Contributor Author

Failing coverage tests are just for checking the debug string, and I'm not sure we can really test that meaningfully.

Copy link
Contributor

@laserkelvin laserkelvin left a comment

Choose a reason for hiding this comment

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

Still shocked it was straightforward!

@Pennycook Pennycook merged commit 32029a6 into intel:main Apr 7, 2025
3 of 4 checks passed
@Pennycook Pennycook deleted the feature/dynamic-version branch April 7, 2025 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants