Replies: 2 comments 2 replies
|
no |
|
No, dependency groups cannot be used to run conflicting library versions in the same project, because Poetry uses a single shared environment for the whole project. Here are two simple ways to solve this: 1. Separate into two projects (Recommended)If the features need completely different, conflicting library versions, split them into two separate sub-projects or repositories. Each project will have its own 2. Use Optional ExtrasIf you want to keep everything in one codebase and users only need one feature at a time, define them as optional extras in [tool.poetry.dependencies]
python = "^3.10"
package-a = { version = "^1.0", optional = true }
package-b = { version = "^2.0", optional = true }
[tool.poetry.extras]
feature-a = ["package-a"]
feature-b = ["package-b"]How to use it: Install only Feature B: Important Note for your answer |
Uh oh!
There was an error while loading. Please reload this page.
I have a project with two main features, but the libraries required by these two features have version conflicts. Both features are frequently used. Can I use Dependency groups to create separate environments for these two features?
All reactions