{"repo":"hauntsaninja/pyp","free":true,"listed":false,"github":"https://github.com/hauntsaninja/pyp","clone":"git clone https://github.com/hauntsaninja/pyp.git","description":"Easily run Python at the shell! Magical, but never mysterious.","language":"Python","stars":1529,"topics":["python","shell","awk","cli","command-line"],"license":"MIT","category":"cli-tools","readme_excerpt":"pyp Easily run Python at the shell! Magical, but never mysterious. Installation Run pip install pypyp (note the extra \"yp\"!) You can also install pyp in other ways: - uv tool install pypyp - brew install pyp via Homebrew - nixpkgs - AUR pyp requires Python 3.9 or above. How it works pyp will statically analyse the input code to detect undefined variables. Based on what it finds, it will proceed to transform the AST of the input code as needed. We then compile and execute the result, or if using --explain , unparse the AST back to source code. Examples This section will walk you through the details of using pyp, and hopefully replace your needs for many common shell utilities. For a cheatsheet / tldr, run pyp --help . pyp can easily be used to apply Python code to each line in the input. Just use one of the magic variables x , l or line to refer to the current line. pyp can be used to easily apply Python code to the entire input as well. Use the magic variable lines for a list of rstripped lines or stdin for sys.stdin . pyp will automatically import modules you use. For collections , math , itertools , pathlib.Path , pprint.pp , pyp will figure it out even if you don't use the qualified name. pyp can give you access to loop indices using the magic variables i , idx or index . Note so far you haven't had to call print ! By default, pyp will print the last expression in your code — except if it evaluates to None (or the last statement is pass ). And you can always explicitly cal","default_branch":null,"files":null,"tree":[],"storefront":"/r/hauntsaninja","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/hauntsaninja/pyp/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}