From 7cce3ca9b02020b238c3d44284f451e55e0a5bd5 Mon Sep 17 00:00:00 2001 From: Thomas Oberbichler Date: Sat, 3 Feb 2024 09:16:34 +0100 Subject: [PATCH 1/3] Update requirement specification --- docs/examples.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/examples.md b/docs/examples.md index fcce41eb49..de8cf46811 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -70,10 +70,9 @@ If you have a script `test.py` that needs a 3rd party library like requests: ``` # 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 From 7879425cb11954badcb052026a2c01dcfe44b473 Mon Sep 17 00:00:00 2001 From: Thomas Oberbichler Date: Sat, 3 Feb 2024 10:50:54 +0100 Subject: [PATCH 2/3] Create 1227.doc.md --- changelog.d/1227.doc.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/1227.doc.md diff --git a/changelog.d/1227.doc.md b/changelog.d/1227.doc.md new file mode 100644 index 0000000000..3ff3bdd3cc --- /dev/null +++ b/changelog.d/1227.doc.md @@ -0,0 +1 @@ +Update the example for running scripts with dependencies. From ff982666d65de742ad1ba53bc4bcd727c0859508 Mon Sep 17 00:00:00 2001 From: Thomas Oberbichler Date: Tue, 6 Feb 2024 18:37:36 +0100 Subject: [PATCH 3/3] Add reference for inline script metadata specification --- docs/examples.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples.md b/docs/examples.md index de8cf46811..337d4fe1ce 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -65,7 +65,7 @@ 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