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.
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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c25e4b936429f0cd0fbe5156ffceec12ef81010f62750cad23ca2a69cec301a7
|
|
| MD5 |
e4d0319974c0a9faac16ec2f40f84059
|
|
| BLAKE2b-256 |
b5b361e349c249f515da750fea7f257bdaa09c56584d1e4d60531c70615303b8
|
File details
Details for the file simple_elements-0.1.0-py3-none-any.whl.
File metadata
- Download URL: simple_elements-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fec9d722107c6930d8361ba6a8123f193839671bc01d878764b9d1552623af19
|
|
| MD5 |
7718c3117bd857531f4d9b91ce4fe192
|
|
| BLAKE2b-256 |
31ba7ad37338d83e818a49d48ab872ba97aa6ee14c853c6b1f04a9621839b5ec
|