As we're nearing the release of v1.0, here is an update with various quality-of-life improvements.
Suggesting package names for undeclared dependencies
When FawltyDeps finds a 3rd-party import
that is not declared, it will output that import name as an undeclared dependency. But as we've talked about before, import names in Python are not necessarily synonymous with the package names that you would have to declare in order to make those import names available.
For example, if you import sklearn
in your code, it might not be obvious that the corresponding dependency declaration should be scikit-learn
, and not sklearn
.
Starting with this version, if you run FawltyDeps with the --detailed
option, and if there happens to be one or more (undeclared) packages in your Python environment that provide the relevant import name, then FawltyDeps will suggest these packages as potential solutions to your undeclared dependency.
For the sklearn
/scikit-learn
example:
These imports appear to be undeclared dependencies:
- 'sklearn'
imported at:
some/file.py:123
may be provided by these packages:
'scikit-learn'
New option to control where FawltyDeps looks for 1st-party imports
By default (and before this release) FawltyDeps looks at the paths on the command-line to deduce where 1st-party imports (i.e. your project's own modules) can be found. In some corner cases this deduction fails, and the result is typically that a 1st-party import is flagged by FawltyDeps as an undeclared dependency.
The new --base-dir
allows you to control where FawltyDeps looks for 1st-party imports, and it can help fix those cases where the default deduction fails, for example in cases where you are passing individual file names (instead of directory names) on the FawltyDeps command line.
We have a new section in our FAQ to more precisely describe how the new option works, and when it's needed.
Thanks to our new co-maintainer @layus for suggesting and contributing both of the above improvements!
Otherwise
This release also includes various quality-of-life improvements for us maintainers, not necessarily user visible:
- We now have CodeQL and actionlint checks running in our CI pipeline, thanks to @smelc 🎉
- Improved documentation
- Various internal cleanups and modernizations
What's Changed
- Expand user defined mapping documentation. by @obscurerichard in #480
- Follow-up after removing support for Python v3.8 by @jherland in #475
- Work around top-level venv special case by @jherland in #468
- Upgrade project declarations in
pyproject.toml
by @jherland in #481 - Suggest package names for undeclared imports, when possible by @jherland in #470
- CI: call actionlint to check workflow files by @smelc in #485
- Add support for
*
-wildcards inignore-undeclared
andignore-unused
by @jherland in #479 - RFC/Follow-up to actionlint CI action by @jherland in #488
- Follow-up to #484: Add a --base-dir option by @jherland in #489
- CI: run CodeQL by @smelc in #487
- CI: call the CodeQL workflow from the main workflow file by @smelc in #491
- Fix infinite recursion when
--base-dir
is not a parent of a source file by @jherland in #492 - Update dependencies and bump version to v0.20.0 by @jherland in #493
New Contributors
- @layus made their first contributions as part of #470, #489, and #492
- @smelc made their first contribution in #485
Full Changelog: v0.19.0...v0.20.0