Dependencies¶
This project manages dependencies through pyproject.toml
🔗, a Python
package metadata file working its way to standardization through PEP 518.
pyproject.toml
stands to replace a growing set of redundant, confusing,
non-standard configuration files: setup.py
, requirements.txt
,
setup.cfg
, MANIFEST.in
, and Pipfile
.
Poetry¶
Right now, the premier tool for managing pyproject.toml
is Poetry. The
generator requires you to have Poetry installed and has instructions in its
documentation for installing it.
If you’re familiar with npm or Yarn, Poetry works much the same way. Poetry will create a virtual environment for your project and install your project’s dependencies there, isolated from the virtual environments of other projects.
By default, Poetry will create your virtual environment underneath a cache
directory in your home directory, $HOME/.cache/pypoetry/virtualenvs
. You
can find this directory by checking your Poetry configuration:
$ poetry config settings.virtualenvs.path
You can configure Poetry to create the virtual environment in your project directory, if you want:
$ poetry config settings.virtualenvs.in-project true
The in-project virtual environment directory will be named .venv
.
Managing dependencies¶
When you run the generator, it will install the starting dependencies, but if you clone this project, you must install them yourself:
$ poetry install
Dependencies are grouped. The two most common groups are required
(dependencies your code uses at runtime) and development (dependencies
your project uses for development, e.g. mypy
or pytest
).
You can add or remove dependencies easily:
$ poetry add requests
$ poetry remove --dev mypy
By default, Poetry will search the Python Package Index (PyPI) for the latest versions of the dependencies you name. To find out how to search other package repositories or how to search for specific versions, consult the Poetry documentation.
Default dependencies¶
By default, the generator does not install any required dependencies, but it does install a set of development dependencies, explained here.
Package | Reason |
---|---|
mypy | Type-checking. |
pylint | Static analysis and PEP 8 (code style) conformance. |
pydocstyle | PEP 257 (docstring style) conformance. |
yapf | Formatting code. |
pytest | Testing. |
pytest-cov | Code coverage. |
sphinx | Documentation. |
sphinx-autobuild | Fast iterations on documentation. |
sphinx_rtd_theme | Read the Docs theme for documentation. |
toml | Reading the version from pyproject.toml . |