Repository navigation
fix(source-tree): report only runtime third-party imports - #36
Merged
Merged
Conversation
The import scan of a PyPI source tree turned every import it saw into
an undeclared-import judgment residual: standard-library modules,
imports in tests/, docs/conf.py, dev/ scripts and setup.py, and words
from docstring prose ("from the fastnumbers module" became an import
of `the`). The duplicate check compared by substring, so `re` was
dropped because "undeclared" contains it, and `requests` was dropped
after `requests_cache`. natsort 8.4.0 got 29 residuals, three of them
real.
Standard-library names come from data/python-stdlib.txt, the union of
sys.stdlib_module_names of the Pythons EESSI ships, and the packages
the Python module installs itself are skipped as they are for build
requirements. Test directories, top-level docs, examples, benchmarks
and dev directories, conftest.py and noxfile.py are not scanned;
setup.py still is, so a build import such as Cython is reported. Only
import statements outside triple-quoted strings count, duplicates
compare by exact name, and the walk is sorted so the evidence path is
stable. natsort now gets fastnumbers, icu and typing_extensions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The import scan of a PyPI source tree reports only runtime third-party imports.
tests/,docs/conf.py,dev/scripts andsetup.py, and words from docstring prose ("from the fastnumbers module" became an import ofthe). The duplicate check compared by substring, sorewas dropped because "undeclared" contains it, andrequestswas dropped afterrequests_cache. natsort 8.4.0 got 29 residuals, 3 of them real.data/python-stdlib.txt, the union ofsys.stdlib_module_namesof the Pythons EESSI ships. Packages the Python module installs itself stay off the residual list, as they do for build requirements. The scan covers the package sources andsetup.py, so a build import such as Cython is reported. It leaves out test directories, top-level docs, examples, benchmarks and dev directories,conftest.pyandnoxfile.py. Only import statements outside triple-quoted strings count, duplicates compare by exact name, and the walk is sorted so the evidence path is stable. natsort now getsfastnumbers,icuandtyping_extensions.standard_library_imports_are_not_residuals,test_doc_and_maintainer_imports_are_not_residuals,docstring_prose_is_not_an_importanda_name_inside_a_reported_name_is_still_reportedcover those. The commit has a towncrier fragment. Main has no towncrier yet; #26 (fix/towncrier) adds it.