-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Ensure optional dev-dependencies are written to extras. #606
Ensure optional dev-dependencies are written to extras. #606
Conversation
* Ensures that all requirements, whether from dependencies or dev-dependencies for extra targets are written to the lockfile. * Fixes python-poetry#426
Thanks for taking the time to make this PR! However, this is not something I want to add. Extras will be referenced in the distributions metadata when packaging the project but development dependencies do not which will lead to a broken extras. |
@sdispater thanks for the response. Is the thinking that you would specify the packages in |
This is a confusing problem to track down. Maybe warn if something is dev and optional, because there's no way to install it? |
I hit this issue today, and imho the current behaviour is very confusing 😢 |
Dev dependencies cannot be optional, but not marking them as optional causes another issue: python-poetry/poetry-plugin-export#34 (comment) Is there any workaround? |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Problem
When specifying an
extras
target that contains packages fromdev-dependencies
, those packages were uninstallable.Example
pyproject.toml
Running
poetry install -v
results in the following lockfile. The important bit is that theextras
section lists:Which is wrong (we should see
black
in there).poetry.lock
Running
poetry install -E developer
results in:which makes sense (no packages in the
developer
target).Potential Workaround
By moving the
black
package out ofdev-dependencies
and intodependencies
, thedeveloper
target correctly includesblack
.This is not ideal -- my
black
,mypy
, etc dependencies are "dev" dependencies and moving them todependencies
is "wrong" but also confuses the installation requirements.Solution
We want to ensure that all requirements, whether from dependencies or dev-dependencies for
extras
targets are written to the lockfile.This should fix #426 and potentially other, related issues.
I first wrote a failing test and then updated the implementation to make the test pass:
Failing Test
Passing Test
Checklist
I didn't update documentation because this is how the feature should have always worked, IMO, and thus it was a bug. Once this is merged in, the existing documentation should suffice.