Skip to main content

Build one-off Python scripts via stored code at the command line

Project description

Build one-off Python scripts via stored code at the command line.

pip install epy

Store code defining a function shell that runs code via your shell. -d makes it run by default. -k shell gives the code a unique key "shell". save stores this in a default bundle. A bundle is an ordered dict of named code blocks.

epy set -d -k shell "import subprocess; import functools; shell = functools.partial(subprocess.run, shell=True)" save

Execute code using the shell command defined above. The code defining the shell statement is loaded and run from the default bundle before the exec statements.

epy exec "shell('echo hello world')" exec shell "('echo sincerely, epy')

Display code to be run, but don't execute. -b "*" also prints all loaded bundles.

epy exec "shell('echo dry run')" dump -b "*"

Create a new bundle, which will NOT be loaded by default.

epy create --path my_bundle.json my_bundle set -n my_bundle -k greet "print('hello from my bundle')" save

Load the bundle and execute the greet statement. greet is not run by default because it was not generated with -d. In the exec statement, my_bundle is attached with -n. The greet statement is the first argument. epy searches all explicitly attached bundles

epy load my_bundle.json exec -a my_bundle -r greet -r "shell('echo hello from the default bundle')"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

epy_scripts-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

epy_scripts-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file epy_scripts-0.1.0.tar.gz.

File metadata

  • Download URL: epy_scripts-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for epy_scripts-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3d45dc43fe4ce237a6d3101bb22c3218d7462db04f3c85eb9f4cda6df36077d1
MD5 c4edf60f014cc52599f473937ca82782
BLAKE2b-256 5d4822220f8e7b0a40278d057cea8378632d4605b8d9a3d4c6a66cb01f09613b

See more details on using hashes here.

File details

Details for the file epy_scripts-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: epy_scripts-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for epy_scripts-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 deb08984d39465314a5e24571e95165ff46862c0ca49e6bab4fdfab5d7cd0821
MD5 f47a5f086acfb68ac378c7cbf6aba9ad
BLAKE2b-256 3df55ac416b17b24e809e2bbb383ce24be9f101cde6d65a4799dca988227dbf9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page