bazelbuild / rules_python

Bazel Python Rules

Home Page:https://rules-python.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unclear upgrade path from 0.12.0 and local wheel files

nickbreen opened this issue Β· comments

🐞 bug report

Affected Rule

pip_install

Is this a regression?

Yes, 0.12.0 is the last version this worked with.

Description

The upgrade path (from <= 0.12.0) to the newer versions is unclear for local wheel files.

We check-in our wheels as our CI system is air-gapped.

I'd

πŸ”¬ Minimal Reproduction

https://github.com/nickbreen/bz-python-airgap

bazel run hello
DEBUG: /home/breenn/.cache/bazel/_bazel_breenn/164b3f13f6b18b01963cee71e5f49eaf/external/rules_python/python/repositories.bzl:8:10: py_repositories is a no-op and is deprecated. You can remove this from your WORKSPACE file
INFO: Analyzed target //:hello (10 packages loaded, 218 targets configured).
INFO: Found 1 target...
Target //:hello up-to-date:
  bazel-bin/hello
INFO: Elapsed time: 2.400s, Critical Path: 0.02s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/hello
URL: https://www.python.org/~guido?arg=1#frag```

Then, upgrade to a later vesion of rules_python, e.g. 0.19.0 (or anything later that 0.12.0)

#WORKSPACE.bazel
http_archive(
    name = "rules_python",
    sha256 = "ffc7b877c95413c82bfd5482c017edcf759a6250d8b24e82f41f3c8b8d9e287e",
    strip_prefix = "rules_python-0.19.0",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.19.0/rules_python-0.19.0.tar.gz",
)
bazel run hello

πŸ”₯ Exception or Error

Starting local Bazel server and connecting to it...
DEBUG: /home/breenn/.cache/bazel/_bazel_breenn/164b3f13f6b18b01963cee71e5f49eaf/external/rules_python/python/pip.bzl:47:10: pip_install is deprecated. Please switch to pip_parse. pip_install will be removed in a future release.
ERROR: /home/breenn/src/nickbreen/bz-python-airgap/BUILD.bazel:4:10: no such package '@lib_3rd-party-python_yarl//': The repository '@lib_3rd-party-python_yarl' could not be resolved: Repository '@lib_3rd-party-python_yarl' is not defined and referenced by '//:hello'
ERROR: Analysis of target '//:hello' failed; build aborted: Analysis failed
INFO: Elapsed time: 4.310s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (33 packages loaded, 125 targets configured\
)
ERROR: Build failed. Not running target

No other errors, expected to see errors processing the pip_install in WORKSPACE if there was a problem.

🌍 Your Environment

Operating System:

  
Fedora 36
  

Output of bazel version:

  
6.0.0 release
  

Rules_python version:

  
working from 0.6.0 to 0.12.0
regression from and 0.13.0 to 0.19.0
  

Anything else relevant?

I may have a path now, still testing it:

  1. use piprep to generate an index
  2. specify extra_pip_args = ["--no-deps", "--index-url", "file://%s/lib/3rd-party-python/simple" % __workspace_dir__],

Or simpler yet:

  1. specify extra_pip_args = ["--no-deps", "--no-index", "--find-links", "file://%s/lib/3rd-party-python" % __workspace_dir__]

It is still unclear how to get the same effect with bzlmod, --find-links appears to need an absolute path (or I cannot divine what form of relative path works).

(WARNING: Location 'lib' is ignored: it is either a non-existing path or lacks a specific scheme.

Variations on this error with various file: and ./lib kind of variations of --find-links's argument

An absolute directory works, but is useless in a MODULE.bazel file.

This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days.
Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_python!

This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"