Skip to main content

Saturn allows to rerun python scripts skipping some places that were defined in previous runs.

Project description

saturn

A Python library that allows to rerun a script multiple times without stopping the process and keeping the scope (like it is done in Jupyter Notebook in code sections). The goal is to keep in RAM the datasets that are expensive to load in each run.

Installation

pip install saturn-python

Basic example

# example.py

import saturn

@saturn.main
def main(scope):
    if not saturn.defined('scope.a', scope):  # OR if 'a' not in scope:
        scope.a = 42
    scope.a += 1
    print(scope.a)

Run:

$ saturn
Welcome to Saturn terminal where you can reruns your Python module keeping its scope in RAM. Version 1.0.
S>>> run example
43
S>>> run example
44
S>>> print(scope)
{'a': 44}
S>>> exit
$

Work with sections

# example.py

import saturn

@saturn.main
def main(scope):
    print('main')

    if saturn.section('a'):
        print('section a')

    if saturn.section('b'):
        print('section b')

Run:

$ saturn
Welcome to Saturn terminal where you can reruns your Python module keeping its scope in RAM. Version 1.0.
S>>> run example
main
section a
section b
S>>> run example a
main
section a
S>>> run example c
main
S>>> exit
$

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

saturn-python-1.4.tar.gz (3.4 kB view details)

Uploaded Source

File details

Details for the file saturn-python-1.4.tar.gz.

File metadata

  • Download URL: saturn-python-1.4.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for saturn-python-1.4.tar.gz
Algorithm Hash digest
SHA256 48f4f7d2e1e1a406a2ca7e546df6f723cde750b576fb977a3d88a4be8970b5c4
MD5 3367f0ffc82df60d673a528b6d684c76
BLAKE2b-256 df26ca8001b48a2b92f5327cc43cfe4c07985b07d6ee1bccab58ed0a091d14e0

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