esoi
Keep the best implementation of every part of your system in use, chosen by measurement.
esoi is the Python library and command for ESOI (Evolvable
Structure that Optimizes Intent). You declare what a part of your system is for, write alternative implementations of
it side by side, and measure them on the same cases. The library then runs the measured winner wherever that part is
called, so replacing an implementation changes no caller.
- Declare once, where the code is.
@solutionnames the interface and@implementationnames each alternative. - Measure and record.
esoi runscores an implementation on your cases and records the result with the commit and the cases it was measured on. - Select by the metric.
esoi leaderboardranks the alternatives,esoi select --promotemakes the leader the default, andesoi lockpins it for production. - Keep the structure sound.
esoi checkverifies the repository against its own records, andesoi hygienescans for secrets and private data before a public push.
Python 3.11 or later. The core has no dependencies. Apache-2.0.
Install
pip install esoi
pip install "esoi[sheets]" # with Google Sheets sync
A commit that is not released yet:
pip install "esoi @ git+https://github.com/JoshuaMathias/evolvable-structure.git@<commit>#subdirectory=implementations/python"
From a checkout: pip install -e implementations/python.
Quick start
from esoi import implementation, solution
@solution("greet-a-person") # declare once, where the code is
def greet(name: str) -> str: ...
@implementation("greet-a-person", "plain")
def plain(name: str) -> str:
return f"Hello, {name}!"
greet("Ada") # call: the project default, from the records
greet("Ada", using="plain") # or by name for one call
esoi init # scaffold a small example repository that already passes
esoi check # every rule; --strict also rejects results recorded on uncommitted code
esoi records sync # the records follow what the code declares
esoi run greet_a_person --impl plain --record # measure
esoi leaderboard
esoi select --promote # promote the winner of the solution's own metric
The full walk through is docs/how-to/apply-with-tools.md.
Modules
| Module | Role |
|---|---|
esoi.structure.intent_registry.config |
One esoi.toml (or [tool.esoi]) per repository |
esoi.structure.intent_registry.records, esoi.structure.intent_registry.registry, esoi.structure.intent_registry.tables |
Loading and checking the five record files |
esoi.structure.intent_registry.template_sync.template, esoi.structure.intent_registry.template_sync.templates |
Reading the intent template from SKILL.md and generating the non-code templates |
esoi.structure.structure_check.check, esoi.structure.structure_check.rules |
The rule runner and the built-in rule groups; a plugin interface for your own |
esoi.runtime.implementation_selection.declare |
Declare solutions and alternatives in code (@solution, @implementation, register) and run the selected one: per call, context, environment, deployment, then the records' default |
esoi.runtime.implementation_selection.selection_registry |
What the code declares: the registry of solutions and implementations by scope, SelectionError, add and forget |
esoi.runtime.implementation_selection.selection_cascade |
The selection cascade: which implementation a call would run, fetched when chosen, and the selection snapshot |
esoi.runtime.assemble_by_name.assemble |
Depend on other solutions by name: validated names, safe loading, needs from typed constructor parameters checked against uses_solution_ids, build in dependency order, fail at startup on a cycle or an unmet need (guide) |
esoi.optimization.keep_metric_record.spec_slice, esoi.optimization.keep_metric_record.metric_meter, esoi.optimization.keep_metric_record.metric_results, esoi.optimization.keep_metric_record.iteration |
Keep a metric's value before and after a piece of work: the slice of the specification a request serves, bounded readings by a recorded row or an offline arm that cannot spend money, measured and recorded rows that never overwrite each other, and MetricIteration to wire them |
esoi.structure.intent_registry.circumstances, esoi.runtime.implementation_selection.variants |
See a difference by circumstance: conditions on cases and on the run, name@key=value variants, derived slice rows and a per-case log; a slice verdict is a proposal, nothing is selected by it (guide) |
esoi.structure.intent_registry.template_sync.versioning |
The stamp of the skill and template the library follows, the template version, and recording it in a repository (esoi version, rule S34) |
esoi.runtime.implementation_selection.select |
The selection table and Selector, the lower layer; defaults may come from the records |
esoi.structure.intent_registry.specify_from_code.declarations, esoi.structure.intent_registry.specify_from_code.newsolution |
Read the declarations from the source, sync the records, start a new solution |
esoi.optimization.promote_the_winner.promote |
Switch the selected implementation to the winner of the solution's own metric, or propose it |
esoi.understanding.readable_records.readme |
The README of each intent folder, generated from its records |
esoi.understanding.readable_records.readme_view |
Shared facts and text helpers of the generated READMEs |
esoi.understanding.readable_records.readme_intent_page |
The README of an intent folder in each layout |
esoi.understanding.readable_records.readme_folder_page |
The README of a folder beside code: implemented-by listing and arm pages |
esoi.optimization.measurement_harness.run_component (with case_loading, arm_loading, call_meter, record_result, record_slices and the other one-job modules beside it), esoi.optimization.measurement_harness.expect, esoi.optimization.measurement_harness.hermetic |
Run an implementation over a component's cases and record it with provenance |
esoi.optimization.leaderboard (ranking, rival_decisions, verdict_labels, board_report, cascade_stages, stage_standings, cascade_report) |
Rank, call a verdict, mark baselines and ablations, run the cascade |
esoi.understanding.review_tracker.tracker, esoi.understanding.review_tracker.sheets |
The review sheet tabs and their two-way sync |
esoi.runtime.consumer_check.consumer |
Check a repository that builds on a library |
esoi.structure.structure_check.hygiene |
Secret and private-data scan, working tree and history |
esoi.understanding.the_standard.skill_distribution.skill |
Generate, check and install the public copy of the author's skill |
esoi.understanding.the_standard.scaffold, esoi.__main__, the commands module of each container |
esoi init and the command |
Reference: configuration, evaluation components, rules.
Using the table from your code (the advanced layer)
from esoi.runtime.implementation_selection.select import Selector
selector = Selector.from_config(config) # the table `selection` names; an entry without a "default" takes the records' `selected`
implementation = selector.resolve("greet", overrides={"greet": "loud"})
The decorators above and this table are one set of names; see Declare, call, measure, promote.
Tests
python -m pytest implementations/python/tests # from the repository root; offline, no network
tests/test_components.py runs this repository's own evaluation components, and tests/test_self.py checks the
repository against its own structure.
Metadata
Release files for esoi 0.6.0.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| esoi-0.6.0.post1.tar.gz | 897.7 kB | Without provenance | Details for esoi-0.6.0.post1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| esoi-0.6.0.post1-py3-none-any.whl | Python 3 | none | any | Details for esoi-0.6.0.post1-py3-none-any.whl |
Total release size: 1.8 MB
Release files / esoi-0.6.0.post1.tar.gz
| Download URL | esoi-0.6.0.post1.tar.gz |
|---|---|
| Size | 897.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d4065eab2db54590a1935b63a024ae55293d272c446905fec6104e1c54ff625f
|
|
BLAKE2b-256 checksum How to use checksums |
ef18a92d57152d41b0fb28d4d725b74b608cbc5bef585af26aeb057bd8c07235
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.7
|
Release files / esoi-0.6.0.post1-py3-none-any.whl
| Download URL | esoi-0.6.0.post1-py3-none-any.whl |
|---|---|
| Size | 878.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
701187179264aedffd3c66532acf643558cd645ba2cdf3ad6690fd7543887ca5
|
|
BLAKE2b-256 checksum How to use checksums |
7ecbd2417f1f236e87ee3c84ea97b2668d57f6d023fc6b34aa77c55ec67655a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.7
|
Security for esoi 0.6.0.post1
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.