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

Feature request/proposal to expose project.scripts in output of pdm show #2879

Closed
adamliter opened this issue May 14, 2024 · 2 comments
Closed
Labels
⭐ enhancement Improvements for existing features

Comments

@adamliter
Copy link

Is your feature/enhancement proposal related to a problem? Please describe.

It might be nice to expose whether (and which) project.scripts a Python project defines in its pyproject.toml via pdm show (e.g., pdm show --scripts or pdm show --project-scripts). This would be useful in the context of CI to be able to check that a particular package exposes a script with the expected name that can then be called later in the CI step with pdm run my_script.

Describe the solution you'd like

pyproject.toml

[project.scripts]
my_script = my_package:my_module:main

using pdm to check output in CI

$ pdm show --project-scripts
["my_script"]
# or perhaps [{"my_script": "my_package.my_module:main"}]

Do you see utility/interest in this feature? If so, I'm happy to take a shot at it.

@adamliter adamliter added the ⭐ enhancement Improvements for existing features label May 14, 2024
@frostming
Copy link
Collaborator

How would you implement it if user requests a pypi package like pdm show <package> --scripts?

@adamliter
Copy link
Author

Hmm, good question. I guess it's not really possible since this information isn't exposed via the PyPI JSON API. So the options seem like they would be:

  1. Download it to a cache in the background and then check with importlib.metadata from the cache ... ?
  2. Just error out for packages that aren't installed locally

Maybe the second option is best, but then maybe it's worth making it a separate command or something (e.g., pdm package-scripts ... ?). Also understand if this is something you'd rather not add to pdm.

@frostming frostming closed this as not planned Won't fix, can't repro, duplicate, stale May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ enhancement Improvements for existing features
Projects
None yet
Development

No branches or pull requests

2 participants