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

Python scanner for poetry.lock doesn't exclude dev dependencies for Poetry >= 1.5.0 #61

Open
slayo11 opened this issue Apr 10, 2024 · 2 comments

Comments

@slayo11
Copy link

slayo11 commented Apr 10, 2024

Hello,

Starting from poetry 1.5.0 ref the "category" field based on which capycli skips dev dependency is no more part of the poetry.lock file. #7637

This causes capycli to list all the dependencies, included dev ones, and in our projects to load also those into SW360.

I'm not so acquainted with poetry internals, but I guess that a solution would require reading the main dependencies from pyproject.toml file and resolving the transitive dependencies of the main dependencies from the poetry.lock, as by looking only at the lock file isn't enough to exclude dev dependencies.

@tngraf
Copy link
Collaborator

tngraf commented Apr 10, 2024

This is bad. I even added support for the dev flag to the CycloneDX tool.
But we have to accept their justification: at the end the lock file format is not officially documented
and they are free to change it.
We could try to use poetry show --without dev ... but this is again a proprietary format
or maybe use poetry export -f requirements.txt --output requirements.txt --without-hashes.
As far as I can see, -without dev has no effect on the requirements file.

@slayo11
Copy link
Author

slayo11 commented Apr 11, 2024

--without dev has no effect because it's default behaviour of poetry export plugin to not include group dev dependencies (ref)

If you try poetry export -f requirements.txt --with dev -o requirements.txt --without-hashes then we'll obtain a requirements.txt with both main and dev dependencies.

So if going with export plugin is the way, I think poetry export -f requirements.txt --output requirements.txt --without-hashes is the right command

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

No branches or pull requests

2 participants