-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle-file.py
More file actions
48 lines (43 loc) · 1.02 KB
/
Copy pathsingle-file.py
File metadata and controls
48 lines (43 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# /// script
# [tool.pyshell]
# id = "com.pyshell.example.single-file"
# name = "Single File Example"
# description = "A PEP 723 inline manifest example"
# python = ">=3.11"
#
# [[tool.pyshell.inputs]]
# key = "url"
# type = "url"
# label = "URL"
# required = true
# [tool.pyshell.inputs.binding]
# kind = "arg"
# flag = "--url"
# style = "space"
#
# [[tool.pyshell.inputs]]
# key = "timeout"
# type = "int"
# label = "Timeout (seconds)"
# default = 30
# min = 1
# max = 300
# [tool.pyshell.inputs.binding]
# kind = "arg"
# flag = "--timeout"
# style = "space"
# ///
"""single-file.py — PEP 723 inline manifest example."""
import argparse
import sys
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--url", type=str, required=True)
parser.add_argument("--timeout", type=int, default=30)
args = parser.parse_args()
print(f"URL: {args.url}", flush=True)
print(f"Timeout: {args.timeout}s", flush=True)
print("Done!", flush=True)
if __name__ == "__main__":
main()