Aspect_Rules_Py issue

Ouverte
#888 6 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
35/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
python

Piste de recherche

Start by reviewing the listed options, then inspect src/tests/conftest.py and .bazelrc and trace how score_tools and aspect_rules_py are configured in score_tools and docs-as-code. Run the referenced tests and verify the selected approach removes the Python environment leak, resolves the score_tools version issue, and leaves the affected CI and Bazel workflows passing.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

aspect_rules_py leaks PYTHONEXECUTABLE, which breaks our CI

Decision needed: pick a fix from Options. Recommended: option 1.

Problem

  • score_tools requires aspect_rules_py 1.6.3 or newer. main uses 1.4.0.
  • 1.6.3: bazel run //:ide_support fails with Permission denied (a copy bug).
  • 1.6.4 and later (we're on 1.6.6): the venv's Python (.venv_docs/bin/python) exports PYTHONEXECUTABLE and PYTHONHOME.
  • Our tests start Bazel from that Python. Every Python that Bazel starts inherits the variables and crashes with No module named 'encodings'.
  • No release fixes the copy bug without the leak. The latest release (1.12.1) still leaks.
.venv_docs/bin/python -m pytest   # sets PYTHONEXECUTABLE
└── bazel build / bazel run       # inherits it
    └── any other Python          # looks for its standard library in the wrong place → crash

Cause: upstream rules_py#629 now sets PYTHONEXECUTABLE on every platform. It used to be macOS only.

Options

# Fix Covers Misses Tested
1 Set aspect_rules_py to 1.4.0 in score_tools and docs-as-code Everything: removes the cause Stuck on 1.4.0 until upstream fixes it Partly: the failing CI test passes; full suite not run
2 src/tests/conftest.py removes the variables All tests in src/tests Terminals, basedpyright output Yes: 38 of 42 pass (the other 4 fail on the score_tools version issue below)
3 .bazelrc sets the variables to empty Every Bazel call in this repo, including terminals downstream_compatibility tests, basedpyright output Yes
4 Fix it upstream in aspect_rules_py Everyone, long term Nothing today: needs a release No

Options 2 and 3 can be combined.

Option 2 (src/tests/conftest.py):

import os

def pytest_configure() -> None:
    for var in ("PYTHONEXECUTABLE", "PYTHONHOME", "VIRTUAL_ENV"):
        os.environ.pop(var, None)

Option 3 (.bazelrc; Python treats an empty value as unset):

common --repo_env=PYTHONEXECUTABLE= --repo_env=PYTHONHOME=
run --run_env=PYTHONEXECUTABLE= --run_env=PYTHONHOME=

Also blocking: the score_tools version

  • docs-as-code pulls in score_tools with git_override. Bazel ignores overrides unless the module is the root module, so every project that uses docs-as-code fails with: bad bazel_dep on module 'score_tools' with no version.
  • The registry only has score_tools 0.0.2, which doesn't contain score_pytest.
  • Fix: release score_tools 0.0.3 (the same code as main), then use bazel_dep(name = "score_tools", version = "0.0.3").

Next steps (option 1)

  1. In score_tools, set aspect_rules_py to 1.4.0 and run its tests. cr_checker and repo_cache haven't been tested on 1.4.0.
  2. Release score_tools 0.0.3.
  3. In docs-as-code, use score_tools 0.0.3 and aspect_rules_py 1.4.0. Delete .venv_docs once, because 1.4.0 creates a directory where 1.6.x creates a symlink.
  4. Open an aspect_rules_py issue about the leak (option 4).

Links

Langage dominant
Python
Étoiles
11
Forks
39
Merge moyen
1 j 13 h
PR mergées (30 j)
65

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

  • Aucun Dockerfile ni fichier Docker Compose
  • Propose un modèle de pull request
  • Aucun guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de eclipse-score/docs-as-code

Toutes les issues de eclipse-score/docs-as-code

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.