Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Suitkaise

Making things easier for developers of all skill levels to develop complex Python programs.

(pronounced exactly like the word suitcase)

All files in this repository are licensed under the Apache License 2.0, including:

  • source code
  • examples
  • documentation
  • tests
  • site content code
  • and everything else

Installation

pip install suitkaise

Info

Explicitly supported Python versions: 3.11 and above

Currently, suitkaise is version 0.4.10 beta.

suitkaise contains the following modules:

  • cucumber: serialization engine
  • circuits: flow control with the Circuit and BreakingCircuit classes.
  • processing: upgraded multiprocessing with easy shared state
  • paths: upgraded path class and utilities for path ops
  • sk: modifiers for functions and class methods
  • timing: timer class with deep statistics usable in many ways

Documentation

All documentation is available for download.

CLI:

  • downloads to project root
  • cwd must be within project root
suitkaise docs

Python:

from suitkaise import docs

# download to project root
docs.download()

# download to a specific path within your project
docs.download("path/within/project")

To place docs outside your project root, use the Permission context manager.

from suitkaise import docs

with docs.Permission():
    docs.download("/Users/joe/Documents")

You can also view more at suitkaise.info.

Quick Start

Parallel processing with shared state

from suitkaise.processing import Share, Pool, Skprocess
import logging

# put anything on Share — literally anything
share = Share()
share.counter = 0
share.results = []
share.log = logging.getLogger("worker")

class Worker(Skprocess):
    def __init__(self, share, item):
        self.share = share
        self.item = item

    def __run__(self):
        result = self.item * 2
        self.share.results.append(result)       # shared list
        self.share.counter += 1                 # shared counter
        self.share.log.info(f"done: {result}")  # shared logger

pool = Pool(workers=4)
pool.star().map(Worker, [(share, x) for x in range(20)])

print(share.counter)         # 20
print(len(share.results))    # 20
print(share.log.handlers)    # still works

Serialize anything

from suitkaise import cucumber

data = cucumber.serialize(any_object)
restored = cucumber.deserialize(data)

Time anything

from suitkaise.timing import timethis

@timethis()
def my_function():
    do_work()

my_function()
print(my_function.timer.mean)
from suitkaise.timing import TimeThis

with TimeThis() as timer:
    do_this()
    then_this()
    this_too()

# stops timing and records on exit

# get most recent time
print(timer.most_recent)

Add retry, timeout, background execution to any function

from suitkaise import sk

@sk
def fetch(url):
    return requests.get(url).json()

# retry 3 times, timeout after 5 seconds each attempt
data = fetch.retry(3).timeout(5.0)("https://api.example.com")

Cross-platform paths, normalized path types

from suitkaise.paths import Skpath

path = Skpath("data/file.txt")
print(path.rp)  # "data/file.txt" — same on every machine, every OS
from suitkaise.paths import autopath

@autopath()
def process(path: AnyPath):
    print(path.rp)  # always an Skpath, no matter what was passed in

process("data/file.txt")        # str → Skpath
process(Path("data/file.txt"))  # Path → Skpath

Circuit breakers

from suitkaise import Circuit

circuit = Circuit(num_shorts_to_trip=5, sleep_time_after_trip=1.0)

for request in requests:
    try:
        process(request)
    except ServiceError:
        circuit.short()
from suitkaise import BreakingCircuit

breaker = BreakingCircuit(num_shorts_to_trip=3, sleep_time_after_trip=1.0)

while not breaker.broken:
    try:
        result = risky_operation()
        break  # success
    except OperationError:
        breaker.short()  # count the failure

if breaker.broken:
    handle_failure()

For more, see the full documentation at suitkaise.info or download the docs with suitkaise docs in your terminal after installation.

Metadata

Release files for suitkaise 0.4.10b0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for suitkaise 0.4.10b0
File Size Uploaded Provenance Actions
suitkaise-0.4.10b0.tar.gz 409.0 kB Without provenance Details for suitkaise-0.4.10b0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for suitkaise 0.4.10b0
File Interpreter ABI Platform Actions
suitkaise-0.4.10b0-py3-none-any.whl Python 3 none any Details for suitkaise-0.4.10b0-py3-none-any.whl

Total release size: 887.8 kB

Release files / suitkaise-0.4.10b0.tar.gz

Download URL suitkaise-0.4.10b0.tar.gz
Size 409.0 kB
Tags Source
SHA-256 checksum
How to use checksums
18f74946dd83e581911d9e6e02dcfc7b4cd6633c32ca1c8d54347c98f3ed8e4a
BLAKE2b-256 checksum
How to use checksums
b1fad222aaefd54bdb3fd6a14931807c6543a52b935cecf990abcd6bc92c30e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release files / suitkaise-0.4.10b0-py3-none-any.whl

Download URL suitkaise-0.4.10b0-py3-none-any.whl
Size 478.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3898840265f9d3752a55a3664a2ab9779ce874c08587d4b893bad475fc70487
BLAKE2b-256 checksum
How to use checksums
d38e96f44fc82d24ed0479240fef260c7aaf88e14e30dd2c17d472e954a7cb2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Security for suitkaise 0.4.10b0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page