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.3.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.3.0
File Size Uploaded Provenance Actions
nematocyte-0.3.0.tar.gz 66.9 kB Without provenance Details for nematocyte-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 141.4 kB

Release files / nematocyte-0.3.0.tar.gz

Download URL nematocyte-0.3.0.tar.gz
Size 66.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8a8f5e7be6e733bd75b6bed4744cca8e5635a7828706fb075ac81669d993f3e3
BLAKE2b-256 checksum
How to use checksums
77feb4c91bfd56180ebf8d0d7f3297a31c846f57b54e31bed02655ac2469b14a
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.3.0-py3-none-any.whl

Download URL nematocyte-0.3.0-py3-none-any.whl
Size 74.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e2829e670de6e225b54f8eeee4ddad19d68cb72de7bd1cbb657dbcf04c9dd6a
BLAKE2b-256 checksum
How to use checksums
96d2092112158529eae1acab667ede4af0c2e7489d14d244c68bd439913856fa
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.3.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