Skip to main content

Util for executing a custom script before running any python application without modifying the last one

Project description

Pre Script

Util for executing a custom script before running any python application or script without modifying the last one.

You may treat it as application pre-start hook.

Use cases

  • patching log configs for a legacy application (sometimes it's pretty hard)
  • auto-executing docker-compose.yml before running the application
  • patching the application module (sometimes usefull for debugging)
  • any case where you need to inject some temporary logic without modifying the application code base

Installation

$ pip install pre-script

Example

$ echo PRE_SCRIPT_ENABLED=1
$ echo 'print("hello from pre-script")' > .pre-script.py
$ echo 'print("hello from app")' > app.py
$ python app.py
$ hello from pre-script
$ hello from app

If required, the script name can be changed via PRE_SCRIPT_FILE environment variable.

License

Distributed under the terms of the [MIT license][license], Pre Script is free and open source software.

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

pre_script-0.1.2.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

pre_script-0.1.2-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file pre_script-0.1.2.tar.gz.

File metadata

  • Download URL: pre_script-0.1.2.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Linux/6.2.16-2-MANJARO

File hashes

Hashes for pre_script-0.1.2.tar.gz
Algorithm Hash digest
SHA256 30c57a5369e3c06103e82da1d18472a6e46d36c199221aa73c031730ab560f42
MD5 c67e9db87d57c59272fdc3faf3cc1feb
BLAKE2b-256 7bcbdfa9fb2211ea25dd2a77dad8eda77818095d0f4502a559dbe8d724939c0c

See more details on using hashes here.

File details

Details for the file pre_script-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pre_script-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Linux/6.2.16-2-MANJARO

File hashes

Hashes for pre_script-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 96f28b57533592d3d8d31f7081e0d366457a3ba8ef90dab17ce32d2fbee62ea2
MD5 96f4935e0b36151fa6c62a58c791033a
BLAKE2b-256 9dd7fca4523ccad4bc1f1a4660175f38733b5a373a66c4185eb9c855ff1609ce

See more details on using hashes here.

Supported by

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