Skip to content

Compute version witch hatch-vcs#2080

Open
pquentin wants to merge 13 commits into
elastic:masterfrom
pquentin:hatch-vcs
Open

Compute version witch hatch-vcs#2080
pquentin wants to merge 13 commits into
elastic:masterfrom
pquentin:hatch-vcs

Conversation

@pquentin

Copy link
Copy Markdown
Member

Now that we publish to Test PyPI on every commit, we need a new version for each commit. Otherwise, publishing will fail every time, and we won't be told if the publishing pipeline is working or not.

This also means that Rally needs to be "installed" to be used, as this is when the version file is created. The developing Rally instructions don't need to change, as this is the default behavior of uv sync.

Comment thread pyproject.toml
Comment on lines 5 to +10
[tool.hatch.version]
path = "esrally/_version.py"
source = "vcs"
[tool.hatch.version.raw-options]
local_scheme = "no-local-version"
[tool.hatch.build.hooks.vcs]
version-file = "esrally/_version.py"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This instructs hatch and hatch-vcs to create the esrally/_version.py file, using numbers like devN instead of the git hash, as this is the only format that PyPI supports.

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.

Add it as a comment. It will help in the future.

@pquentin pquentin changed the title Switch to hatch-vcs to compute version Compute version witch hatch-vcs Mar 30, 2026
@pquentin

pquentin commented Mar 30, 2026

Copy link
Copy Markdown
Member Author

The rally-tracks-compat failure where Rally cannot read its own version:

Stack trace
2026-03-30 11:11:10,787 -not-actor-/PID:2603 esrally.track.loader ERROR Could not register track plugin at [['/home/runner/.rally/benchmarks/tracks/rally-tracks-compat/http_logs']]
Traceback (most recent call last):
  File "/home/runner/work/rally/rally/esrally/track/loader.py", line 1288, in load
    module.register(self)
    ~~~~~~~~~~~~~~~^^^^^^
  File "/home/runner/.rally/benchmarks/tracks/rally-tracks-compat/http_logs/track.py", line 55, in register
    async_runner = registry.meta_data.get("async_runner", False)
                   ^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/rally/rally/esrally/track/loader.py", line 1312, in meta_data
    "rally_version": version.release_version(),
                     ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/runner/work/rally/rally/esrally/version.py", line 62, in release_version
    return int(matches.group(1)), int(matches.group(2)), int(matches.group(3)), matches.group(4)
                                                         ~~~^^^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
2026-03-30 11:11:10,789 -not-actor-/PID:2603 esrally.track.loader ERROR Cannot load track [http_logs]
Traceback (most recent call last):
  File "/home/runner/work/rally/rally/esrally/track/loader.py", line 1288, in load
    module.register(self)
    ~~~~~~~~~~~~~~~^^^^^^
  File "/home/runner/.rally/benchmarks/tracks/rally-tracks-compat/http_logs/track.py", line 55, in register
    async_runner = registry.meta_data.get("async_runner", False)
                   ^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/rally/rally/esrally/track/loader.py", line 1312, in meta_data
    "rally_version": version.release_version(),
                     ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/runner/work/rally/rally/esrally/version.py", line 62, in release_version
    return int(matches.group(1)), int(matches.group(2)), int(matches.group(3)), matches.group(4)
                                                         ~~~^^^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/work/rally/rally/esrally/track/loader.py", line 279, in _load_single_track
    has_plugins = load_track_plugins(cfg, track_name, register_track_processor=tpr.register_track_processor)
  File "/home/runner/work/rally/rally/esrally/track/loader.py", line 320, in load_track_plugins
    plugin_reader.load()
    ~~~~~~~~~~~~~~~~~~^^
  File "/home/runner/work/rally/rally/esrally/track/loader.py", line 1292, in load
    raise exceptions.SystemSetupError(msg)
esrally.exceptions.SystemSetupError: Could not register track plugin at [['/home/runner/.rally/benchmarks/tracks/rally-tracks-compat/http_logs']]
2026-03-30 11:11:10,790 -not-actor-/PID:2603 esrally.rally ERROR Cannot run subcommand [list].
Traceback (most recent call last):
  File "/home/runner/work/rally/rally/esrally/track/loader.py", line 1288, in load
    module.register(self)
    ~~~~~~~~~~~~~~~^^^^^^
  File "/home/runner/.rally/benchmarks/tracks/rally-tracks-compat/http_logs/track.py", line 55, in register
    async_runner = registry.meta_data.get("async_runner", False)
                   ^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/rally/rally/esrally/track/loader.py", line 1312, in meta_data
    "rally_version": version.release_version(),
                     ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/runner/work/rally/rally/esrally/version.py", line 62, in release_version
    return int(matches.group(1)), int(matches.group(2)), int(matches.group(3)), matches.group(4)
                                                         ~~~^^^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/work/rally/rally/esrally/rally.py", line 1183, in dispatch_sub_command
    dispatch_list(cfg)
    ~~~~~~~~~~~~~^^^^^
  File "/home/runner/work/rally/rally/esrally/rally.py", line 933, in dispatch_list
    track.list_tracks(cfg)
    ~~~~~~~~~~~~~~~~~^^^^^
  File "/home/runner/work/rally/rally/esrally/track/loader.py", line 151, in list_tracks
    available_tracks = tracks(cfg)
  File "/home/runner/work/rally/rally/esrally/track/loader.py", line 147, in tracks
    return [_load_single_track(cfg, repo, track_name) for track_name in repo.track_names]
            ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/rally/rally/esrally/track/loader.py", line 279, in _load_single_track
    has_plugins = load_track_plugins(cfg, track_name, register_track_processor=tpr.register_track_processor)
  File "/home/runner/work/rally/rally/esrally/track/loader.py", line 320, in load_track_plugins
    plugin_reader.load()
    ~~~~~~~~~~~~~~~~~~^^
  File "/home/runner/work/rally/rally/esrally/track/loader.py", line 1292, in load
    raise exceptions.SystemSetupError(msg)
esrally.exceptions.SystemSetupError: Could not register track plugin at [['/home/runner/.rally/benchmarks/tracks/rally-tracks-compat/http_logs']]

@pquentin

pquentin commented Mar 30, 2026

Copy link
Copy Markdown
Member Author

The new error is that the version is set to Rally version [0.1.dev1 (git revision: be7fb25819f4172de4268e890192f89d8488f8fd)]. Missing git info, probably.

@pquentin pquentin requested a review from a team March 31, 2026 11:21
fressi-elastic
fressi-elastic previously approved these changes Mar 31, 2026

@fressi-elastic fressi-elastic 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.

Thank you so much for this!

It would very nice having more comments in the code to explain a bit what is happening. Please make sure this works after typing make install or after installing it using pip.

@fressi-elastic fressi-elastic 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.

Please rebase on top of master branch.

@gbanasiak gbanasiak 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.

Cosmetic question:

% esrally --version      
esrally 2.13.1.dev7 (git revision: df58675e2121872efc21e6191a97df153fc3ce42)

How is this version calculated? Is this the version from the last tag auto-incremented + devN where N is the commit number from the tag? Historically, we went for <last-version>.dev format because we didn't know what will be the next version. Could we replicate "last version" logic with hatch-vcs?

Comment thread .gitignore Outdated
Comment thread docker/Dockerfiles/dev/Dockerfile
@pquentin pquentin requested a review from gbanasiak April 3, 2026 11:26
Comment thread build-dev-docker.sh
Comment on lines -61 to +62
export RALLY_VERSION="${branch_name}-${GIT_SHA}-${DATE}-${ARCH}"
export RALLY_VERSION_TAG="${RALLY_VERSION}"
export RALLY_VERSION=$(hatch version)
export RALLY_VERSION_TAG="${branch_name}-${GIT_SHA}-${DATE}-${ARCH}"

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.

RALLY_VERSION_TAG is not used properly in the rest of the script. It was a trap waiting for you :) Can you fix this?

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.

The build-dev-docker-manifest.sh script also needs a fix.

@pquentin pquentin dismissed fressi-elastic’s stale review April 7, 2026 07:17

Grzegorz pointed an issue with the Docker build.

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.

3 participants