sinoroc / tox-poetry-dev-dependencies

Tox plugin to help working with Poetry-based projects
https://pypi.org/project/tox-poetry-dev-dependencies/
Apache License 2.0
15 stars 3 forks source link

Is poetry.lock used despite not enabling poetry_experimental_add_locked_dependencies? #42

Closed fredrikaverpil closed 4 years ago

fredrikaverpil commented 4 years ago

I was a little surprised to see the exact same ranges from the pyproject.toml and the pinned versions from my poetry.lock file, despite having forgotten to set poetry_experimental_add_locked_dependencies = true. Is the poetry.lock file used anyway?

$ tox -e code_check
.package recreate: REDACTED\.tox\.package
.package installdeps: poetry-core>=1.0.0
code_check create: REDACTED\.tox\code_check
code_check installdeps: black (>=20.8b1,<21.0), darglint (>=1.5.3,<2.0.0), flake8 (>=3.8.3,<4.0.0), ...
code_check inst: REDACTED\.tox\.tmp\package\1\pc-swdp-generic-0.0.0.tar.gz
code_check installed: appdirs==black==20.8b1,darglint==1.5.5,flake8==3.8.4, ...

pyproject.toml:

black = "^20.8b1"
darglint = "^1.5.3"
flake8 = "^3.8.3"

poetry.lock:

[[package]]
name = "black"
version = "20.8b1"
...

[[package]]
name = "darglint"
version = "1.5.5"

[[package]]
name = "flake8"
version = "3.8.4"

tox.ini:

[tox]
minversion = 3.20.0
isolated_build = true
requires =
    poetry-core>=1.0.0
    tox-poetry-dev-dependencies>=0.0.4
provision_tox_env = provision

[base]
setenv =
    PIP_INDEX_URL = REDACTED
    PIP_EXTRA_INDEX_URL = REDACTED
    LANG = en_US.UTF-8

[testenv:code_check]
poetry_add_dev_dependencies= true
# poetry_experimental_add_locked_dependencies = true
setenv = {[base]setenv}
commands =
    pytest
sinoroc commented 4 years ago

If I followed right, these ranges that we see are the ones for dev-dependencies in pyproject.toml.

And indeed the *_add_dev_dependencies is enabled, meaning the development dependencies will be added to deps.

Two cases:

fredrikaverpil commented 4 years ago

If I followed right, these ranges that we see are the ones for dev-dependencies in pyproject.toml.

Correct.

  • *_add_locked_dependencies = False as it is the case here

the pyproject.toml file is read, and it is the dev-dependencies from pyproject.toml that are added to deps.

Okay, never mind. I was probably too tired yesterday - there is no problem here as the latest versions of each dep is in both my poetry.lock as well as in the pyproject.toml-defined ranges. This essentially means installing with *_add_locked_dependencies set to either True or False will yield the same installed versions right now. Sorry for this confusion. 👍

sinoroc commented 4 years ago

If you get the chance to test on a project where the locked versions are not simply the latest, let me know how it goes.