Skip to content

Releases: fpgmaas/deptry

0.16.0

04 Apr 12:32
36a06f0
Compare
Choose a tag to compare

What's Changed

Breaking changes

typing.TYPE_CHECKING handling

Imports guarded by typing.TYPE_CHECKING when using from __future__ import annotations are now skipped. For instance:

from __future__ import annotations

from typing import TYPE_CHECKING

if TYPE_CHECKING:
    # This import will not be extracted as it is guarded by `TYPE_CHECKING` and `from __future__ import annotations`
    # is used. This means the import should only be evaluated by type checkers, and should not be evaluated during runtime.
    import mypy_boto3_s3

See https://deptry.com/usage/#imports-extraction for more information.

requirements.in handling

On projects using pip requirements format for defining dependencies, if requirements_files option is not overridden,
deptry will first search for a requirements.in file before requirements.txt, to better support projects using
pip-tools and the like (which includes uv and Rye) out of the box. If you use requirements.in and want deptry to
use requirements.txt, you can either pass --requirements-files requirements.txt when invoking deptry, or set the
option in pyproject.toml:

[tool.deptry]
requirements_files = ["requirements.txt"]

Features

  • Skip type checking blocks when parsing imports (#652)
  • Search for requirements.in before requirements.txt on projects using pip requirements format for dependencies (#641)

Bug Fixes

  • Show module name instead of library name when reporting DEP003 (#644
  • Better support for notebooks by handling magic commands and line continuations (#656)

Full Changelog

0.15.0...0.16.0

0.15.0

24 Mar 21:31
e51a86a
Compare
Choose a tag to compare

What's Changed

Breaking changes

  • In release 0.12.0, we announced the deprecation of the following flags:

    • --ignore-unused
    • --ignore-obsolete
    • --ignore-missing
    • --ignore-misplaced-dev
    • --ignore-transitive
    • --skip-unused
    • --skip-obsolete
    • --skip-missing
    • --skip-misplaced-dev
    • --skip-transitive

    These flags are now no longer supported. If you are still using these flags and are planning to upgrade to this release, please refer to the release notes of 0.12.0 for instructions on how to migrate to the new method of configuration. (#596)

Deprecations

  • The options requirements-txt and requirements-txt-dev are replaced with requirements-files and requirements-files-dev, respectively, to provide better support for projects that use both a requirements.in and a requirements.txt. 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. (#609)

Features

  • Implement the collection of all Python files to be scanned by deptry in Rust (#591)
  • Implement import extraction for notebooks in Rust (#606)
  • Use ruff's AST parser for import extraction from Python files. This also adds support for files with Python 3.12 f-string syntax, see PEP 701. (#615)
  • Improved logging of the detected imports and their locations when deptry is run in verbose mode (#627)
  • Introduce the --pep621-dev-dependency-groups flag that allows users to specify which groups under [project.optional-dependencies] are considered development dependencies (#628)

Bug Fixes

  • Add back the license classifier, which was lost during the transition from Poetry to PDM in (#624)

Miscellaneous

  • Remove upper bound on requires-python (#621)
  • Moved the documentation to deptry.com (#630)

Full Changelog

0.14.2...0.15.0

0.14.2

19 Mar 08:30
9cc6b0f
Compare
Choose a tag to compare

What's Changed

This release adds back MIT license classifier in package metadata, that was lost when changing the build backend (by @mkniewallner in #623).

Full Changelog: 0.14.1...0.14.2

0.14.1

18 Mar 13:59
6c73675
Compare
Choose a tag to compare

What's Changed

This release improves runtime performance of built wheels by about 5%, and reduces their size (by @mkniewallner in #594).

PyPy wheels are now also published on PyPI (by @edgarrmondragon in #612).

Bug fixes

  • Improve handling of comments in requirements.txt files by @fpgmaas in #588
  • Avoid process hanging on error when parsing Python files by @mkniewallner in #619

Full Changelog: 0.14.0...0.14.1

0.14.0

14 Mar 20:11
8e002b7
Compare
Choose a tag to compare

What's Changed

This release significantly improves the speed of deptry, particularly for large projects, by utilizing Rust to manage the parsing of Abstract Syntax Trees (AST) from .py files and to extract the import statements. For some benchmarks, see below:

Changes

Since the changes are all in the back-end, little has changed for the user other than the execution speed. The two minor notable changes are:

  • Improved identification of column identifier in imports detection. Where earlier the column identifier for an imported module foo in the line import foo would be 0, it now points to column 8

Available wheels on PyPi

Where earlier releases published a single .whl file to PyPi, with the move to Rust we now build and publish wheels for a variety of platforms and architectures. More specifically, wheel files for the following combinations are now available on PyPi:

  • Linux: ABI3 wheels for x86_64 and aarch64 architectures.
  • Windows: ABI3 wheels for the x64 architecture.
  • macOS: ABI3 wheels for x86_64 and aarch64 (Apple Silicon) architectures.

Alongside the ABI3 wheels, we provide a source distribution (sdist) package.

Full Changelog: 0.13.0...0.14.0

0.14.0a1

13 Mar 12:02
a13add1
Compare
Choose a tag to compare
0.14.0a1 Pre-release
Pre-release

This release speeds up deptry significantly, especially on large projects, by leveraging Rust to handle the parsing of the Abstract Syntax Trees (AST) from .py files and the extraction of import statements.

What's Changed

Full Changelog: 0.13.0...0.14.0a1

0.13.0

12 Mar 13:00
d25dbde
Compare
Choose a tag to compare

What's Changed

Features

  • deptry will now report invalid configuration options defined in pyproject.toml by @mkniewallner in #571

Bug Fixes

  • Stricten URL detection to avoid flagging libraries like httpx as URLs by @mkniewallner in #570

Full Changelog: 0.12.0...0.13.0

0.12.0

18 Jun 13:54
b280689
Compare
Choose a tag to compare

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 --ignore flag. Now, instead of skipping types of checks, you can specify the exact error codes to ignore using the --ignore flag (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 = true

is 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-ignores flag. 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|numpy means DEP001 will be ignored for matplotlib, while DEP002 will be ignored for both pandas and numpy.

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 SyntaxError raised by ast.parse (#426)

Full Changelog

0.11.0...0.12.0

0.11.0

10 May 13:43
133a9cc
Compare
Choose a tag to compare

What's Changed

Deprecations

  • --skip-obsolete CLI option and its skip_obsolete couterpart in pyproject.toml are being replaced with --skip-unused and skip_unused, respectively
  • --ignore-obsolete CLI option and its ignore_obsolete counterpart in pyproject.toml are being replaced with --ignore-unused and ignore_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

Bug Fixes

Full Changelog: 0.10.1...0.11.0

0.10.1

09 May 14:59
b5102b1
Compare
Choose a tag to compare

What's Changed

Bug Fixes

  • Fix terminal output when only a single file is scanned by @fpgmaas in #372
  • Fix issue with DEP004 being raised incorrectly when a dependency is defined both as a dev one and non-dev one by @fpgmaas in #376

Full Changelog: 0.10.0...0.10.1