Open jwodder opened 11 months ago
Hmm, That's interesting, thank you for the context, I haven't done python in quite a while.
I have been working on a rework which allows easier use of more complicated project detection logic so this is a great example of what it would need to support.
It appears that kondo (as of commit 69c153b) detects Python projects by looking for a file with a
.py
extension, at which point the directory in which this file is located is taken as the project root. However, this easily results in false negatives for modern Python packages, in which directories that need cleaning can be located above the directory of.py
files.Note the following about Python projects:
setup.py
file (historical and now somewhat discouraged, but there's a lot of history),setup.cfg
(declarative form ofsetup.py
that was recommended for a while), and/orpyproject.toml
file (new standard) in the project root.setup.py
/setup.cfg
/pyproject.toml
. If all are absent, the most reliable marker for a project root is probably arequirements.txt
file, but this is purely conventional.tox.ini
ornoxfile.py
..py
files tend to be organized under a directory with the same or similar name to that of the project. This directory is either located in the project root or nested inside asrc/
directory in the project root (though, in the latter case, I'd expect such projects to also be the kind to have asetup.py
,setup.cfg
, orpyproject.toml
file)..py
files to be located inside one or more levels of otherwise-empty non-src/
directories, though I think it'd be highly unusual to do this if you weren't planning on distributing the project.