script-runner
A tool for defining python functions, triggering their execution and displaying results via a user interface.
Used at Sentry to allow specific users to run predefined Python scripts on production data.
Deployment modes
Multi-region deployments enable aggregating results across multiple "regions" or "silos", whilst still enabling script execution to be performed in a single region.
- set
mode: mainfor the central region - set
mode: regionfor each instance of the application deployed in each regions
For a single deployment in one region use mode:combined. Currently we only use this for dev and testing.
Writing custom scripts
Scripts are standard python functions organized into groups.
All of the arguments to a function must be annotated with one of the supported parameter types. The currently supported ones are:
- Text
- Textarea
- Integer
- Number
- Autocomplete
- DynamicAutocomplete
Example:
def print_value(input: Text) -> None:
"""
for short text, renders <input type="text" /> in the ui
"""
print(input.value)
def print_long_value(input: TextArea) -> None:
"""
multiline text, renders <textarea /> in the ui
"""
print(input.value)
The annotation controls how the element is displayed in the UI, and the Python type of the value (str, int or float)
The return value of the function can be anything, as long as it is json serializable
Any functions exported by a module via __all__ will be picked up automatically and displayed in the UI.
Writing tests
Use the execute_with_context helper from the testutils module to call your function with mock values.
Authentication
currently google iap (and no auth) are supported
for google iap, set the audience_code as well as iap_principals (group -> iap principal mapping) in the config
Example data:
- These are in the examples/scripts directory
Configuration
check config.schema.json for configuration format and required fields.
there is also an example of each mode in this repository: example_config_combined.yaml, example_config_main.yaml, example_config_local.yaml
Development
-
Run
make devserver. The application will run on combined mode onhttp://127.0.0.1:5000 -
If you want UI hot reloading, you have to run the vite server separately.
-
Navigate to the frontend directory:
cd script_runner/frontend
-
Install dependencies if you haven't already:
npm install -
Run the Vite development server:
npm run dev
-
The frontend should now be running on
http://localhost:5173and will automatically proxy API requests to the backend thanks to the proxy configured invite.config.ts.
Metadata
Release files for sentry-script-runner 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sentry_script_runner-1.0.4.tar.gz | 74.1 kB | Without provenance | Details for sentry_script_runner-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sentry_script_runner-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for sentry_script_runner-1.0.4-py3-none-any.whl |
Total release size: 1.9 MB
Release files / sentry_script_runner-1.0.4.tar.gz
| Download URL | sentry_script_runner-1.0.4.tar.gz |
|---|---|
| Size | 74.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c19907d91e81e783f2f729a93f2ffa57717e49b72eb3f0c8a69ff39a4ce68be
|
|
BLAKE2b-256 checksum How to use checksums |
5f1db32e7f53c550e7418e7f63a248c8c749358fbe9eea72f0820f397d3bede8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|
Release files / sentry_script_runner-1.0.4-py3-none-any.whl
| Download URL | sentry_script_runner-1.0.4-py3-none-any.whl |
|---|---|
| Size | 1.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
77ef743be15adc644004185b32ae97f02326342f345dd1ab8fe76bcb9e0ef4af
|
|
BLAKE2b-256 checksum How to use checksums |
e51794d47cec2df3b76c7cfe7e501af86df961ad20383fac60447b6073b9f7c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|
Security for sentry-script-runner 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.