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.2.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.2.0
File Size Uploaded Provenance Actions
nematocyte-0.2.0.tar.gz 67.8 kB Without provenance Details for nematocyte-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 143.5 kB

Release files / nematocyte-0.2.0.tar.gz

Download URL nematocyte-0.2.0.tar.gz
Size 67.8 kB
Tags Source
SHA-256 checksum
How to use checksums
353b9ba6801039aca1c32062bfaf911e776114949154c0981470dbfd68bc4ee1
BLAKE2b-256 checksum
How to use checksums
9c5dea3d82789ea6f518bd1cfe850fde1d74ee80397ce6ef19af89c53977c84c
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.2.0-py3-none-any.whl

Download URL nematocyte-0.2.0-py3-none-any.whl
Size 75.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80c984cf0d0e4b617c3775abd41c1559a69647ca8cc65f06d73e39f96ddc8514
BLAKE2b-256 checksum
How to use checksums
774010ac67dc6129defedb2bbb08c46f9f26ddeb6b5c2e83ede0a2f746aa0be4
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.2.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