Skip to main content

carnot

carnot is a module that enables reversible transactions for general purposes. Reversible transactions may make your codes simpler and have better readability inspite of complicated logics.

Installing

  • Python >= 3.8
python -m pip install carnot

Usage

from carnot import reversible_function, transaction

count = 0

@reverse_function
def add(num: int) -> None:
    global count
    count += num
    add.set_args(num)

@add.backward
def _add(num: int) -> None:
    global count
    count -= num

@transaction
def add_and_emit_error() -> None:
    add(2)
    raise Exception

if __name__ == "__main__":
    try:
        add_and_emit_error()
    except:
        pass
    finally:
        print(count)    # 0

Metadata

Release files for carnot 0.1.1

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

Source distribution (sdist)

Source distribution for carnot 0.1.1
File Size Uploaded
carnot-0.1.1.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for carnot 0.1.1
File Interpreter ABI Platform
carnot-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.6 kB

Release files / carnot-0.1.1.tar.gz

Download URL carnot-0.1.1.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
436f238ed482fda332ec993801280f05eccc82b2a7b2370d8373a835daa5084b
BLAKE2b-256 checksum
How to use checksums
d66ea0c47d4e400cc74c2d4885f20c2809010849382639b93550913c971a1619
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.13

Release files / carnot-0.1.1-py3-none-any.whl

Download URL carnot-0.1.1-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b351a674c86e84115050b106754f247f7df819a0f11cc5a90e3dd62ae7672bb
BLAKE2b-256 checksum
How to use checksums
a9c6253c961b982e7806f23623ad5152184157a83fe9792e531d507c1bab56ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.13

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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