python / python/mypy

Not possible to build and install mypy with mypyc support, and run the tests against it.

Offen
#16,143 3 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug
Vorherrschende Sprache
Python
Sterne
20.6k
Forks
3.3k
Ø Merge
1 T. 18 Std.
Gemergte PRs (30 T.)
54

Beschreibung

mypy's built wheels includes two installable packages available after mypy is fully installed. They appear to not be practically usable:

  • import mypy.test
  • import mypyc.test

The testsuite depends on conftest.py and pyproject.toml from the root of the repository to run. Also, the test-data/ directory provides data the tests need. None of this data is distributed in the built wheels.

The fact that the packages are installed at all appears to be a bug. This is a side effect of #2784 which requested that the sdist (not the wheel) include the testsuite so that redistributors such as Debian can run the tests when packaging.

The intertwining of the testsuite as part of the mypy module alongside the requirement to use data from the sources makes it difficult to test mypy correctly. Allowing the tests to be detected by pytest means making the mypy/ directory importable and causes the tests to incorrectly run against the pure-python version, which means the compiled extensions do not get tested.

And mypy's own CI is working around this with editable installs: https://github.com/python/mypy/blob/9b9152484c6b1ba3934373ca0c7600f71392fb06/.github/workflows/test.yml#L137-L145

Also, the installation footprint of these unused files seems to be a couple of MB, which could be a nice optimization...

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Lies zunächst .github/workflows/test.yml rund um die Problemumgehung für die Editable-Installation und untersuche anschließend conftest.py, pyproject.toml und test-data/. Ermittle, wie das erstellte Wheel und der Quellbaum mypy.test und mypyc.test bereitstellen. Erledigt ist die Aufgabe, wenn die Testsuite kompilierte Erweiterungen über einen installierten Build ausführen kann, ohne unbrauchbare Testpakete oder erforderliche Testdaten im Wheel mitzuliefern.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
build-system, devtools, testing-qa
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

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