Skip to content

1.5.0-rc3 fails when parsing local identifiers starting with digits followed by non digits #3030

@philsc

Description

@philsc

🐞 bug report

Affected Rule

The issue is caused by the rule: py_library. Bazel errors out pretty early in the build process.

Error in fail: Failed to parse PEP 440 version identifier '0.1.0+brt.9e26ab0fd97503827d5b406699d5290c29c430c5'. Parse error at 'e26ab0fd97503827d5b406699d5290c29c430c5' 

Is this a regression?

The 1.3.0 version we're currently using does not throw this error.

Description

We have a custom version of the lerobot package with identifier 0.1.0+brt.9e26ab0fd97503827d5b406699d5290c29c430c5.

AFAICT this should be fine under PEP 440:

Local version identifiers MUST comply with the following scheme:
<public version identifier>[+<local version label>]

where

local version labels MUST be limited to the following set of permitted characters:

  • ASCII letters ([a-zA-Z])
  • ASCII digits ([0-9])
  • periods (.)

It looks to me like we are following that.

🔬 Minimal Reproduction

I don't have a public wheel with a local identifier to show you, unfortunately.

🔥 Exception or Error

 ERROR: /var/lib/buildkite-agent/builds/shasta-ci-blue-i-05dc558a48121b7cf-1/blue-river-technology/k8_output_base/external/my_deps_3_10_lerobot/BUILD.bazel:5:20: in py_library rule @@my_deps_3_10_lerobot//:pkg: [2025-06-25T21:43:20Z] Traceback (most recent call last): [2025-06-25T21:43:20Z]	File "/var/lib/buildkite-agent/builds/shasta-ci-blue-i-05dc558a48121b7cf-1/blue-river-technology/k8_output_base/external/rules_python/python/private/py_library.bzl", line 114, column 27, in _py_library_impl_with_semantics [2025-06-25T21:43:20Z]	return py_library_impl( [2025-06-25T21:43:20Z]	File "/var/lib/buildkite-agent/builds/shasta-ci-blue-i-05dc558a48121b7cf-1/blue-river-technology/k8_output_base/external/rules_python/python/private/py_library.bzl", line 164, column 52, in py_library_impl [2025-06-25T21:43:20Z]	package, version_str = _get_package_and_version(ctx) [2025-06-25T21:43:20Z]	File "/var/lib/buildkite-agent/builds/shasta-ci-blue-i-05dc558a48121b7cf-1/blue-river-technology/k8_output_base/external/rules_python/python/private/py_library.bzl", line 241, column 26, in _get_package_and_version [2025-06-25T21:43:20Z]	version.normalize(version_str), # will have no dashes either [2025-06-25T21:43:20Z]	File "/var/lib/buildkite-agent/builds/shasta-ci-blue-i-05dc558a48121b7cf-1/blue-river-technology/k8_output_base/external/rules_python/python/private/version.bzl", line 511, column 18, in normalize_pep440 [2025-06-25T21:43:20Z]	return _parse(version, strict = True)["norm"] [2025-06-25T21:43:20Z]	File "/var/lib/buildkite-agent/builds/shasta-ci-blue-i-05dc558a48121b7cf-1/blue-river-technology/k8_output_base/external/rules_python/python/private/version.bzl", line 548, column 18, in _parse [2025-06-25T21:43:20Z]	_fail( [2025-06-25T21:43:20Z] Error in fail: Failed to parse PEP 440 version identifier '0.1.0+brt.9e26ab0fd97503827d5b406699d5290c29c430c5'. Parse error at 'e26ab0fd97503827d5b406699d5290c29c430c5' 

🌍 Your Environment

Operating System:

  Ubuntu 22.04  

Output of bazel version:

  $ bazel version Bazelisk version: development Build label: 7.2.0 Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer Build time: Mon Jun 10 13:04:32 2024 (1718024672) Build timestamp: 1718024672 Build timestamp as int: 1718024672  

Rules_python version:

  1.5.0-rc3  

Anything else relevant?

Not that I can think of.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions