Tox plugin to help working with Poetry-based projects
Project description
Introduction
Tox plugin to help working with Poetry-based projects.
Repositories
Distributions:
Source code:
Usage
By default the plugin does not do anything. Use one of the following settings to activate the corresponding features.
poetry_experimental_add_locked_dependencies
Set the testenv setting poetry_experimental_add_locked_dependencies to True to let Tox add Poetry’s locked dependencies from the lockfile to the deps list in the test environment.
[testenv:example]
# ...
poetry_experimental_add_locked_dependencies = True
If poetry_add_dev_dependencies is set as well then the development dependencies are added with the version from the lockfile.
poetry_add_dev_dependencies
Set the testenv setting poetry_add_dev_dependencies to True to let Tox add Poetry’s development dependencies to the deps list in the test environment.
[testenv:example]
# ...
poetry_add_dev_dependencies = True
poetry_use_source_repos
Set the testenv setting poetry_use_source_repos to pip_env_vars to let Tox set the PIP_EXTRA_URL and PIP_EXTRA_INDEX_URL environment variables accordingly.
[testenv:example]
# ...
poetry_use_source_repos = pip_env_vars
This will read sections such as the following from the pyproject.toml file:
[[tool.poetry.source]]
name = "project-alpha"
url = "https://alpha.example/simple"
secondary = true
[[tool.poetry.source]]
name = "project-bravo"
url = "https://bravo.example/simple"
[[tool.poetry.source]]
name = "project-charlie"
url = "https://charlie.example/simple"
default = true
and set the environment variables:
PIP_INDEX_URL=https://charlie.example/simple
PIP_EXTRA_INDEX_URL=https://bravo.example/simple https://pypi.org/simple https://alpha.example/simple
If there is at least one non secondary source repository defined, then pip’s default index server (PyPI https://pypi.org/simple) is placed in PIP_EXTRA_INDEX_URL right before any secondary respository.
If pip’s environment variables are already defined then they are not overwritten. For example in a command like the following, the plugin does not overwrite the environment variable.
PIP_INDEX_URL=https://delta.example/simple tox
poetry_experimental_no_virtual_env
Experimental feature
Set the testenv setting poetry_experimental_no_virtual_env to True to skip the creation of a virtual environment for this test environment.
[testenv:real]
deps =
poetry_experimental_no_virtual_env = True
skip_install = True
This might be useful in cases where all the required dependencies and tools are already available, i.e. they are already installed in global or user site packages directory, or maybe they are already installed directly in the system (via apt, yum, pacman, etc.).
For such environments it might be best to skip the installation of the project (skip_install) as well as keeping the list of dependencies empty (deps).
Appendix
Installation
It is a plugin for Tox and it is available on PyPI, install it however best fits the workflow. A useful thing to know though, is that starting with Tox version 3.8 it is possible to enforce the installation (in an isolated environment) of the plugin directly from within the tox.ini file, thanks to the requires setting (Tox 3.2) and the auto-provisioning feature (Tox 3.8):
[tox]
requires =
tox-poetry-dev-dependencies
Similar projects
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tox-poetry-dev-dependencies-0.0.4.tar.gz
.
File metadata
- Download URL: tox-poetry-dev-dependencies-0.0.4.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b23da99243464ebf0174b8f00693d35ebde831f464614bd128e634aab1e6722 |
|
MD5 | e435653163169a4228ac50001af9fec7 |
|
BLAKE2b-256 | f1f91cdb58e7f902b6a0ccc7c63237c8b81a6b859c9d961a3600dc40007d149e |
Provenance
File details
Details for the file tox_poetry_dev_dependencies-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: tox_poetry_dev_dependencies-0.0.4-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a414ba5fc68e872fa9cc7d386cc641dc37228371abf8f3d6d1e8e4717e38f8a |
|
MD5 | 81912ab9d3d5fa54a057b664941e2ca8 |
|
BLAKE2b-256 | 269992bb2d0231fc70d13c2ac0af017d57a71fc60df54b753cdad63ddfeebb23 |