{"id":13585215,"url":"https://github.com/fish2000/pythonpy-fork","last_synced_at":"2025-04-15T07:57:30.667Z","repository":{"id":57457418,"uuid":"249523455","full_name":"fish2000/pythonpy-fork","owner":"fish2000","description":"A fork of the time-tested `pythonpy` CLI utility, formerly by Russel91","archived":false,"fork":false,"pushed_at":"2022-09-15T20:58:54.000Z","size":179,"stargazers_count":12,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T07:57:08.754Z","etag":null,"topics":["cli","cli-app","fork","fork-for-contribution","python","python-script","python3","pythonpy"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pythonpy-fork/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fish2000.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"COPYING.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-23T19:22:11.000Z","updated_at":"2025-02-14T16:09:01.000Z","dependencies_parsed_at":"2022-09-26T17:40:43.995Z","dependency_job_id":null,"html_url":"https://github.com/fish2000/pythonpy-fork","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fish2000%2Fpythonpy-fork","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fish2000%2Fpythonpy-fork/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fish2000%2Fpythonpy-fork/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fish2000%2Fpythonpy-fork/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fish2000","download_url":"https://codeload.github.com/fish2000/pythonpy-fork/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249031777,"owners_count":21201357,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","cli-app","fork","fork-for-contribution","python","python-script","python3","pythonpy"],"created_at":"2024-08-01T15:04:48.604Z","updated_at":"2025-04-15T07:57:30.650Z","avatar_url":"https://github.com/fish2000.png","language":"Python","readme":"Installation\n------------\n\n::\n\n  pip install pythonpy-fork\n\n::\n\nRun Tests\n------------\n\n::\n\n  python -m pytest\n\n::\n\nUsage\n-----------------------------------------------\n\nPythonpy will evaluate any python expression from the command line.\n\nFloat Arithmetic\n~~~~~~~~~~~~~~~~\n\n::\n\n  $ py '3 * 1.5' \n  4.5\n\n::\n\nImport any module automatically\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n  $ py 'math.exp(1)'\n  2.71828182846\n\n  $ py 'random.random()'\n  0.103173957713\n  \n  $ py 'datetime.datetime.now?'\n  Help on built-in function now:\n\n  now(...)\n        [tz] -\u003e new datetime with tz's local day and time.\n\n\n::\n\npy -x 'foo(x)' will apply foo to each line of input\n---------------------------------------------------\n\nMultiply each line of input by 7\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n  $ py 'range(3)' | py -x 'int(x)*7'\n  0\n  7\n  14\n\n::\n\nGrab the second column of a csv\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n  $ echo $'a1,b1,c1\\na2,b2,c2' | py -x 'x.split(\",\")[1]'\n  b1\n  b2\n\n::\n\nAppend \".txt\" to every file in the directory\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n  $ ls | py -x '\"mv `%s` `%s.txt`\" % (x,x)' | sh \n  # sharp quotes are swapped out for single quotes\n  # single quotes handle spaces in filenames\n\n::\n\nRemove every file returned by the find command\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n  $ find . -type f | py -x '\"rm %s\" % x' | sh \n\n::\n\nGet only 2 digit numbers\n~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n  $ py 'range(14)' | py -x 'x if len(x) == 2 else None'\n  10\n  11\n  12\n  13\n\n::\n\npy -l will set l = list(sys.stdin)\n-------------------------------------------\n\nLists are printed row by row\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n  $ py 'range(3)'\n  0\n  1\n  2\n\n  $ py '[range(3)]'\n  [0, 1, 2]\n\n::\n\nReverse the input\n~~~~~~~~~~~~~~~~~\n\n::\n\n  $ py 'range(3)' | py -l 'l[::-1]'\n  2\n  1\n  0\n\n::\n\nSum the input\n~~~~~~~~~~~~~\n\n::\n\n  $ py 'range(3)' | py -l 'sum(int(x) for x in l)'\n  3\n\n::\n\nSort a csv by the second column\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n  $ echo $'a,2\\nb,1' | py -l 'sorted(l, key=lambda x: x.split(\",\")[1])'\n  b,1\n  a,2\n\n::\n\nCount words beginning with each letter\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n  $ cat /usr/share/dict/words | py -x 'x[0].lower()' | py -l 'collections.Counter(l).most_common(5)'\n  ('s', 11327)\n  ('c', 9521)\n  ('p', 7659)\n  ('b', 6068)\n  ('m', 5922)\n\n::\n\nFor more examples, check out the `wiki \u003chttp://github.com/fish2000/pythonpy-fork/wiki\u003e`__.\n\nPythonpy also supports `ipython`-style tab completion, which you can enable as follows:\n\n::\n\n  $ if command -v find_pycompletion.sh\u003e/dev/null; then source `find_pycompletion.sh`; fi\n\n::\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffish2000%2Fpythonpy-fork","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffish2000%2Fpythonpy-fork","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffish2000%2Fpythonpy-fork/lists"}