python / python/mypy

Add test that prevents increasing import cycles in the mypy implementation

Open
#7,407 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority-1-normal topic-developer topic-tests
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

It's easy to accidentally introduce new modules in import cycles, which can make the structure of the codebase worse and slow down incremental builds. Add a test that checks that this does not happen.

See #7397 for context. Here is one idea from that PR:

We could perhaps run another incremental build after self check in verbose mode and assert that the largest import cycle is below some size limit by parsing the verbose output. Alternatively, we could modify verbose mode to write more details about SCCs in incremental mode and make more specific assertions, such as requiring that the nodes, typeops and checker cycles are disjoint.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the context in #7397 and tracing the incremental build, self check, and verbose mode entry points. Determine which proposed assertion is practical, then add a regression test that detects increased import-cycle size or verifies the relevant SCC constraints; done means the test fails when cycles worsen and passes on the current implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, compilers, testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.