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.1

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

Built distribution (wheel)

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

Total release size: 160.0 kB

Release files / nematocyte-0.4.1.tar.gz

Download URL nematocyte-0.4.1.tar.gz
Size 75.7 kB
Tags Source
SHA-256 checksum
How to use checksums
59f47a38a0236eed655a41f8c4d83e7dbe5ccd964564517ad6e0eeb55d60e98e
BLAKE2b-256 checksum
How to use checksums
81b6c19ae82a11b166806818c05d6beee9b901c0de3468430671e297509a744c
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.1-py3-none-any.whl

Download URL nematocyte-0.4.1-py3-none-any.whl
Size 84.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1407a450a53490a22c99b2ab42c3464bb9a15a3395a5e57fde3feb85d1ab2f79
BLAKE2b-256 checksum
How to use checksums
a6fe299fd580aab0d76ede5383c30e75adf55124420b4fc697e863f814fabd03
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.1

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