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.1.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.1.0
File Size Uploaded Provenance Actions
nematocyte-0.1.0.tar.gz 63.5 kB Without provenance Details for nematocyte-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 134.7 kB

Release files / nematocyte-0.1.0.tar.gz

Download URL nematocyte-0.1.0.tar.gz
Size 63.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4a72292156d5683c8887d0cccc14d495aeb82c9c9c14d682ee8e3476f3696853
BLAKE2b-256 checksum
How to use checksums
c72958f079b658a9c649d06de491132003049639d19695cd93fa7303c988fc80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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.1.0-py3-none-any.whl

Download URL nematocyte-0.1.0-py3-none-any.whl
Size 71.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3b4217f3003bfad98b42e1f3fe2d505d19704417ad5a0edd6f81483cf05f77f
BLAKE2b-256 checksum
How to use checksums
02526239821f0dbd9a406d9d99c27f2448f272ae180c8e7264d0cdaacfa43f40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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.1.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