Skip to main content

A collection of utilities for the Thinktwice project.

Project description

thinktwiceutils CI/CD Version Management

thinktwiceutils

A collection of lightweight Python utilities for common development patterns.

Installation

pip install thinktwiceutils

Usage

import ttutils
from ttutils import SR, SE

Packages

SimpleReturns

A typed result handling utility for clean error handling without exceptions.

Key Features:

  • SR (SimpleResult): Type-safe success/error result wrapper
  • SE (SimpleError): Structured error representation
  • Chainable operations with railway-oriented programming pattern

Example:

from ttutils import SR, SE

def divide(a: int, b: int) -> SR[float, str]:
    if b == 0:
        return SR.error("Division by zero")
    return SR.success(a / b)

result = divide(10, 2)
if result.is_success:
    print(f"Result: {result.value}")  # Result: 5.0

Full Documentation

Dependencies

A lightweight dependency injection utility for managing service dependencies.

Key Features:

  • Simple registration and resolution of dependencies
  • Type-safe dependency injection
  • Minimal boilerplate

Example:

from ttutils.dependencies.dependencies import Dependency

# Register a service
Dependency.register("database", my_db_instance)

# Resolve it later
db = Dependency.resolve("database")

Full Documentation

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

thinktwiceutils-0.0.4.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

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

thinktwiceutils-0.0.4-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file thinktwiceutils-0.0.4.tar.gz.

File metadata

  • Download URL: thinktwiceutils-0.0.4.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.5

File hashes

Hashes for thinktwiceutils-0.0.4.tar.gz
Algorithm Hash digest
SHA256 96ee4fc83417faab8d32563bdb8860d59f712cfc05b457aa8f0a97ad76983ff6
MD5 0665f002b46bca06677a9783c565cef2
BLAKE2b-256 a3e980ebe3ed1c71351f6e170a549e787eb0de8d423571383f4ccb80e9fa80bf

See more details on using hashes here.

File details

Details for the file thinktwiceutils-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for thinktwiceutils-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d220bf2ec0965463d1514a71b623ea3f8bb2dace1da9aa3de3ef539155738636
MD5 8ca6eab34c6a4fbe6e4a010577131b62
BLAKE2b-256 a39182cdeced8f2ab79eb219dd65d9c32466a222ead26443e6b4ea5daac3aea3

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