dephell deps add

Add new dependencies into project.

Algorithm:

  1. Get dependencies from from file.
  2. Add new dependencies.
  3. Check that these new dependencies has no conflicts with existing.
  4. Write dependencies back into from file.

You can specify --envs to add dependencies into.

Basic usage

Simple usage:

dephell deps add --from=poetry flake8

Best practice is specify your dependencies file in pyproject.toml DepHell config:

[tool.dephell.main]
from = {format = "poetry", path = "pyproject.toml"}

And after that DepHell will automatically detect your dependencies file:

dephell deps add flake8

See configuration documentation for more details.

Specify dependencies environments

Environments for dependencies is the name of dependencies section (main and dev for poetry and pipfile) or name of extras. DepHell uses main by default, but you can specify another one:

dephell deps add --envs dev tests -- flake8==3.1.0 pytest

This will produce dependencies next lines in your poetry config:

[tool.poetry.dev-dependencies]
pytest = "*"
flake8 = "==3.1.0"

[tool.poetry.extras]
tests = ["flake8", "pytest"]

See also

  1. How to configure DepHell.
  2. How to filter commands JSON output.
  3. dephell deps convert for details about locking dependencies and supported file formats.
  4. dephell deps install to install new dependencies into virtual environment.
  5. dephell package install to install single package without adding it into requirements.