Skip to main content

Ruthless Efficiency

CI PyPI Python License: MIT

"Our chief weapons are Ruthless Efficiency! …and warm-start caching."

A general optimisation/search substrate: a pure hexagonal core + pluggable search strategies (random built-in; evolve, optuna via extras) + pluggable compute backends.

hero

Status

0.x — ports are still being validated against real consumers; the API may change until 1.0.

Prerequisites

Install

  • pip install ruthless-efficiency — core + random strategy
  • pip install "ruthless-efficiency[optuna]" — + Optuna strategy (resumable Bayesian/sampler calibration)
  • pip install "ruthless-efficiency[evolve]" — + evolve strategy (our orchestration over OpenEvolve)
  • pip install "ruthless-efficiency[backends]" — + SSH / HF-Jobs / Docker compute backends

Quick start

An Objective is the only thing you must implement: any class with an evaluate(candidate) method that returns a dict[str, float] of metrics satisfies the Objective protocol (duck-typed — no base class to inherit). Hand it to a strategy with a backend:

from ruthless import Candidate, InProcessBackend, RandomConfig, RandomSearchStrategy


class Quadratic:
    def evaluate(self, candidate: Candidate) -> dict[str, float]:
        return {"loss": (candidate.params["x"] - 3.0) ** 2}


cfg = RandomConfig.model_validate(
    {
        "kind": "random",
        "metric": "loss",
        "direction": "minimize",
        "n_trials": 200,
        "param_space": {"x": {"kind": "float", "lo": -10.0, "hi": 10.0}},
    }
)
result = RandomSearchStrategy(cfg, seed=42).run(Quadratic(), backend=InProcessBackend())
print(result.best.candidate.params, result.best.metrics)

Expected output (search converges on x = 3, where loss is minimised; exact for seed 42):

{'x': 2.9969320310963994} {'loss': 9.412433193460362e-06}

Or drive it from a YAML config via the CLI:

ruthless --config search.yaml --objective my_package.objectives:my_objective

Architecture

A pure hexagonal core (ruthless/) defines the ports (Objective, SearchStrategy, ComputeBackend) and value types; strategies and backends depend on the core, never the reverse (enforced by import-linter). For contributor-level detail see CONTRIBUTING.md.

To explore the C4 diagrams (System Context, Containers, and Core Components), download docs/c4/architecture.html and open it in a browser — GitHub does not render HTML files inline.

Learn more

  • CHANGELOG.md — versioned history of what changed
  • Strategies: RandomSearchStrategy (core), OptunaStrategy ([optuna]), EvolveStrategy ([evolve])
  • Compute backends ([backends]): build one with ruthless.backends.create_backend(...)

Contributing & community

  • CONTRIBUTING.md — dev setup and the local quality gate (mirrors CI).
  • CODE_OF_CONDUCT.md — Contributor Covenant.
  • SECURITY.md — how to report a vulnerability and the security surface.
  • NOTICE — third-party licenses and methodological references.

License

MIT © 2026 Karsten S. Nielsen

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ruthless_efficiency-0.3.1.tar.gz (877.2 kB view details)

Uploaded Source

Built Distribution

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

ruthless_efficiency-0.3.1-py3-none-any.whl (69.2 kB view details)

Uploaded Python 3

File details

Details for the file ruthless_efficiency-0.3.1.tar.gz.

File metadata

  • Download URL: ruthless_efficiency-0.3.1.tar.gz
  • Upload date:
  • Size: 877.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for ruthless_efficiency-0.3.1.tar.gz
Algorithm Hash digest
SHA256 4d3932bd4110d1281f96a91be1ebc40fac0cf4ceb129a4dbf1b5f1b28b64f8b3
MD5 a405b1ce833125fac6f4dcb6987828ab
BLAKE2b-256 f34cda3d3ba3e4593e950b89a909887ae2da75e6671d61e1ba3c9119a9712d84

See more details on using hashes here.

Provenance

The following attestation bundles were made for ruthless_efficiency-0.3.1.tar.gz:

Publisher: publish.yml on karsten-s-nielsen/ruthless-efficiency

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ruthless_efficiency-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ruthless_efficiency-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4ca605a862f7225f8195b9c5d03ce17d29ff56be3d4d4c3a068d27d9f14273b1
MD5 6b93683b3eb0c7141891f8b1f91ce2fe
BLAKE2b-256 cf5658475d09cd538d6610f80740555e262f38c12b95f105eacf43cc4c7461ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for ruthless_efficiency-0.3.1-py3-none-any.whl:

Publisher: publish.yml on karsten-s-nielsen/ruthless-efficiency

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.5.0

2 files

0.4.0

2 files

This release

0.3.1 This release

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 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