Not possible to build and install mypy with mypyc support, and run the tests against it.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
mypy's built wheels includes two installable packages available after mypy is fully installed. They appear to not be practically usable:
import mypy.testimport 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...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading .github/workflows/test.yml around the editable-install workaround, then inspect conftest.py, pyproject.toml, and test-data/. Determine how the built wheel and source tree expose mypy.test and mypyc.test. Done means the test suite can exercise compiled extensions through an installed build without shipping unusable test packages or required test data in the wheel.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system, devtools, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100