Package: tox-poetry-dev-dependencies
ContentsIntroductionRepositoriesUsagepoetry_experimental_add_locked_dependenciespoetry_add_dev_dependenciesDependency settings combinationpoetry_use_source_repospoetry_experimental_no_virtual_envAppendixInstallationSimilar projectsIntroductionTox plugin to help working with Poetry-based projects.RepositoriesDistributions:https://pypi.org/project/tox-poetry-dev-dependencies/Source code:https://github.com/sinoroc/tox-poetry-dev-dependencieshttps://gitlab.com/sinoroc/tox-poetry-dev-dependenciesUsageBy default the plugin does not do anything. Use one of the following settings to activate the corresponding features.poetry_experimental_add_locked_dependenciesSet thetestenvsettingpoetry_experimental_add_locked_dependenciestoTrueto let Tox add Poetry’s locked dependencies from thelockfileto thedepslist in the test environment.[testenv:example]
# ...
poetry_experimental_add_locked_dependencies = Truepoetry_add_dev_dependenciesSet thetestenvsettingpoetry_add_dev_dependenciestoTrueto let Tox add Poetry’s development dependencies to thedepslist in the test environment.[testenv:example]
# ...
poetry_add_dev_dependencies = TrueDependency settings combinationThe settingspoetry_experimental_add_locked_dependenciesandpoetry_add_dev_dependenciesare independent and can be used in combination. The following table shows the expected result for each possible combination of these two settings.Thesource filecolumn shows which file is used as source for the dependencies. Thedepscolumn shows an example of what dependencies are expected to be added todepsfor that test environment. In that exampleLib = '~1.0'is a mandatory dependency locking toLib==1.2.3andDev = '~3.0'is a development dependency locking toDev==3.2.1.*_locked_dependenciesFalseTrueFalseTrue*_dev_dependenciesFalseFalseTrueTrue⇓read from filenonepoetry.lockpyproject.tomlpoetry.lock⇓add todepsnothingLib==1.2.3Dev~=3.0Lib==1.2.3,Dev==3.2.1poetry_use_source_reposSet thetestenvsettingpoetry_use_source_repostopip_env_varsto let Tox set thePIP_EXTRA_URLandPIP_EXTRA_INDEX_URLenvironment variables accordingly.[testenv:example]
# ...
poetry_use_source_repos = pip_env_varsThis will read sections such as the following from thepyproject.tomlfile:[[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 = trueand 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/simpleIf there is at least one nonsecondarysource repository defined, then pip’s default index server (PyPIhttps://pypi.org/simple) is placed inPIP_EXTRA_INDEX_URLright before anysecondaryrespository.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 toxpoetry_experimental_no_virtual_envExperimental featureSet thetestenvsettingpoetry_experimental_no_virtual_envtoTrueto skip the creation of a virtual environment for this test environment.[testenv:real]
deps =
poetry_experimental_no_virtual_env = True
skip_install = TrueThis might be useful in cases where all the required dependencies and tools are already available, i.e. they are already installed in global or usersite packagesdirectory, or maybe they are already installed directly in the system (viaapt,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).AppendixInstallationIt 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 version3.8it is possible to enforce the installation (in an isolated environment) of the plugin directly from within thetox.inifile, thanks to therequiressetting (Tox3.2) and theauto-provisioningfeature (Tox3.8):[tox]
requires =
    tox-poetry-dev-dependencieshttps://tox.readthedocs.io/en/latest/config.html#conf-requireshttps://tox.readthedocs.io/en/latest/example/basic.html#tox-auto-provisioningSimilar projectshttps://pypi.org/project/tox-poetry-installer/https://pypi.org/project/tox-poetry/