File: python-pip.py

package info (click to toggle)
rust-scriptisto 2.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 436 kB
  • sloc: python: 25; ansic: 16; java: 11; pascal: 9; cpp: 8; javascript: 8; cs: 7; cobol: 5; lisp: 5; f90: 5; makefile: 4; ml: 4; haskell: 2
file content (33 lines) | stat: -rwxr-xr-x 866 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env scriptisto

# scriptisto-begin
# script_src: script.py
# build_once_cmd: virtualenv -p python3 . && . ./bin/activate && pip install mypy termcolor
# build_cmd: . ./bin/activate && mypy script.py && python3 -m compileall . && chmod +x ./run.sh
# target_bin: ./run.sh
# files:
#   - path: run.sh
#     content: |
#       #!/bin/sh
#       export DIR=$(dirname $0)
#       . $DIR/bin/activate
#       python3 $DIR/script.py $@
# scriptisto-end

import argparse
from termcolor import colored, cprint
from typing import Optional

def print_hello(input: Optional[int]):
    msg = "Hello, Python! Input: %d" % (input or 0)
    cprint(msg, 'green')

def main():
  parser = argparse.ArgumentParser()
  parser.add_argument("--input", type=int, help="Example input.")
  args = parser.parse_args()

  print_hello(args.input)
  
if __name__== "__main__":
  main()