Skip to content

Compute version witch hatch-vcs#2080

Open
pquentin wants to merge 6 commits intoelastic:masterfrom
pquentin:hatch-vcs
Open

Compute version witch hatch-vcs#2080
pquentin wants to merge 6 commits intoelastic: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 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
Copy link
Copy Markdown
Member Author

pquentin commented Mar 30, 2026

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
Copy link
Copy Markdown
Member Author

pquentin commented Mar 30, 2026

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
Copy link
Copy Markdown
Contributor

@fressi-elastic fressi-elastic left a comment

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.

Copy link
Copy Markdown
Contributor

@fressi-elastic fressi-elastic left a comment

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.

Copy link
Copy Markdown
Contributor

@gbanasiak gbanasiak left a comment

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?

*.egg-info/
.installed.cfg
*.egg
esrally/_version.py # hatch-vcs
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.

There are no inline comments in .gitignore, please move the comment to the previous line.

# Wipe away any lingering caches, copied over from the local machine
RUN find /rally -name "__pycache__" -exec rm -rf -- \{\} \; 2>/dev/null || true
RUN find /rally -name ".pyc" -exec rm -rf -- \{\} \; 2>/dev/null || true
ENV SETUPTOOLS_SCM_PRETEND_VERSION=${RALLY_VERSION}
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.

In dev Docker scripts RALLY_VERSION has unexpected value, see this failure in a test build:

`vcs`: Invalid version: 'refs_pull_2080_head-df58675e-20260331-arm64'

export RALLY_VERSION="${branch_name}-${GIT_SHA}-${DATE}-${ARCH}"

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