Skip to main content

Requirement (dependency) management for python projects

Project description

dependence

test distribute

This project provides a Command Line Interface and library for inspecting and updating python project dependency versions in setup.cfg, pyproject.toml, and requirements.txt files.

Installation

You can install dependence with pip:

pip3 install dependence

Usage

Command Line Interface

$ dependence -h
Usage:
  dependence <command> [options]

Commands:
  update                      Update requirement versions in the specified
                              files to align with currently installed versions
                              of each distribution
  freeze                      Print dependencies inferred from an installed
                              distribution or project, in a similar format
                              to the output of `pip freeze`.

dependence update

This command will update version specifiers for all package requirements in your setup.cfg, pyproject.toml, tox.ini, or requirements.txt files to match currently installed versions of each distribution (matching the existing granularity, and only for inclusive specifiers—so where the comparator is "~=", "==", ">=", or "<=", but not where the comparator is ">", "<", or "!=").

$ dependence update -h
usage: dependence update [-h] [-i IGNORE] [-aen ALL_EXTRA_NAME]
                           path [path ...]

Update requirement versions in the specified files to align with currently
installed versions of each distribution.

positional arguments:
  path                  One or more local paths to a setup.cfg,
                        setup.cfg, and/or requirements.txt file

optional arguments:
  -h, --help            show this help message and exit
  -i IGNORE, --ignore IGNORE
                        A comma-separated list of distributions to ignore
                        (leave any requirements pertaining to the package
                        as-is)
  -aen ALL_EXTRA_NAME, --all-extra-name ALL_EXTRA_NAME
                        If provided, an extra which consolidates the
                        requirements for all other extras will be
                        added/updated to setup.cfg or setup.cfg
                        (this argument is ignored for requirements.txt
                        files)

Example:

dependence update -aen all setup.cfg pyproject.toml tox.ini

dependence freeze

$ dependence freeze -h
usage: dependence freeze [-h] [-e EXCLUDE] [-er EXCLUDE_RECURSIVE] [-nv NO_VERSION]
                         [-do] [--reverse] [-d DEPTH]
                         requirement [requirement ...]

This command prints dependencies inferred from an installed distribution or project, in
a similar format to the output of `pip freeze`, except that all generated requirements
are specified in the format "distribution-name==0.0.0" (including for editable
installations). Using this command instead of `pip freeze` to generate requirement
files ensures that you don't bloat your requirements files with superfluous
distributions.

positional arguments:
  requirement           One or more requirement specifiers (for example: "requirement-
                        name", "requirement-name[extra-a,extra-b]", ".[extra-a,
                        extra-b]" or "../other-editable-package-directory[extra-a,
                        extra-b]) and/or paths to a setup.py, setup.cfg,
                        pyproject.toml, tox.ini or requirements.txt file

optional arguments:
  -h, --help            show this help message and exit
  -e EXCLUDE, --exclude EXCLUDE
                        A distribution (or comma-separated list of distributions) to
                        exclude from the output
  -er EXCLUDE_RECURSIVE, --exclude-recursive EXCLUDE_RECURSIVE
                        A distribution (or comma-separated list of distributions) to
                        exclude from the output. Unlike -e / --exclude, this argument
                        also precludes recursive requirement discovery for the
                        specified packages, thereby excluding all of the excluded
                        package's requirements which are not required by another (non-
                        excluded) distribution.
  -nv NO_VERSION, --no-version NO_VERSION
                        Don't include versions (only output distribution names) for
                        packages matching this/these glob pattern(s) (note: the value
                        must be single-quoted if it contains wildcards)
  -do, --dependency-order
                        Sort requirements so that dependents precede dependencies
  --reverse             Print requirements in reverse order
  -d DEPTH, --depth DEPTH
                        Depth of recursive requirement discovery

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dependence-0.3.5.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

dependence-0.3.5-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file dependence-0.3.5.tar.gz.

File metadata

  • Download URL: dependence-0.3.5.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for dependence-0.3.5.tar.gz
Algorithm Hash digest
SHA256 19543276a964ef9134b066793e2fbb0e660d2b9b5de8ac51a57d4f292c4f8a1a
MD5 8e092fbdc9f8b6543fb6b3cf2b1f1562
BLAKE2b-256 68405a6542a9b78128ceb6560929067e68d5450c0b0f6878873b5e4e573cb6f6

See more details on using hashes here.

File details

Details for the file dependence-0.3.5-py3-none-any.whl.

File metadata

  • Download URL: dependence-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for dependence-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6895d01718d8fd26f77e776c9dac5506c2207a6154d9955fd5c7f65c761ad621
MD5 74da6662114b6a1600a5556d7a1638f2
BLAKE2b-256 cfc0b014d3924b4f7129874da2e41e1bbaee5cbb7ec46f367d1c87b2357a880b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page