Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build-rewrite-path-deps drops extra information of dependency #29

Open
woistdiekatze opened this issue Jun 25, 2024 · 0 comments · May be fixed by #34
Open

build-rewrite-path-deps drops extra information of dependency #29

woistdiekatze opened this issue Jun 25, 2024 · 0 comments · May be fixed by #34

Comments

@woistdiekatze
Copy link

Steps to reproduce

python 3.12
poetry 1.8.3
poetry-monorepo-dependency-plugin 1.2.0

Create new project

poetry new --src extras_resolve

Step into the src directory and create two sub-projects

pushd extras_resolve\src
poetry new extras_resolve.foo
poetry new extras_resolve.bar
popd

Add the sub-projects as editable dependencies of the main project

poetry add -e src\extras_resolve.foo

Second dependency is optional (belongs to extra "bar")

poetry add -e --optional src\extras_resolve.bar

Add the "extras_resolve.bar" dependency to extra "bar" in pyproject.toml

...
[tool.poetry.extras]
bar = ["extras-resolve-bar"]
...

Complete pyproject.toml of main project

[tool.poetry]
name = "extras-resolve"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]
readme = "README.md"
packages = [{include = "extras_resolve", from = "src"}]

[tool.poetry.dependencies]
python = "^3.12"
extras-resolve-foo = {path = "src/extras_resolve.foo", develop = true}
extras-resolve-bar = {path = "src/extras_resolve.bar", optional = true, develop = true}

[tool.poetry.extras]
bar = ["extras-resolve-bar"]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

Build the package using "stock" poetry build command

poetry build

The generated wheel contains following METADATA

Metadata-Version: 2.1
Name: extras-resolve
Version: 0.1.0
Summary: 
Author: Your Name
Author-email: [email protected]
Requires-Python: >=3.12,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Provides-Extra: bar
Requires-Dist: extras-resolve-bar @ file:///C:/extras_resolve/src/extras_resolve.bar ; extra == "bar"
Requires-Dist: extras-resolve-foo @ file:///C:/extras_resolve/src/extras_resolve.foo
Description-Content-Type: text/markdown

Build using build-rewrite-path-deps

poetry build-rewrite-path-deps

METADATA

Metadata-Version: 2.1
Name: extras-resolve
Version: 0.1.0
Summary: 
Author: Your Name
Author-email: [email protected]
Requires-Python: >=3.12,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Provides-Extra: bar
Requires-Dist: extras-resolve-bar (==0.1.0)
Requires-Dist: extras-resolve-foo (==0.1.0)
Description-Content-Type: text/markdown

As can be seen, the dependencies are nicely converted. Hovewer, the ; extra == "bar" is omitted, effectively making extras-resolve-bar a strictly required dependency.

Expected behaviour

The ; extra == "bar" should be preserved for optional dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant