Giter Club home page Giter Club logo

deptry's Introduction

deptry logo

Release Build status Supported Python versions codecov PyPI - Downloads License

deptry is a command line tool to check for issues with dependencies in a Python project, such as unused or missing dependencies. It supports the following types of projects:

  • Projects that use Poetry and a corresponding pyproject.toml file
  • Projects that use PDM and a corresponding pyproject.toml file
  • Projects that use any package manager that strictly follows PEP 621 dependency specification
  • Projects that use a requirements.txt file according to the pip standards

Dependency issues are detected by scanning for imported modules within all Python files in a directory and its subdirectories, and comparing those to the dependencies listed in the project's requirements.


Documentation - Contributing


Quickstart

Installation

To add deptry to your project, run one of the following commands:

# Install with poetry
poetry add --group dev deptry

# Install with pip
pip install deptry

Warning: When using pip to install deptry, make sure you install it within the virtual environment of your project. Installing deptry globally will not work, since it needs to have access to the metadata of the packages in the virtual environment.

Prerequisites

deptry should be run within the root directory of the project to be scanned, and the project should be running in its own dedicated virtual environment.

Usage

To scan your project for dependency issues, run:

deptry .

Example output could look as follows:

Scanning 2 files...

foo/bar.py:1:0: DEP004 'numpy' imported but declared as a dev dependency
foo/bar.py:2:0: DEP001 'matplotlib' imported but missing from the dependency definitions
pyproject.toml: DEP002 'pandas' defined as a dependency but not used in the codebase
Found 3 dependency issues.

Configuration

deptry can be configured by using additional command line arguments, or by adding a [tool.deptry] section in pyproject.toml. For more information, see the Usage and Configuration section of the documentation..


Repository initiated with fpgmaas/cookiecutter-poetry.

deptry's People

Contributors

renovate[bot] avatar fpgmaas avatar mkniewallner avatar akeeman avatar joao-vitor-souza avatar mbyrnepr2 avatar rrauenza avatar baggiponte avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.