Skip to main content

Lightweight utilities and helpers shared across the simple-libs ecosystem.

Project description

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.

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

simple_elements-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

simple_elements-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file simple_elements-0.1.0.tar.gz.

File metadata

  • Download URL: simple_elements-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for simple_elements-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c25e4b936429f0cd0fbe5156ffceec12ef81010f62750cad23ca2a69cec301a7
MD5 e4d0319974c0a9faac16ec2f40f84059
BLAKE2b-256 b5b361e349c249f515da750fea7f257bdaa09c56584d1e4d60531c70615303b8

See more details on using hashes here.

File details

Details for the file simple_elements-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_elements-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fec9d722107c6930d8361ba6a8123f193839671bc01d878764b9d1552623af19
MD5 7718c3117bd857531f4d9b91ce4fe192
BLAKE2b-256 31ba7ad37338d83e818a49d48ab872ba97aa6ee14c853c6b1f04a9621839b5ec

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