py(1)

πŸ“¦
version 0.4.11b Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

🌸 py(1) β€” your new bestie for command-line Python 🌸

okay so real talk, this is the manual for py(1), and honestly? it's a whole vibe. stick around, bestie, we're gonna get you fluent. πŸ’…

✨ NAME ✨

pythonpy β€” literally just python -c, but with tab completion and shorthand, and honestly it ate. πŸ”₯

✨ SYNOPSIS ✨

py [-x] [-l] [-c PRE_CMD] [-C POST_CMD] [-V] [-h] [expression]

✨ DESCRIPTION ✨

pythonpy will evaluate any Python expression straight from the command line. no cap, any of them. ✨

and get this β€” the evaluating is done by the exact same Python interpreter that runs pythonpy itself. main character energy, honestly. and because this version uses Python 3, it is compatible with Python 3 syntax only. so if you roll up with Python 2 syntax, it's giving πŸ’€ β€” no cap. 🫢

✨ OPTIONS ✨

  • -x β€” treat each row of stdin as x. every single line, one at a time. πŸ“
  • -l β€” treat the list of stdin as l. the whole buffet, as a list. πŸ’–
  • -c PRE_CMD β€” run code before the expression. pregame, but make it code. ✨
  • -C POST_CMD β€” run code after the expression. the outro, the aftershow. πŸŽ€
  • -V, --version β€” version info. the receipts, basically. πŸ‘‘
  • -h, --help β€” show the help message and exit. it's the "bestie explain" button. 🌸

✨ EXAMPLES ✨

float arithmetic, because decimals deserve love too:

$ py '3 * 1.5'

import any module automatically, no import statement needed, iconic behaviour honestly:

$ py 'math.exp(1)'

multiply each line of input by 7 β€” see how the -x makes x be each row:

$ py 'range(3)' | py -x 'int(x)*7'

and the unhinged-but-useful one β€” remove every file returned by the find command (yes, it pipes into sh, and yes, that's a lot of power, so maybe vibe check your find before you commit πŸ™ˆ):

$ find . -type f | py -x '"rm %s" % x' | sh

✨ SEE ALSO ✨

python(1) β€” the parent, the origin story. πŸ¦‹

✨ BUGS ✨

found a bug? bestie, don't sit on it 😭 β€” bugs should be reported as issues at the project's GitHub page: <https://github.com/Russell91/pythonpy/issues>

✨ AUTHOR ✨

pythonpy is developed by Russell Stewart <russell.s.stewart@gmail.com>. πŸ’œ

this man page was written by Tiago Ilieve <tiago.myhro@gmail.com> for the Debian distribution (but it may be used by others). 🌈


that's the whole thing, bestie β€” dated 02 December 2024, and it's the py(1) page from this very same py(1) manual. iykyk πŸ’…βœ¨

πŸ“¦ where this page comes from