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.1.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.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: epy_scripts-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 d4e0945883b50fbf73d6766ae757e137cef1f7bbd08332efd8e10a1971e29518
MD5 307f0e97739b1423d2b635b223ad2878
BLAKE2b-256 477f9409fe81aefeb77333cbf107b6490944de578c84e5b10b21e30859af9b00

See more details on using hashes here.

File details

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

File metadata

  • Download URL: epy_scripts-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bac388c8911f86567f6f3b7c7222c068e63989516916f2afbf0c2c30f3d020dc
MD5 154dde16f3ea84be67f74d97e1d8fede
BLAKE2b-256 7accbff788fb7274cf475eb7b7c8c33d14c04554a2605690dafdcc7a8386668a

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