Skip to main content

tuttifrutti

preview

A collection of tiny, lightweight, and highly optimized Python utilities to make your everyday coding sweet and crisp. Fully typed, zero external dependencies, and built with lazy-loading for maximum performance.


Utilities

1. OptionalChain

Tired of guarding deeply nested dictionaries or object lookups with defensive if configurations? OptionalChain brings clean, safe JavaScript-style optional chaining (?.) directly to Python.

from dataclasses import dataclass
from datetime import date
from typing import Any, Literal

from tuttifrutti import OptionalChain


@dataclass
class Course:
    name: str
    level: Literal["Basic", "Intermediate", "Advance"]
    price: int | None


@dataclass
class AppUser:
    name: str | None
    username: str | None
    age: int | None
    courses: list[Course] | None
    meta: dict[str, Any]


@dataclass
class AppResponse:
    data: OptionalChain[AppUser]
    status: int


course1 = Course(name="Python", level="Basic", price=2000)
course2 = Course(name="JS/TS", level="Intermediate", price=3400)
course3 = Course(name="Go", level="Advance", price=None)

app_user = AppUser(
    name="Kunal",
    username=None,
    age=10,
    courses=[course1, course2, course3],
    meta={
        "purchase_day": str(date.today()),
        "coupon": True,
    },
)
app_response = AppResponse(
    data=OptionalChain(app_user),
    status=200,
)

ans: int | None = app_response.data.courses[0].price.map(lambda x: x // 12).get()
print(ans)  # Output: 166


def append_at_sign(username: str) -> str:
    return f"{'@'}{username}"


result = app_response.data.username.map(append_at_sign).get()
print(result)  # Output: None

More tiny utilities are actively cooking and coming soon!

📦 Features

  • ⚡ Ultra Lightweight & Lazy-Loaded: Submodules are only loaded into memory when explicitly called—keeping your application startup lightning fast.
  • 🛡️ Fully Type-Safe: Ships with explicit PEP 561 typing configurations (py.typed) to ensure strict compatibility with tools like mypy and modern IDE autocomplete structures.
  • 🪶 Zero Dependencies: Pure, clean standard-library enhancements.

🚀 Installation

Install tuttifrutti using your favorite Python package manager:

# Using pip
pip install tuttifrutti

# Using uv
uv add tuttifrutti

Metadata

Release files for tuttifrutti 0.1.3

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

Source distribution (sdist)

Source distribution for tuttifrutti 0.1.3
File Size Uploaded Provenance Actions
tuttifrutti-0.1.3.tar.gz 3.3 kB Without provenance Details for tuttifrutti-0.1.3.tar.gz

Built distribution (wheel)

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

Total release size: 7.2 kB

Release files / tuttifrutti-0.1.3.tar.gz

Download URL tuttifrutti-0.1.3.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a54fd652ab032c963a2a081e1bf2dd01f2a1a1494cfb879ca78119d580e16ea2
BLAKE2b-256 checksum
How to use checksums
9eaa43a64976c990bfaadab8eba21ae940f1ec8dac6bd326a3c28e128acf23e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / tuttifrutti-0.1.3-py3-none-any.whl

Download URL tuttifrutti-0.1.3-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25d0f252483c39f7d6f91e8ed176477c94f9d3216651ef090fea852dd22397df
BLAKE2b-256 checksum
How to use checksums
06b2a4d057e25dfa7ae37014bce59db989391bdb0549568de674438843a5122d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for tuttifrutti 0.1.3

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