aboutsummaryrefslogtreecommitdiff
path: root/files/.vim/UltiSnips/python.snippets
diff options
context:
space:
mode:
Diffstat (limited to 'files/.vim/UltiSnips/python.snippets')
-rw-r--r--files/.vim/UltiSnips/python.snippets39
1 files changed, 39 insertions, 0 deletions
diff --git a/files/.vim/UltiSnips/python.snippets b/files/.vim/UltiSnips/python.snippets
new file mode 100644
index 0000000..0f1c366
--- /dev/null
+++ b/files/.vim/UltiSnips/python.snippets
@@ -0,0 +1,39 @@
+# https://packaging.python.org/en/latest/specifications/inline-script-metadata/#inline-script-metadata
+# https://peps.python.org/pep-0723/
+snippet inline-script "Inline script metadata" b
+# /// script
+# requires-python = ">=3.11"
+# dependencies = [
+# "requests",
+# ]
+# ///
+endsnippet
+
+snippet #! "Run script with python3" b
+#!/usr/bin/env python3
+
+endsnippet
+
+snippet #!pipx "Run script with pipx" b
+#!/usr/bin/env -S pipx run --path
+
+# /// script
+# requires-python = ">=3.11"
+# dependencies = [
+# "requests",
+# ]
+# ///
+
+endsnippet
+
+snippet #!uv "Run script with uv" b
+#!/usr/bin/env -S uv run --script
+
+# /// script
+# requires-python = ">=3.11"
+# dependencies = [
+# "requests",
+# ]
+# ///
+
+endsnippet