Skip to content

Version the package from VERSION and bump it on merge to main - #273

Draft
razvcris wants to merge 2 commits into
mlcommons:mainfrom
Keysight:feat/issue-232-proper-versioning
Draft

razvcris wants to merge 2 commits into
mlcommons:mainfrom
Keysight:feat/issue-232-proper-versioning

Conversation

@razvcris

@razvcris razvcris commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The version was hard-coded as 1.0.0, which PyPI already has. It now lives in VERSION and goes up by itself
after each merge to main. Publishing to PyPI is not in this PR.

Changes

  • VERSION (1.0.1) is the only place that holds the version. pyproject.toml reads it.

  • chakra.__version__ comes from the installed metadata. For that, chakra becomes a regular package
    (src/chakra_pkg/__init__.py). The default editable install cannot find chakra.src.* under a regular package,
    so [tool.uv] sets editable_mode = "strict". When the package is not installed, __version__ is 0+unknown.

  • cache-keys in [tool.uv] also lists src/**/*.py and VERSION, so a new module is linked into the strict
    editable tree and a version change rebuilds the package.

  • .github/workflows/version_bump.yml runs on every push to main. The reference is the
    highest VERSION that main has held before its tip:

    • a VERSION above it was set by a maintainer (a minor or major step) and stays as it is;
    • otherwise the patch number of that highest value goes up by one, in a commit pushed to main.

    Contributors work on forks, where a bot cannot push to the branch, so the bump happens after the merge.

  • scripts/wheel_check.sh also checks that the wheel METADATA version and chakra.__version__ equal VERSION.
    Every Python call in it now runs with -I, so a stale *.egg-info in the repository root cannot win over the
    wheel that is being checked.

  • tests/test_tooling.py runs the editable install with cwd set to the repository root, because uv pip takes
    editable_mode from the pyproject.toml of the working directory.

Needed from an admin

The bump commit goes straight to main: add a VERSION_BUMP_TOKEN secret (GitHub App or PAT with
contents: write) and let it bypass the pull request rule. Without it the workflow fails.

Testing

  • just gate: passes (ruff, vulture, shellcheck, pyright, 183 tests, slow tests, proto smoke, wheel check).
  • The steps of python_tests.yml, end_to_end_tests.yml and check_clean_install.sh pass in a clean
    environment, on Python 3.11 to 3.14. chakra.__version__ is 1.0.1 on all four.
  • version_bump.yml passes actionlint, and a simulation on a local remote (34 checks). It has not run on
    GitHub.

Closes #232

@razvcris razvcris self-assigned this Nov 18, 2026
@github-actions

Copy link
Copy Markdown

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@theodorbadea theodorbadea left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Right now this PR is a mix of both VERSION and Tags and stores the version in two places. Perhaps the issue description and our later discussion may have been confusing. So maybe we should answer to the question Tags or VERSION?

Comment thread .github/workflows/version_bump.yml Outdated
# waiting. Merges that land close together can therefore share one version. No change is lost: a tag always holds
# everything that was in main when it was made.
#
# The newest tag vX.Y.Z is the reference, not the content of VERSION, so a stale VERSION (for example the wrong side of

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do not think a merge conflict should ever be possible on the VERSION. Probably the only scenario would be if you try to merge a PR which is based on an outdated hashcommit of main.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree: let's use tags with setuptools-scm. I said VERSION was ok in #232, but this PR shows that it costs more than I expected.

@mlcommons-cla-bot

Copy link
Copy Markdown

MLCommons CLA bot: All contributors are covered by the MLCommons CLA ✍️ ✅

@razvcris
razvcris force-pushed the feat/issue-232-proper-versioning branch from 7992a6a to a545985 Compare November 24, 2026 10:50
#
# The bump commit goes straight to main, which needs a token that may bypass the rule that asks for pull requests.
# Add a repository secret VERSION_BUMP_TOKEN (a GitHub App token or a PAT with contents:write) and let it bypass.
# With the default GITHUB_TOKEN the push is refused while main is protected.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These 3 lines could be replaced by "The bump commit goes straight to main, so uses VERSION_BUMP_TOKEN to bypass the rule asking for pull requests.". Most of their content right now is the LLM giving guidelines about how to set up the bump workflow and should not end up as code comment.

Comment thread pyproject.toml
[tool.uv]
default-groups = ["dev"]
# Rebuild the package, and so the generated *_pb2.py files, when a .proto file changes. The default keys miss it.
# chakra is a real package (it holds __version__), and the default editable finder cannot resolve chakra.src.* under it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This "chakra is a real package" phrasing is strange.

Comment thread pyproject.toml
# chakra is a real package (it holds __version__), and the default editable finder cannot resolve chakra.src.* under it.
# strict links the files into a tree that has the same layout as the wheel.
config-settings = { editable_mode = "strict" }
# Rebuild the package, and so the generated *_pb2.py files, when a .proto file changes, and so that a new module is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

these will probably require a careful rebasing after the proto PR#282.

group: version-bump
cancel-in-progress: false

jobs:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this job should run only in this repo, not in the forks so probably needs something like if: github.repository == 'mlcommons/chakra'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

otherwise forks syncing will become merges isntead of fast forwards i think

@theodorbadea theodorbadea left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My vote still goes for tags and labels for minor and major bumps.

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.

Proper versioning

3 participants