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

Update requirement specification #1240

Merged
merged 4 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/1227.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update the example for running scripts with dependencies.
9 changes: 4 additions & 5 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,14 @@ pipx run --spec test-py test.py # Always a package on PyPI

You can also run scripts that have dependencies:

If you have a script `test.py` that needs a 3rd party library like requests:
If you have a script `test.py` that needs 3rd party libraries, you can add [inline script metadata](https://packaging.python.org/en/latest/specifications/inline-script-metadata/) in the style of PEP 723.

```
# test.py

# Requirements:
# requests
#
# The list of requirements is terminated by a blank line or an empty comment line.
# /// script
# dependencies = ["requests"]
# ///

import sys
import requests
Expand Down