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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

carnot-0.1.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

carnot-0.1.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file carnot-0.1.1.tar.gz.

File metadata

  • Download URL: carnot-0.1.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for carnot-0.1.1.tar.gz
Algorithm Hash digest
SHA256 436f238ed482fda332ec993801280f05eccc82b2a7b2370d8373a835daa5084b
MD5 8eaebc53451bb33c1eced9d2f9fbec4a
BLAKE2b-256 d66ea0c47d4e400cc74c2d4885f20c2809010849382639b93550913c971a1619

See more details on using hashes here.

File details

Details for the file carnot-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: carnot-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for carnot-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9b351a674c86e84115050b106754f247f7df819a0f11cc5a90e3dd62ae7672bb
MD5 eb7cc65558fc5a054b6ab55109fe4c17
BLAKE2b-256 a9c6253c961b982e7806f23623ad5152184157a83fe9792e531d507c1bab56ab

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page