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.

Support lock dependencies with lowest solvable versions

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 question is not covered.

Feature Request

Context

When I am implementing a library, it would be super useful to run my tests with all the supported dependencies defined with the constrains in pyproject.toml. This will prevent errors in production when, for example, I use some new features of a dependency and forget to update the dependencies constrains (this is hard to identify when you are coding).

Because running the tests with all the possible combinations of all your supported libraries is virtually impossible, maybe running them with the lowest versions solvable solution and also the highest (I think this is the default behavior)

Proposal

  • add the flag --use-lowest-versions to the cli entrypoints (install, sync, lock, shell, and run)
  • these commands will create and/or use a different lock file poetry.lowest.lock
  • a different venv will be created by just adding lowest after the project name like this: {project_name}-lowest-{id}-{python-version}

Main simple use case

In ci do the following steps

  • Install environments
>>> poetry install 
>>> poetry install --use-lowest-versions
  • run tests for highest versions
poetry run pytest  --junit-xml pytest.xml
  • run tests for lowest versions
poetry run --use-lowest-versions pytest  --junit-xml pytest.xml

Note: I would appreciate if anyone has a better name for the flag (naming is the hardest part 😛)

Also, I looked a the code and I think I know where add this logic, I can create a PR if you like the idea

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:25
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

15reactions
Spectre5commented, Oct 10, 2021

Ya, I don’t understand how library authors are not clamoring for this. If you put a minimum version in your dependency, it makes 100% sense to test with that version in case you accidentally use a feature from a newer version of it. Then you can decide to bump the dependency version or re-work your code to maintain that older compatibility. I’ve seen this happen on multiple projects and each would have been saved by testing against the minimum version dependencies.

3reactions
davegaeddertcommented, Feb 11, 2022

I went off of @JorgeGarciaIrazabal’s comment and played with here if anyone is curious: https://github.com/davegaeddert/poetry/pull/1

Very rough stab and I’m sure there’s all kinds of quirks that could come out of it. But, it was enough for me to poke around some of my own packages and do poetry upgrade --min-versions and then run my tests, and realize there’s usually a problem with the min requirements.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Locking dependency versions - Gradle User Manual
Run gradle dependencies --write-locks . This will effectively lock all resolvable configurations that have locking enabled. Note that in a multi project setup, ......
Read more >
synp - NPM Package Overview - Socket - Socket.dev
Start using Socket to analyze synp and its 9 dependencies to secure your app from ... methods in order to deterministically lock down...
Read more >
Can't update via composer because of lock file - Drupal Answers
The way I updated is I manually updated composer and set Lightning to 8.1.0 and then ran composer update drupal/lightning .
Read more >
How should you pin dependencies and why? – The Guild
By freezing the dependencies we want to achieve repeatable deployment ... Both yarn and recent npm versions allow you to create a lock...
Read more >
Requires-Python upper limits - #58 by rgommers - Packaging ...
The version support requirement Y ⊆ X says: The intersection of all of this project's dependencies' support requirements must be a superset of...
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