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

poetry.script extras seems to be ignored, and scripts are always installed #6892

Closed
3 of 4 tasks
willmcgugan opened this issue Oct 26, 2022 · 8 comments
Closed
3 of 4 tasks
Assignees
Labels
area/core Related to the poetry-core library kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@willmcgugan
Copy link

  • Poetry version: 1.2.2
  • Python version: 3.10.4
  • OS version and name: macOS 12.5.1
  • pyproject.toml:
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

I'm trying to install a CLI script only if a given extra is supplied. Here's the config:

[tool.poetry.scripts]
textual = { callable = "textual.cli.cli:run", extras = ["dev"] }

My understand is that textual will be installed on the path only if the "dev" extras has been requested.

After running poetry install there is a textual on the path, which is broken because of missing dependancies. I would expect that poetry would only install textual with poetry install --extras dev.

@willmcgugan willmcgugan added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 26, 2022
@neersighted neersighted added the area/core Related to the poetry-core library label Oct 26, 2022
@neersighted
Copy link
Member

Please provide a complete pyproject.toml as per the issue template. Thanks!

@willmcgugan
Copy link
Author

@dimbleby
Copy link
Contributor

the extras are dropped here

but if you use the apparently undeprecated "reference" variant instead, which does preserve the extras, you will encounter #5297. It looks as though this never was fixed, only masked by the extras being lost altogether. Perhaps something like #3431 wants reviving.

either way, there seems to be no code that tries to avoid installing the script at poetry install time based on extras.

I think that would happen, if it happened, in this block. Currently I don't think the EditableBuilder knows which extras are in scope.

probably not too hard to make this work, if you are motivated to do so. That this is so thoroughly broken and no-one has previously noticed suggests that you may be the only person in the world who might be motivated by this...!

@ofek
Copy link
Contributor

ofek commented Oct 29, 2022

please keep in mind this would only work if the user is using Poetry, pip will install all defined scripts (and that won't ever change)

@Secrus
Copy link
Member

Secrus commented Oct 29, 2022

please keep in mind this would only work if the user is using Poetry, pip will install all defined scripts (and that won't ever change)

That's probably a good reason not to introduce such option.

@dimbleby
Copy link
Contributor

putting some flesh on that: https://packaging.python.org/en/latest/specifications/entry-points/ says

Using extras for an entry point is no longer recommended. Consumers should support parsing them from existing distributions, but may then ignore them. New publishing tools need not support specifying extras.

So perhaps an MR that cleaned up the code so as not even to try and do this would be just as welcome as one that made it work

@kojiromike
Copy link

I will close #8841, but it's worth a look for those following this issue, as it has additional details and a repo for reproducibility.

@Secrus
Copy link
Member

Secrus commented Oct 6, 2024

Closing, since it was clearly settled that extra-based entrypoints are no longer valid spec and poetry-core removed support for that with changes related to PEP 621 support.

@Secrus Secrus closed this as not planned Won't fix, can't repro, duplicate, stale Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Related to the poetry-core library kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

6 participants