Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Starting from version 2.0.0 is no longer allowed to have a package called lib in the root

Offen
#3,784 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
55/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Ruhig
Tech-Stack
python
Bereich
build-system

Rechercherichtung

Beginne mit der verknüpften minimalen Reproduktion, insbesondere mit bin.py und lib.py, unter Verwendung von rules_python 2.0.0 oder 2.0.1 und dem gemeldeten Windows-Bazel-Setup. Verfolge, wie py_binary und py_library den Runfiles-Importpfad erstellen, füge anschließend einen Regressionstest hinzu, der einen Import des Root-lib.py abdeckt, und bestätige, dass das Beispiel lib nicht mehr zum Paket der generierten Umgebung auflöst.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

🐞 bug report

Affected Rule

py_binary + py_library

Is this a regression?

Yes, it started with 2.0.0, before that the problem was not there

Description

It is no longer possible to have a lib.py in the root and import it.
It seems that this colides now with some lib that is in the path. This was before not the case.
Considering that lib is not a Python library, I would not have expected having any colision.

🔬 Minimal Reproduction

You can grab this example and upgrade to rules_python 2.0.0
https://github.com/limdor/bazel-examples/tree/v1.8.0/python

🔥 Exception or Error

Traceback (most recent call last):
  File "c:\b\t45fapsg\execroot\_main\bazel-out\x64_windows-fastbuild-st-591ff087943d\bin\bin.exe.runfiles\_main\_bin_stage2_bootstrap.py", line 541, in <module>
    main()
  File "c:\b\t45fapsg\execroot\_main\bazel-out\x64_windows-fastbuild-st-591ff087943d\bin\bin.exe.runfiles\_main\_bin_stage2_bootstrap.py", line 535, in main
    _run_py_path(main_filename, args=sys.argv[1:])
  File "c:\b\t45fapsg\execroot\_main\bazel-out\x64_windows-fastbuild-st-591ff087943d\bin\bin.exe.runfiles\_main\_bin_stage2_bootstrap.py", line 323, in _run_py_path
    runpy.run_path(main_filename, run_name="__main__")
  File "<frozen runpy>", line 291, in run_path
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "c:\b\t45fapsg\execroot\_main\bazel-out\x64_windows-fastbuild-st-591ff087943d\bin\bin.exe.runfiles\_main\bin.py", line 1, in <module>
    from lib import sum
ImportError: cannot import name 'sum' from 'lib' (C:\temp\bazel._bin.venv.l8l95vit\lib\__init__.py)
bazel run failed with exit code 1

🌍 Your Environment

Operating System:

Windows

Output of bazel version:

8.7.0

Rules_python version:

2.0.0 as well as 2.0.1

Anything else relevant?

That is not a big issue for me, I workaround the problem my renaming lib.py to my_lib.py. However the bigger question would be what are the names that can have problems and the ones that not? I could have imagine names from the Python standard library to have problems with it but afaik lib is not one of them.

Vorherrschende Sprache
Starlark
Sterne
687
Forks
726
Ø Merge
1 T. 6 Std.
Gemergte PRs (30 T.)
83

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus bazel-contrib/rules_python

Alle Issues in bazel-contrib/rules_python

Ähnliche Issues

Weitere Issues zu Build System

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.