question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[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:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
hugorodgerbrowncommented, Dec 16, 2019

@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.

0reactions
pshvedcommented, Jul 9, 2020

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 my pyproject.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):

pip install poetry
poetry remove tensorflow
poetry add tensorflow==$TF_VERSION
poetry install

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Feature Request] Install dependencies without updating lockfile
I am trying to install a dependency that will not result in a lockfile update, similar in behavior to yarn install --no-lockfile ....
Read more >
Yarn lock: how it works and what you risk without maintaining ...
Updating the lockfile is a bit easier to explain. An update can happen in 3 situations: When the dependency is added, removed, or...
Read more >
Can composer generate the `composer.lock` without actually ...
To fix this you can update the lock file itself, without updating the dependencies. This will only update the content-hash in the lock...
Read more >
Frequently Asked Questions
Why isn't my package being snapshotted into the lockfile? By default, renv uses the intersection of: Packages installed into your project library, and....
Read more >
Commands | Documentation | Poetry - Python dependency ...
poetry install Installing dependencies from lock file No dependencies to install or update - Installing <your-package-name> (x.x.x).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found