Ignore CWD for explicit package bases
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Feature
Add an option (name TBD) to ignore the current directory when looking for namespace package bases.
As far as I can tell, the behavior would have to be modified here (optionally leaving out [os.getcwd()]: https://github.com/python/mypy/blob/695ea3017fee084c9d2ec17d9b28f8af905e3b63/mypy/find_sources.py#L87
Pitch
When type-checking a repository with src/ structure, there can be conflicts between installed Python modules, and directories which are located at the root of the repository (assuming that is the CWD for running mypy).
I stumbled upon this by having a directory called docker/, while also having https://pypi.org/project/docker/ installed.
As far as I could tell, there's currently no satisfactory way for mypy to accept this, besides renaming the directory.
Happy to take a stab at implementing this, if you feel it's worth adding.
Related discussion: #8584
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne in mypy/find_sources.py etwa bei Zeile 87, wo das aktuelle Verzeichnis beim Finden von namespace package bases derzeit einbezogen wird. Lies die zugehörige Diskussion #8584, bevor du entscheidest, wie die neue Option benannt und abgegrenzt werden sollte. Als erledigt gilt, dass eine explizite package-base-Konfiguration das aktuelle Verzeichnis ignorieren kann, ohne das beabsichtigte Verhalten bei der Quellenerkennung zu verlieren.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100