Skip to content

Scripts: Use PEP 723 inline metadata to declare dependencies #224

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

Closed
NMertsch opened this issue May 12, 2025 · 0 comments · Fixed by #235
Closed

Scripts: Use PEP 723 inline metadata to declare dependencies #224

NMertsch opened this issue May 12, 2025 · 0 comments · Fixed by #235
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@NMertsch
Copy link
Contributor

Some of the Python scripts in scripts/ require packages to be installed (e.g. discord.py or pydantic).

Let's use inline script metadata (PEP 723) to embed these requirements in the script files.

Many common tools already support this, including uv: uv run some-script.py will automatically create a temporary virtual environment with the embedded requirements, and use it to run the script.

(pip does not yet support it, though: pypa/pip#12891.)

Example:

# /// script
# requires-python = ">=3.9"
# dependencies = ["pydantic>=2.11.4"]
# ///
import pydantic

[...]
@NMertsch NMertsch added enhancement New feature or request good first issue Good for newcomers labels May 12, 2025
@NMertsch NMertsch linked a pull request Jun 8, 2025 that will close this issue
@NMertsch NMertsch self-assigned this Jun 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant