Skip to main content

nematocyte

A configuration library for Python programs: a replacement for Hydra with fewer features and more focus on usability. The config is a tree of stdlib dataclasses (or TypedDicts), filled from YAML (or JSON5) files and command-line overrides.

from dataclasses import dataclass, field
from typing import Annotated

from pydantic import Discriminator, Tag

import nematocyte


@dataclass(kw_only=True)
class Fcn:
    """Fully-connected network."""

    num_hidden: int = field(default=1, doc="Number of hidden layers.")


@dataclass(kw_only=True)
class Cnn:
    """Convolutional network."""

    kernel_size: int = field(default=5, doc="Kernel size of the convolutions.")


@dataclass(kw_only=True)
class Config:
    """Train a model."""

    model: Annotated[
        Annotated[Fcn, Tag("fcn")] | Annotated[Cnn, Tag("cnn")],
        Discriminator(nematocyte.pick),
    ] = field(default_factory=Fcn, doc="The model architecture.")
    seed: int = field(default=42, doc="Random seed.")


@nematocyte.main(Config, config_path="configs")
def main(config: Config) -> None:
    print(config)


if __name__ == "__main__":
    main()
python main.py model=cnn model.kernel_size=3 seed=1
python main.py --help
python main.py --multirun seed=1,2,3
  • example/ is a complete project with an annotated README.
  • design/ holds the design documents, which are the specification.
  • DIFFERENCES.md lists what works differently from Hydra, for someone who knows it.

Installing

nematocyte needs Python 3.14 or later.

uv add nematocyte
uv add 'nematocyte[submitit]'  # for the SLURM launcher
uv add 'nematocyte[optuna]'  # for the Optuna sweeper
uv add 'nematocyte[json5]'  # for config files in JSON5

Developing

uv run ruff check
uv run ruff format --check
uv run ty check
uv run pytest

Metadata

Release files for nematocyte 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nematocyte 0.4.0
File Size Uploaded Provenance Actions
nematocyte-0.4.0.tar.gz 70.6 kB Without provenance Details for nematocyte-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nematocyte 0.4.0
File Interpreter ABI Platform Actions
nematocyte-0.4.0-py3-none-any.whl Python 3 none any Details for nematocyte-0.4.0-py3-none-any.whl

Total release size: 149.1 kB

Release files / nematocyte-0.4.0.tar.gz

Download URL nematocyte-0.4.0.tar.gz
Size 70.6 kB
Tags Source
SHA-256 checksum
How to use checksums
13d05f4803f900024bbb48bc0b9493eba400b7632ad36d689f914d6774c40f98
BLAKE2b-256 checksum
How to use checksums
dd9aa06122df0788eabdfc1d5d411b64b6768e23e04b34d57687c96c5c4a9fb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / nematocyte-0.4.0-py3-none-any.whl

Download URL nematocyte-0.4.0-py3-none-any.whl
Size 78.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96cb96bad55cf4011f250e04f9721b9970db4cd3bf1e6308f1397b1f4cea2ec7
BLAKE2b-256 checksum
How to use checksums
bc26e7b1d3ad18c773d13f55cd40b41a3125fd0a6e377310c9810517792620e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for nematocyte 0.4.0

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.

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