Metadata-Version: 2.4
Name: omlish
Version: 0.0.0.dev398
Summary: omlish
Author: wrmsr
License-Expression: BSD-3-Clause
Project-URL: source, https://github.com/wrmsr/omlish
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: all
Requires-Dist: anyio~=4.10; extra == "all"
Requires-Dist: sniffio~=1.3; extra == "all"
Requires-Dist: greenlet~=3.2; extra == "all"
Requires-Dist: trio~=0.30; extra == "all"
Requires-Dist: trio-asyncio~=0.15; extra == "all"
Requires-Dist: lz4~=4.4; extra == "all"
Requires-Dist: python-snappy~=0.7; extra == "all"
Requires-Dist: zstandard~=0.23; extra == "all"
Requires-Dist: brotli~=1.1; extra == "all"
Requires-Dist: asttokens~=3.0; extra == "all"
Requires-Dist: executing~=2.2; extra == "all"
Requires-Dist: psutil~=7.0; extra == "all"
Requires-Dist: orjson~=3.11; extra == "all"
Requires-Dist: ujson~=5.10; extra == "all"
Requires-Dist: pyyaml~=6.0; extra == "all"
Requires-Dist: cbor2~=5.7; extra == "all"
Requires-Dist: cloudpickle~=3.1; extra == "all"
Requires-Dist: httpx[http2]~=0.28; extra == "all"
Requires-Dist: wrapt~=1.17; extra == "all"
Requires-Dist: cryptography~=45.0; extra == "all"
Requires-Dist: sqlalchemy[asyncio]~=2.0; extra == "all"
Requires-Dist: pg8000~=1.31; extra == "all"
Requires-Dist: pymysql~=1.1; extra == "all"
Requires-Dist: aiomysql~=0.2; extra == "all"
Requires-Dist: aiosqlite~=0.21; extra == "all"
Requires-Dist: asyncpg~=0.30; extra == "all"
Requires-Dist: apsw~=3.50; extra == "all"
Requires-Dist: sqlean.py~=3.49; extra == "all"
Requires-Dist: duckdb~=1.3; extra == "all"
Requires-Dist: markupsafe~=3.0; extra == "all"
Requires-Dist: jinja2~=3.1; extra == "all"
Requires-Dist: pytest~=8.4; extra == "all"
Requires-Dist: anyio~=4.10; extra == "all"
Requires-Dist: sniffio~=1.3; extra == "all"
Requires-Dist: asttokens~=3.0; extra == "all"
Requires-Dist: executing~=2.2; extra == "all"
Requires-Dist: orjson~=3.11; extra == "all"
Requires-Dist: pyyaml~=6.0; extra == "all"
Requires-Dist: wrapt~=1.17; extra == "all"
Provides-Extra: async
Requires-Dist: anyio~=4.10; extra == "async"
Requires-Dist: sniffio~=1.3; extra == "async"
Requires-Dist: greenlet~=3.2; extra == "async"
Requires-Dist: trio~=0.30; extra == "async"
Requires-Dist: trio-asyncio~=0.15; extra == "async"
Provides-Extra: compress
Requires-Dist: lz4~=4.4; extra == "compress"
Requires-Dist: python-snappy~=0.7; extra == "compress"
Requires-Dist: zstandard~=0.23; extra == "compress"
Requires-Dist: brotli~=1.1; extra == "compress"
Provides-Extra: diag
Requires-Dist: asttokens~=3.0; extra == "diag"
Requires-Dist: executing~=2.2; extra == "diag"
Requires-Dist: psutil~=7.0; extra == "diag"
Provides-Extra: formats
Requires-Dist: orjson~=3.11; extra == "formats"
Requires-Dist: ujson~=5.10; extra == "formats"
Requires-Dist: pyyaml~=6.0; extra == "formats"
Requires-Dist: cbor2~=5.7; extra == "formats"
Requires-Dist: cloudpickle~=3.1; extra == "formats"
Provides-Extra: http
Requires-Dist: httpx[http2]~=0.28; extra == "http"
Provides-Extra: misc
Requires-Dist: wrapt~=1.17; extra == "misc"
Provides-Extra: secrets
Requires-Dist: cryptography~=45.0; extra == "secrets"
Provides-Extra: sqlalchemy
Requires-Dist: sqlalchemy[asyncio]~=2.0; extra == "sqlalchemy"
Provides-Extra: sqldrivers
Requires-Dist: pg8000~=1.31; extra == "sqldrivers"
Requires-Dist: pymysql~=1.1; extra == "sqldrivers"
Requires-Dist: aiomysql~=0.2; extra == "sqldrivers"
Requires-Dist: aiosqlite~=0.21; extra == "sqldrivers"
Requires-Dist: asyncpg~=0.30; extra == "sqldrivers"
Requires-Dist: apsw~=3.50; extra == "sqldrivers"
Requires-Dist: sqlean.py~=3.49; extra == "sqldrivers"
Requires-Dist: duckdb~=1.3; extra == "sqldrivers"
Provides-Extra: templates
Requires-Dist: markupsafe~=3.0; extra == "templates"
Requires-Dist: jinja2~=3.1; extra == "templates"
Provides-Extra: testing
Requires-Dist: pytest~=8.4; extra == "testing"
Provides-Extra: plus
Requires-Dist: anyio~=4.10; extra == "plus"
Requires-Dist: sniffio~=1.3; extra == "plus"
Requires-Dist: asttokens~=3.0; extra == "plus"
Requires-Dist: executing~=2.2; extra == "plus"
Requires-Dist: orjson~=3.11; extra == "plus"
Requires-Dist: pyyaml~=6.0; extra == "plus"
Requires-Dist: wrapt~=1.17; extra == "plus"
Dynamic: license-file

# Overview

Core utilities and foundational code. It's relatively large but completely self-contained.

# Notable packages

- **[lang](https://github.com/wrmsr/omlish/blob/master/omlish/lang)** - The standard library of this standard library.
  Usually imported as a whole (`from omlish import lang`), it contains an array of general purpose utilities used
  practically everywhere. It is kept relatively lightweight: its heaviest import is stdlib dataclasses and its
  transitives. Some of its contents include:

  - **[cached](https://github.com/wrmsr/omlish/blob/master/omlish/lang/cached)** - The standard `cached_function` /
    `cached_property` tools, which are more capable than
    [`functools.lru_cache`](https://docs.python.org/3/library/functools.html#functools.lru_cache).
  - **[imports](https://github.com/wrmsr/omlish/blob/master/omlish/lang/imports.py)** - Import tools like `proxy_import`
    for late-loaded imports and `proxy_init` for late-loaded module globals.
  - **[classes](https://github.com/wrmsr/omlish/blob/master/omlish/lang/classes)** - Class tools and bases, such as
    `Abstract` (which checks at subclass definition not instantiation), `Sealed` / `PackageSealed`, and `Final`.
  - **[maybes](https://github.com/wrmsr/omlish/blob/master/omlish/lite/maybes.py)** - A simple, nestable formalization
    of the presence or absence of an object, as in [many](https://en.cppreference.com/w/cpp/utility/optional)
    [other](https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html)
    [languages](https://doc.rust-lang.org/std/option/).

- **[bootstrap](https://github.com/wrmsr/omlish/blob/master/omlish/bootstrap)** - A centralized, configurable,
  all-in-one collection of various process-initialization minutiae like resource limiting, profiling, remote debugging,
  log configuration, environment variables, et cetera. Usable as a context manager or via its
  [cli](https://github.com/wrmsr/omlish/blob/master/omlish/bootstrap/main.py).

- **[collections](https://github.com/wrmsr/omlish/blob/master/omlish/collections)** - A handful of collection utilities
  and simple implementations, including:

  - **[cache](https://github.com/wrmsr/omlish/blob/master/omlish/collections/cache)** - A configurable LRU / LFU cache
    with options like ttl and  max size / weight.
  - **[hasheq](https://github.com/wrmsr/omlish/blob/master/omlish/collections/hasheq.py)** - A dict taking an external
    `__hash__` / `__eq__` implementation.
  - **[identity](https://github.com/wrmsr/omlish/blob/master/omlish/collections/identity.py)** - Identity-keyed
    collections.
  - **[sorted](https://github.com/wrmsr/omlish/blob/master/omlish/collections/sorted)** - Interfaces for value-sorted
    collections and key-sorted mappings, and a simple but - correct skiplist-backed implementation.
  - **[persistent](https://github.com/wrmsr/omlish/blob/master/omlish/collections/persistent)** - Interfaces for
    [persistent](https://en.wikipedia.org/wiki/Persistent_data_structure) maps, and a simple but correct treap-backed
    implementation.

- **[dataclasses](https://github.com/wrmsr/omlish/blob/master/omlish/dataclasses)** - A fully-compatible
  reimplementation of stdlib [dataclasses](https://docs.python.org/3/library/dataclasses.html) with numerous
  enhancements and additional features. The
  [full stdlib test suite](https://github.com/wrmsr/omlish/blob/master/omlish/dataclasses/tests/cpython) is run against
  it ensuring compatibility - they *are* dataclasses. Current enhancements include:

  - Simple field coercion and validation.
  - Any number of `@dc.init` or `@dc.validate` methods, not just a central `__post_init__`.
  - Optional generic type parameter substitution in generated `__init__` methods, enabling accurate reflection.
  - An optional [metaclass](https://github.com/wrmsr/omlish/blob/master/omlish/dataclasses/metaclass) which removes the
    need for re-decorating subclasses (with support for inheritance of dataclass parameters like `frozen`), and some
    basic [base classes](https://github.com/wrmsr/omlish/blob/master/omlish/dataclasses/metaclass/bases.py).
  - (Nearly finished) support for ahead-of-time / build-time code generation, greatly reducing import times.

  The stdlib-equivalent api is exported in such a way as to appear to be direct aliases for the stdlib api itself,
  simplifying tool support.

- **[dispatch](https://github.com/wrmsr/omlish/blob/master/omlish/dispatch)** - A beefed-up version of
  [functools.singledispatch](https://docs.python.org/3/library/functools.html#functools.singledispatch), most notably
  supporting MRO-honoring method impl dispatch.

- **[formats](https://github.com/wrmsr/omlish/blob/master/omlish/formats)** - Tools for various data formats, including:

  - **[json](https://github.com/wrmsr/omlish/blob/master/omlish/formats/json)** - Tools for json, including abstraction
    over various backends and a self-contained streaming / incremental parser.
  - **[json5](https://github.com/wrmsr/omlish/blob/master/omlish/formats/json5)** - A self-contained and tested
    [Json5](https://json5.org/) parser.
  - **[toml](https://github.com/wrmsr/omlish/blob/master/omlish/formats/toml)** - Toml tools, including a
    [lite](#lite-code) version of the stdlib parser (for use in older pythons).

- **[http](https://github.com/wrmsr/omlish/blob/master/omlish/http)** - HTTP code, including:

  - **[clients](https://github.com/wrmsr/omlish/blob/master/omlish/http/clients)** - An abstraction over HTTP clients,
    with urllib and httpx implementations.
  - **[coro](https://github.com/wrmsr/omlish/blob/master/omlish/http/coro)** - Coroutine /
    [sans-io](https://sans-io.readthedocs.io/) style reformulation of some stdlib http machinery - namely `http.server`
    (and soon `http.client`). This style of code can run the same in sync, async, or
    [any](https://docs.python.org/3/library/selectors.html)
    [other](https://github.com/wrmsr/omlish/blob/master/omlish/asyncs/bluelet) context.

- **[inject](https://github.com/wrmsr/omlish/blob/master/omlish/inject)** - A
  [guice](https://github.com/google/guice)-style dependency injector.

- **[io](https://github.com/wrmsr/omlish/blob/master/omlish/io)** - IO tools, including:

  - **[compress](https://github.com/wrmsr/omlish/blob/master/omlish/io/compress)** - Abstraction over various
    compression schemes, with particular attention to incremental operation. For example it includes
    [an incremental reformulation of stdlib's gzip](https://github.com/wrmsr/omlish/blob/master/omlish/io/compress/gzip.py).
  - **[coro](https://github.com/wrmsr/omlish/blob/master/omlish/io/coro)** - Utilities for coroutine / sans-io style
    code.
  - **[fdio](https://github.com/wrmsr/omlish/blob/master/omlish/io/fdio)** - An implementation of classic
    [selector](https://docs.python.org/3/library/selectors.html)-style IO dispatch, akin to the deprecated
    [asyncore](https://docs.python.org/3.11/library/asyncore.html). While more modern asyncio style code is generally
    preferred, it nearly always involves
    [background threads](https://github.com/python/cpython/blob/95d9dea1c4ed1b1de80074b74301cee0b38d5541/Lib/asyncio/unix_events.py#L1349)
    making it [unsuitable for forking processes](https://rachelbythebay.com/w/2011/06/07/forked/) like
    [process supervisors](https://github.com/wrmsr/omlish/blob/master/ominfra/supervisor).

- **[jmespath](https://github.com/wrmsr/omlish/blob/master/omlish/specs/jmespath)** - A vendoring of
  [jmespath community edition](https://github.com/jmespath-community/python-jmespath), modernized and adapted to this
  codebase.

- **[marshal](https://github.com/wrmsr/omlish/blob/master/omlish/marshal)** - A
  [jackson](https://github.com/FasterXML/jackson)-style serde system.

- **[manifests](https://github.com/wrmsr/omlish/blob/master/omlish/manifests)** - A system for sharing lightweight
  metadata within / across codebases.

- **[reflect](https://github.com/wrmsr/omlish/blob/master/omlish/reflect)** - Reflection utilities, including primarily
  a formalization of stdlib type annotations for use at runtime, decoupled from stdlib impl detail. Keeping this working
  is notoriously difficult across python versions (one of the primary reasons for only supporting 3.13+).

- **[sql](https://github.com/wrmsr/omlish/blob/master/omlish/sql)** - A collection of SQL utilities, including:

  - **[alchemy](https://github.com/wrmsr/omlish/blob/master/omlish/sql/alchemy)** - SQLAlchemy utilities. The codebase
    is moving away from SQLAlchemy however in favor of its own internal SQL api.
  - **[api](https://github.com/wrmsr/omlish/blob/master/omlish/sql/api)** - An abstracted api for SQL interaction, with
    support for dbapi compatible drivers (and a SQLAlchemy adapter).
  - **[queries](https://github.com/wrmsr/omlish/blob/master/omlish/sql/queries)** - A SQL query builder with a fluent
    interface.

- **[testing](https://github.com/wrmsr/omlish/blob/master/omlish/testing)** - Test - primarily pytest - helpers,
  including:

  - **['harness'](https://github.com/wrmsr/omlish/blob/master/omlish/testing/pytest/inject/harness.py)** - An all-in-one
    fixture marrying it to the codebase's dependency injector.
  - **[plugins/async](https://github.com/wrmsr/omlish/blob/master/omlish/testing/pytest/plugins/asyncs)** - An in-house
    async-backend abstraction plugin, capable of handling all of asyncio / trio / trio-asyncio /
    *any-future-event-loop-impl* without having multiple fighting plugins (*[I know, I know](https://xkcd.com/927/)*).
  - **[plugins](https://github.com/wrmsr/omlish/blob/master/omlish/testing/pytest/plugins)** - Various other plugins.

- **[lite](https://github.com/wrmsr/omlish/blob/master/omlish/lite)** - The standard library of 'lite' code. This is the
  only package beneath `lang`, and parts of it are re-exported by it for deduplication. On top of miscellaneous
  utilities it contains a handful of independent, self-contained, significantly simplified 'lite' equivalents of some
  major core packages:

  - **[lite/inject.py](https://github.com/wrmsr/omlish/blob/master/omlish/lite/inject.py)** - The lite injector, which
    is more conservative with features and reflection than the core injector. The codebase's
    [MiniGuice](https://github.com/google/guice/commit/70248eafa90cd70a68b293763e53f6aec656e73c).
  - **[lite/marshal.py](https://github.com/wrmsr/omlish/blob/master/omlish/lite/marshal.py)** - The lite marshalling
    system, which is a classic canned setup of simple type-specific 2-method classes and limited generic handling.

# Lite code

A subset of this codebase is written in a 'lite' style (non-'lite' code is referred to as *standard* code). While
standard code is written for python 3.13+, 'lite' code is written for 3.8+, and is written in a style conducive to
[amalgamation](https://github.com/wrmsr/omlish/blob/master/omdev#amalgamation) in which multiple python source files are
stitched together into one single self-contained python script.

Code written in this style has notable differences from standard code, including (but not limited to):

- No name mangling is done in amalgamation, which means (among other things) that code must be written expecting to be
  all dumped into the same giant namespace. Where a standard class might be
  [`omlish.inject.keys.Key`](https://github.com/wrmsr/omlish/blob/master/omlish/inject/keys.py), a lite equivalent might
  be [`omlish.lite.inject.InjectorKey`](https://github.com/wrmsr/omlish/blob/master/omlish/lite/inject.py).
- All internal imports `import` each individual item out of modules rather than importing the modules and referencing
  their contents. Where standard code would `from .. import x; x.y`, lite code would `from ..x import y; y`. As a result
  there are frequently 'api' non-instantiated namespace classes serving the purpose of modules - just handy bags of
  stuff with shortened names.
- As lite code is tested in 3.8+ but core code requires 3.13+, packages containing lite code can't import anything
  standard in their (and their ancestors') `__init__.py`'s. Furthermore, `__init__.py` files are omitted outright in
  amalgamation, so they effectively must be empty in any package containing any lite code. As a result there are
  frequently [`all.py`](https://github.com/wrmsr/omlish/blob/master/omlish/configs/all.py) files in mixed-lite packages
  which serve the purpose of `__init__.py` for standard usage - where importing standard packages from standard code
  would be done via `from .. import lang`, importing mixed-lite packages from standard code would be done via
  `from ..configs import all as cfgs`.

# Dependencies

This library has no required dependencies of any kind, but there are numerous optional integrations - see
[`__about__.py`](https://github.com/wrmsr/omlish/blob/master/omlish/__about__.py) for a full list, but some specific
examples are:

- **anyio** - While lite code must use only asyncio, non-trivial async standard code prefers to be written to anyio.
- **pytest** - What is used for all standard testing - as lite code has no dependencies of any kind its testing uses
  stdlib's [unittest](https://docs.python.org/3/library/unittest.html).
- **asttokens / executing** - For getting runtime source representations of function call arguments, an optional
  capability of [check](https://github.com/wrmsr/omlish/blob/master/omlish/check.py).
- **wrapt** - For (optionally-enabled) injector circular proxies.
- **greenlet** - For some gnarly stuff like the
  [sync<->async bridge](https://github.com/wrmsr/omlish/blob/master/omlish/asyncs/bridge.py) and the
  [io trampoline](https://github.com/wrmsr/omlish/blob/master/omlish/io/trampoline.py).
- **sqlalchemy** - Parts of the codebase use SQLAlchemy for db stuff, but it is being migrated away from in favor of the
  internal api. It will however likely still remain as an optional dep for the api adapter.

Additionally, some catchall dep categories include:

- **compression** - Various preferred compression backends like lz4, python-snappy, zstandard, and brotli.
- **formats** - Various preferred data format backends like orjson/ujson, pyyaml, cbor2, and cloudpickle.
- **sql drivers** - Various preferred and tested sql drivers.
