Skip to main content

simple-elements

Lightweight utilities and helpers shared across the simple-libs ecosystem — each one self-contained and usable independently in any Python project.

Python Licence PyPI


Contents


Installation

pip install simple-elements

Sentinels

UNSET and UnsetType

A sentinel for distinguishing an unset value from an intentionally passed None — because None is a valid Python value with its own meaning. Evaluates as False in a boolean context:

from simple_elements import UNSET, UnsetType

def connect(host: str, timeout: int | UnsetType = UNSET):
    if timeout is UNSET:
        timeout = get_default_timeout()  # not provided → use default
    elif timeout is None:
        timeout = 0                      # None passed intentionally → no timeout

if not UNSET:
    print("UNSET is falsy ✓")            # True — bool(UNSET) == False

Comparison must always use is, never ==:

value is UNSET      # ✓ correct
value == UNSET      # ✗ never do this

About the Simple ecosystem

simple-elements is part of the Simple ecosystem — a collection of small, self-contained Python libraries. Each one solves exactly one thing — but all of them share a common philosophy:

Dyslexia-friendly — minimise mental load. Atomise code into self-contained units, name files after the logic they contain, write explanations that describe why — not just what.

Programmer's zen — nothing should be missing and nothing should be superfluous. The journey is the destination: code should be fully understood; better to go slowly and correctly than quickly and with mistakes. The crystallisation approach — not perfection on the first try, but gradual refinement towards it.

Defensive style — anticipate all possible failure modes so that only safe paths remain. Never raise unexpected errors; degrade gracefully.

Minimalism — find the path to the goal in as few steps as possible, but leave nothing out. Each file has one responsibility.

Code as craft — code should be pleasant to look at and evoke a sense of harmony. Treat code as a small work of art — like a carpenter carving a sculpture. Optimise for the user: everything should make sense without having to study the documentation at length.

These are aspirations — a sense of direction. And that is exactly what the note about the journey becoming the destination is all about. 🙂


The library is covered by tests across all modules. Tests are part of the repository and serve as living documentation of the expected behaviour.

Release files for simple-elements 0.1.0

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

Source distribution (sdist)

Source distribution for simple-elements 0.1.0
File Size Uploaded
simple_elements-0.1.0.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simple-elements 0.1.0
File Interpreter ABI Platform
simple_elements-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / simple_elements-0.1.0.tar.gz

Download URL simple_elements-0.1.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c25e4b936429f0cd0fbe5156ffceec12ef81010f62750cad23ca2a69cec301a7
BLAKE2b-256 checksum
How to use checksums
b5b361e349c249f515da750fea7f257bdaa09c56584d1e4d60531c70615303b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / simple_elements-0.1.0-py3-none-any.whl

Download URL simple_elements-0.1.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fec9d722107c6930d8361ba6a8123f193839671bc01d878764b9d1552623af19
BLAKE2b-256 checksum
How to use checksums
31ba7ad37338d83e818a49d48ab872ba97aa6ee14c853c6b1f04a9621839b5ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.1.0 This release

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