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.

Allow different versions in (dev) sections

See original GitHub issue

Is your feature request related to a problem? Please describe.

I would be very helpful if versions are resolved/locked separately for different sections. Currently, the pdm.cli.actions.do_lock procedure locks whatever the highest version between all sections is. pdm.cli.actions.do_sync then looks at the lock file and installs the version it finds there, regardless of the specification given in the section that it is locking for.

pdm.cli.actions.do_lock appears to mention this feature in the TODO at the top of the function, but I could not find a github issue for it.

Describe the solution you’d like

A simplified example pyproject.toml would be


dependencies = [
    "pdm"
]

[tool.pdm.dev-dependencies]
dev = [
    "-e pdm @ git+https://github.com/pdm-project/pdm"
]

pdm install --prod would install the latest version from the package index, while pdm install -d would install the package from the git repo.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:6
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
BrutalSimplicitycommented, Oct 19, 2022

@frostming Any new thoughts on how to approach this. I’ve currently taken your naive approach above and run the install in parallel for all combinations of dependency groups specified by the user (i.e. main/local, main/deploy, main/prod), and then generate a requirements file for each configuration that is stored in the repo. This solution allows us to use the correct version of our project dependencies during local development, local deployment, and production release. However, I’m not happy with the solution although it works pretty well for us so far.

A rather brute method is to generate a sub-resolver each time it encounters a “branch”. And finally the results from all sub-resolvers get merged to format the lockfile. But this approach apparently slows down the whole dependency resolution, making the situation worse.

Some thoughts:

If this is an opt-in functionality, is there anything wrong with it being slower?

Perhaps multiple processes can be used to help improve performance in this case.

It seems like the need for this is becoming more common as monorepo strategies are becoming more popular again. It would be nice if pdm could support this case, and in particular, the use case for the same editable and local package being able to live side-by-side. Maybe the latter can be a separate feature/use case.

0reactions
andreas-muchacommented, Oct 13, 2022

I just also want to add that this would be very useful for me. Apart from #1432 which was just merged, this is the only other thing missing for my usual workflow for co-developing different packages.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I override nested NPM dependency versions?
Overrides provide a way to replace a package in your dependency tree with another version, or another package entirely. These changes can be...
Read more >
Install multiple versions of a dependency · Issue #5499 - GitHub
I support multiple versions of Express. During development I want to be able to test my application with different versions of my dependency....
Read more >
How to Install Multiple Versions of the Same Package in NPM
You can use this Node package manager (nvm) to handle different versions of Node.
Read more >
How to switch Node.js versions with NVM - LogRocket Blog
Learn about Node Version Manager (NVM), a Node.js version management tool that quickly installs and switches Node versions from the CLI.
Read more >
Installing Multiple Versions of Node.js Using nvm - SitePoint
Michael and James introduce nvm, a handy command-line tool that allows you to install multiple versions of Node.js and switch between them ...
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