A collection of utilities for the Thinktwice project.
Project description
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 wrapperSE(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
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")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96ee4fc83417faab8d32563bdb8860d59f712cfc05b457aa8f0a97ad76983ff6
|
|
| MD5 |
0665f002b46bca06677a9783c565cef2
|
|
| BLAKE2b-256 |
a3e980ebe3ed1c71351f6e170a549e787eb0de8d423571383f4ccb80e9fa80bf
|
File details
Details for the file thinktwiceutils-0.0.4-py3-none-any.whl.
File metadata
- Download URL: thinktwiceutils-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d220bf2ec0965463d1514a71b623ea3f8bb2dace1da9aa3de3ef539155738636
|
|
| MD5 |
8ca6eab34c6a4fbe6e4a010577131b62
|
|
| BLAKE2b-256 |
a39182cdeced8f2ab79eb219dd65d9c32466a222ead26443e6b4ea5daac3aea3
|