Skip to content

Commit

Permalink
Update requirement specification (#1240)
Browse files Browse the repository at this point in the history
* Update requirement specification

* Create 1227.doc.md

* Add reference for inline script metadata specification
  • Loading branch information
oberbichler authored Feb 6, 2024
1 parent afefdc4 commit c2df428
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit c2df428

Please sign in to comment.