Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Requirements parsing (pip.parse) does not work with experimental_index_url after 1.4.0 upgradeΒ #2863

Closed
@al-babych-fivetran

Description

@al-babych-fivetran

🐞 bug report

Affected Rule

The issue is caused by the rule: pip.parse

Is this a regression?

Yes, the previous version in which this bug was not present was: 1.3.0

Description

After upgrade to 1.4.0 we get an error on pip.parse:
Error: 'struct' value has no field or method 'sha256s_by_version'

965dd51 looks related

πŸ”¬ Minimal Reproduction

...
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
    experimental_index_url = "http://some-proxy-url/pypi/simple", # have to be set
    hub_name = "hub",
    python_version = "3.10.8",
    requirements_lock = "//:requirements.txt",
)
...

Run bazel mod deps --lockfile_mode=update

πŸ”₯ Exception or Error



```
File "/private/var/tmp/_bazel_roman.vlasenko/7eb23c38ebf1165e125a92c28d7d5daa/external/rules_python+/python/private/pypi/parse_requirements.bzl", line 321, column 33, in _add_dists
                shas_to_use = index_urls.sha256s_by_version.get(version, [])
Error: 'struct' value has no field or method 'sha256s_by_version'
Available attributes: sdists, sha256_by_version, whls
ERROR: error evaluating module extension @@rules_python+//python/extensions:pip.bzl%pip
```

🌍 Your Environment

Operating System:

  
24.4.0 Darwin Kernel Version 24.4.0: Wed Mar 19 21:17:35 PDT 2025; root:xnu-11417.101.15~1/RELEASE_ARM64_T6041 arm64
  

Output of bazel version:

  
Bazelisk version: 1.25.0
Build label: 8.1.1
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Tue Feb 25 18:53:44 2025 (1740509624)
Build timestamp: 1740509624
Build timestamp as int: 1740509624
  

Rules_python version:

  
1.4.0
  

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: pippip/pypi integration

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions