[Feature Request] Install dependencies without updating lockfile
See original GitHub issue- I have searched the issues of this repo and believe that this is not a duplicate.
- I have searched the documentation and believe that my request is not covered.
Feature Request
I am trying to install a dependency that will not result in a lockfile update, similar in behavior to yarn install --no-lockfile
.
The reason I am looking for this feature is the ability to better test with tox
when having multiple “environments”. For example, I want to test on Python 3.6 with several versions of Django (1.9, 1.11, 2.1, for example). My tox.ini
looks like this:
[tox]
skipsdist = True
envlist = {py36}-django{19,111,21}, {py37}-django{19,111,21}
[testenv]
install_command = poetry add -D {packages}
whitelist_externals = poetry
deps =
django19: django=^1.9
django111: django=^1.11
django21: django=^2.1
commands =
poetry install -v
poetry run pytest -v tests/
When I get rid of the additional Django dependency, everything works fine and as expected, but I need to be able to install Django in the virtualenv for that specific test run without actually updating the poetry.lock
file for local development or subsequent runs.
Thanks!
EDIT To add, I’m more than willing to help add this functionality, but I would need some help on where to start. I see AddCommand
– it seems like this could be solved by calling installer.update(False)
when the --no-lockfile
option is passed.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
@nickpresta do you have any more details on how you got this to work? I have exactly the same issue - I cannot get tests running against multiple Django versions, as
poetry install
always overwrites whatever tox has installed.I’m experiencing the same issue. I’m using Travis CI and want to test my package against multiple versions of Tensorflow.
tensorflow
is a dependency in mypyproject.tml
and Poetry always upgrades.My workaround for this has been to remove this package from the config and add it back with a strict version. Thankfully, Poetry’s CLI makes it simple. So I changed the install workflow to this (note that
TF_VERSION
is specified in the Travis config):And it worked for me*. Note that
poetry remove
will also install other packages, so don’t be surprised.Here’s my full
travis.yml
for reference* due to https://github.com/python-poetry/poetry/issues/2271, my line actually reads,
poetry add tensorflow==$TF_VERSION tensorflow-estimator==$TF_VERSION