Releases: fpgmaas/deptry
0.13.0
What's Changed
Features
- deptry will now report invalid configuration options defined in
pyproject.tomlby @mkniewallner in #571
Bug Fixes
- Stricten URL detection to avoid flagging libraries like
httpxas URLs by @mkniewallner in #570
Full Changelog: 0.12.0...0.13.0
0.12.0
What's Changed
This release introduces a significant change to the command-line flags and configuration options to make use of the error codes introduced in release 0.10.0.
| Code | Issue |
|---|---|
| DEP001 | Missing dependency |
| DEP002 | Unused/obsolete dependency |
| DEP003 | Transitive dependency |
| DEP004 | Misplaced development dependency |
Features
- Replaced --skip-unused, --skip-obsolete, --skip-missing, --skip-misplaced-dev flags: We have replaced the currently existing flags with the more generalized
--ignoreflag. Now, instead of skipping types of checks, you can specify the exact error codes to ignore using the--ignoreflag (e.g.,deptry . --ignore "DEP001,DEP002"to ignore checking for missing and unused dependencies).
The changes are also reflected in pyproject.toml. For example,
[tool.deptry]
skip_missing = true
skip_unused = trueis superseded by
[tool.deptry]
ignore = ["DEP001", "DEP002"]- Replaced --ignore-unused, --ignore-obsolete, --ignore-missing, --ignore-misplaced-dev flags: Previously, specific checks for spefific dependencies/modules could be ingored using the
--ignore-<code>flags. We are replacing these flags with the more generalized--per-rule-ignoresflag. This flag allows you to specify dependencies that should be ignored for specific error codes, offering granular control over which errors are ignored for which dependencies. For instance,deptry . --per-rule-ignores DEP001=matplotlib,DEP002=pandas|numpymeansDEP001will be ignored formatplotlib, whileDEP002will be ignored for bothpandasandnumpy.
The changes are also reflected in pyproject.toml. For example,
[tool.deptry]
ignore_missing = ["matplotlib"]
ignore_unused = ["pandas", "numpy"]is superseded by
[tool.deptry.per_rule_ignores]
DEP001 = ["matplotlib"]
DEP002 = ["pandas", "numpy"]Please note that while the legacy arguments are still functional as of Deptry 0.12.0, we do plan to remove them in a future 1.0.0 release.
- Consider all groups for dev dependencies (#392)
Bug Fixes
- Handle
SyntaxErrorraised byast.parse(#426)
Full Changelog
0.11.0
What's Changed
Deprecations
--skip-obsoleteCLI option and itsskip_obsoletecouterpart inpyproject.tomlare being replaced with--skip-unusedandskip_unused, respectively--ignore-obsoleteCLI option and itsignore_obsoletecounterpart inpyproject.tomlare being replaced with--ignore-unusedandignore_unused, respectively
This is done to account for a wording change, as we are replacing "obsolete" with "unused", since it has a clearer meaning for users.
The legacy options will still be usable for the time being, with a warning being shown in the terminal, but they will be removed in a future release, so you are advised to migrate to the new ones.
Features
- Add ability to pass multiple source directories by @mkniewallner in #381
- Replace the word
obsoletewithunusedby @fpgmaas in #373
Bug Fixes
- Load gitignore from where CLI is invoked by @mkniewallner in #380
Full Changelog: 0.10.1...0.11.0
0.10.1
0.10.0
What's Changed
Breaking changes
Release 0.10.0 of deptry brings a significant improvement to the way in which issues are reported. Previously, issues were reported in a summarized format, making it difficult for users to pinpoint exactly where in the code the issue was occurring. This is resolved by #357, which adds location information to the detected issues.
#367 adds error codes to identify the different issue types:
| Code | Issue |
|---|---|
| DEP001 | Missing dependency |
| DEP002 | Obsolete dependency |
| DEP003 | Transitive dependency |
| DEP004 | Misplaced development dependency |
Here's an example of how issues are now reported in release 0.10.0:
foo/bar.py:11:11: DEP002 'an_import' imported but missing from the dependencies
foo/bar.py:12:11: DEP002 'another_import' imported but missing from the dependencies
foo/baz.py:13:11: DEP003 'cfgv' imported but it is a transitive dependency
pyproject.toml: DEP001 'pandas' defined as a dependency but not used in the codebaseThe json output generated by using the -o or --json-output is also modified to include the new error codes and location information:
{
"error": {
"code": "DEP001",
"message": "'seven' imported but missing from the dependency definitions"
},
"module": "seven",
"location": {
"file": "foo/bar.py",
"line": 2,
"column": 0
}
},Features
- Add location to error reports by @mkniewallner in #357
- Add colours to text output by @mkniewallner in #368
Full Changelog: 0.9.0...0.10.0
0.9.0
What's Changed
Breaking changes
Python 3.7 support dropped
Support for Python 3.7 has been dropped in #352, given that it will reach end of life soon, and that PyPI stats show a really low usage of it. If you are using deptry on Python 3.7, consider upgrading to 3.8, or staying on <0.9.0.
Behaviour changes in package name guessing
In case packages don't provide the Python modules they expose, deptry tries to guess the package name by converting - to _, as a best effort, and warns about it in the logs. Before #337, deptry always guessed the module name, regardless of if the package provided the necessary information or not. Now, it will only guess the module name if the package does not provide the information and no mapping has been provided using the new --package-module-name-map flag (or package_module_name_map option in pyproject.toml).
Handling modules without __init__.py
With #285, deptry will now consider the following things as local modules:
- directories without
__init__.py(and at least one Python file) - single Python files
Previously, deptry only considered directories as local modules if an __init__.py was present, and did not account for cases where a single Python file could also be a local module, alongside directories.
Features
- Drop support for Python 3.7 by @mkniewallner in #352
- Only try to guess module associated to a dependency as a fallback for when the package doesn't provide such information by @akeeman in #337
- Handle local modules without
__init__.pyby @mkniewallner in #285 - Ability to configure a map of package names to module names by @akeeman in #333
Bug Fixes
- Replace 'PDM' with 'poetry' (typo) by @baggiponte in #294
- fix: account for Windows in code and tests by @mkniewallner in #343
Miscellaneous
- Run tests on macOS and Windows on CI by @mkniewallner in #342
Full Changelog: 0.8.0...0.9.0
0.8.0
What's Changed
Features
- Don't filter out
setuptoolsby @mkniewallner in #262 - Use
sys.stdlib_module_namesto get stdlibs in Python >= 3.10 by @mkniewallner in #275
Miscellaneous
- Drop
flake8to only useruffby @mkniewallner in #268 - Use more
ruffrules and replacepyupgradeandpygrep-hooksusages by @mkniewallner in #276
Full Changelog: 0.7.1...0.8.0
0.7.1
What's Changed
- Exclude files from
.gitignoreby @mkniewallner in #248 - docs: overhaul of the documentation to make it clearer by @mkniewallner in #255
- test(cli): use JSON output to simplify tests on errors by @mkniewallner in #256
- feat: add support for known first party modules by @mkniewallner in #257
- build(deps): bump
mkdocs-materialto9.0.0by @mkniewallner in #258 - docs: move
Contributingtodocsby @mkniewallner in #259
Full Changelog: 0.7.0...0.7.1
0.7.0
Breaking changes
Previously, deptry always searched for a pyproject.toml file in the root directory passed as a positional argument to the deptry command. Since this is not in line with what most other tools in the ecosystem do, this is changed in release 0.7.0.
In previous releases, when running:
deptry srcdeptry would search for both a pyproject.toml and for Python files to scan in the src directory.
Since this release, when running:
deptry srcdeptry will search for pyproject.toml in the location it is run from, and for Python files to scan in the src directory.
The downside of the changes outlined above, is that this could break some projects that did explicitly want to find pyproject.toml in a directory other than the positional argument specified as root. For this purpose, release 0.7.0 adds a --config argument that can be used to explicitly pass the location of pyproject.toml.
What's Changed
- refactor: use generic types instead of
typingby @mkniewallner in #217 - Use
rufffor import sorting and add more rules by @mkniewallner in #232 - chore: move
renovate-config-validatorto GH Actions by @mkniewallner in #233 - changed badge url by @fpgmaas in #235
- ci: fix
toxworkflow by @mkniewallner in #241 - perf(core): only load local modules once by @mkniewallner in #242
- perf(finder): more efficient Python files retrieval by @mkniewallner in #243
- Separate
pyproject.tomllocation fromrootargument by @mkniewallner in #244 - Expose and handle
--configargument by @mkniewallner in #245
Full Changelog: 0.6.6...0.7.0
0.6.6
What's Changed
- chore(deps): lock file maintenance by @renovate in #193
- docs: fix PyPI URL by @mkniewallner in #196
- docs: fix typos by @joao-vitor-souza in #198
- Fixed build badge by @fpgmaas in #199
- add .direnv to default exclude argument by @fpgmaas in #197
- downgraded chardet by @fpgmaas in #205
- Refactor import parser by @mkniewallner in #206
- Run
mypyon tests by @mkniewallner in #208 - refactor(cli): remove obsolete
cli_defaultsmodule by @mkniewallner in #209 - chore(deps): update pre-commit hook charliermarsh/ruff-pre-commit to v0.0.128 by @renovate in #211
- chore(deps): update dependency mypy to ^0.991 by @renovate in #212
- chore(deps): update pre-commit hook renovatebot/pre-commit-hooks to v34.28.0 by @renovate in #213
- Improve cli command by @mkniewallner in #210
- chore(deps): lock file maintenance by @renovate in #214
- Added logic to NotebookImportExtractor to guess the encoding on initi… by @fpgmaas in #216
New Contributors
- @joao-vitor-souza made their first contribution in #198
Full Changelog: 0.6.5...0.6.6