Skip to content

refactor: remove version.bzl - #4566

Open
aignas wants to merge 10 commits into
refactor.aignas.pypackaging-09-py-wheelfrom
refactor.aignas.pypackaging-10-remove-version
Open

aignas wants to merge 10 commits into
refactor.aignas.pypackaging-09-py-wheelfrom
refactor.aignas.pypackaging-10-remove-version

Conversation

@aignas

@aignas aignas commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

All of the users have been migrated to pypackaging.bzl or no longer
need to parse the versions (#4569), so the hand written PEP 440
implementation and its tests can be removed.

Summary by CodeRabbit

  • Removals
    • Removed version parsing, normalization, and comparison functionality.
    • Removed the associated version test suite.

All of the users have been migrated to `pypackaging.bzl`, so the hand
written PEP 440 implementation and its tests can be removed.
@aignas

aignas commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator Author

This PR was prepared by an AI agent (Claude Code) on behalf of @aignas. The agent replies to the review comments and pushes the fixes, @aignas supervises it and reviews the changes.

This is an agent-generated comment unreviewed by the user.

Bazel 8 autoloads the Python rules and providers from `rules_python` and
the files that it loads for that can only load `.bzl` files from a fixed
list of repositories, otherwise the build fails with `Cycle caused by
autoloads`. This means that `py_library.bzl` and `py_runtime_rule.bzl`
cannot use a version parser from a different repository, e.g.
`pypackaging.bzl`, and they are the reason why `version.bzl` cannot be
replaced with it.

Neither of them needs a full PEP 440 parser:

- `py_runtime` only needs the release numbers from the value of the
  `python_version` flag.
- `py_library` only compares the versions of the same distribution for
  equality, so it now uses the version as it is spelled in the name of
  the `.dist-info` directory, which the installers already normalize.

Add a test that checks that the autoloaded files only load from the
repositories that Bazel allows.
@aignas
aignas added this pull request to stack #4570 November 22, 2026 04:18
@aignas
aignas marked this pull request as ready for review November 22, 2026 08:41
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: Version module removal

Layer / File(s) Summary
Remove version module and tests
python/private/version.bzl, python/private/BUILD.bazel, tests/version/BUILD.bazel, tests/version/version_test.bzl
The PEP 440 parser, normalization and comparison APIs, Bazel declarations, and associated tests were removed.

Possibly related PRs

Suggested reviewers: rickeylev, vonschultz

Change: Refactor

Merge Risk: Minimal · up to a14dd

This change removes the unused private PEP 440 parser and its tests. No remaining references to the deleted module were found, so merge risk is minimal.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 557ca7cd-348b-4067-9870-9f0c208bcae0
Commits

Reviewing files that changed from the base of the PR and between d21ce46 and a14ddbb.

Files selected for processing: 4

  • python/private/BUILD.bazel
  • python/private/version.bzl
  • tests/version/BUILD.bazel
  • tests/version/version_test.bzl
Files with no reviewable changes: 4

  • python/private/BUILD.bazel
  • python/private/version.bzl
  • tests/version/BUILD.bazel
  • tests/version/version_test.bzl

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

This branch has not been deployed

No deployments
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.

2 participants