☰ 🏠

Context

What this shows: The enforced initial project structure of Hydra Forge libraries.

  • Clear separation of runtime, dev, and docs environments
  • Deterministic native build locations
  • Structure optimized for long-term maintenance

Project structure

Hydra Forge libraries follow a strict, explicit project structure designed for long-lived scientific and engineering software.

Canonical generated structure

The structure below is taken directly from a Hydra Forge library immediately after successful generation and verification.

It represents the literal output of an inspection utility and is representative of all generated libraries with comparable feature sets.

This structure is not a template. It is enforced and verified mechanically on every build.

Each area has a single, well-defined responsibility.


Extract from:
(dev) C:\TestLibs\HydraForge_Windows11>python -m forge.structure

β”œβ”€β”€ .venv/                <- isolated environments
β”‚   β”œβ”€β”€ user-core-313/
β”‚   β”œβ”€β”€ dev-core-313/
β”‚   β”œβ”€β”€ docs-core-313/
β”‚   └── .venv_map.json
β”œβ”€β”€ docs/                 <- generated documentation
β”œβ”€β”€ forge/                <- CLI faΓ§ade
β”œβ”€β”€ hydra_forge/          <- embedded engine internals
β”œβ”€β”€ runtime/              <- embedded Python + toolchains
β”œβ”€β”€ src/package_name/     <- client library python code
β”‚   β”œβ”€β”€ _native/          <- native source, artifacts, manifests
β”‚   β”œβ”€β”€ io/               <- domain logic
β”‚   β”œβ”€β”€ hooks/            <- extension points
β”‚   └── portal/           <- Python gateway to compiled native artifacts
β”œβ”€β”€ tests/                <- verification & contracts
β”œβ”€β”€ pyproject.toml
└── README.md

Any deviation from this structure is detected during verification.


Engine layer: hydra_forge/

The hydra_forge/ directory contains the embedded Hydra Forge engine.


forge/        <- user-facing CLI faΓ§ade (namespace, smithery, tree, docs, doctor, structure)
hydra_forge/  <- engine internals (build, scan, verify, expose)

This avoids hidden tooling and reduces long-term dependency on opaque build systems.


Project layer: src/<package_name>/

The src/ directory contains only project-specific code.


β”œβ”€β”€ src//        <- client library code
β”‚   β”œβ”€β”€ _native/          <- native source, artifacts, manifests
β”‚   β”œβ”€β”€ io/               <- domain logic
β”‚   β”œβ”€β”€ hooks/            <- extension points
β”‚   └── portal/           <- Python gateway to compiled native artifacts
β”œβ”€β”€ _version.py

From a contributor’s perspective, this is a conventional, clean Python package β€” with native acceleration exposed explicitly rather than hidden behind build magic.


Native layer: _native/

Native code is treated as a first-class component.


_native/
β”œβ”€β”€ compiled/                 <- built binaries
β”‚   └── exposed/              <- public native API surface
β”‚       β”œβ”€β”€ flat/             <- default flat exposure (auto-generated)
β”‚       β”œβ”€β”€ io/               <- user-defined exposure
β”‚       └── exposed_api.json  <- explicit native exposure
β”œβ”€β”€ src/                      <- native source (C++ / Rust)
β”œβ”€β”€ portal/                   <- link to Python-visible interface
β”œβ”€β”€ native_build_map.json
β”œβ”€β”€ native_categories.json
β”œβ”€β”€ native_compilation.json
└── version.json

Parity between source, artifacts, and Python exposure is enforced.

The portal interface is generated from the native exposure manifest and reflects the exact set of functions defined in exposed_api.json.


Documentation layer: docs/

Documentation is generated from deterministic Python inventory scanning and explicit native API manifests, then rendered by Sphinx.


docs/
β”œβ”€β”€ build/
β”œβ”€β”€ source/
β”‚   β”œβ”€β”€ _static/
β”‚   β”‚   └── hydra_theme.css
β”‚   β”œβ”€β”€ python/
β”‚   β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”‚   └── native_reader_hooks.rst
β”‚   β”‚   β”œβ”€β”€ io/
β”‚   β”‚   β”‚   └── native_readers.rst
β”‚   β”‚   β”œβ”€β”€ hooks.rst
β”‚   β”‚   β”œβ”€β”€ index.rst
β”‚   β”‚   └── io.rst
β”‚   β”œβ”€β”€ conf.py
β”‚   β”œβ”€β”€ forge.rst
β”‚   β”œβ”€β”€ hydra_forge_engine.rst
β”‚   β”œβ”€β”€ index.rst
β”‚   └── portal.rst
└── MakeFile				<- Generated for sphinx

Verification layer: tests/

Verification is part of the system, not an optional step.


tests/
β”œβ”€β”€ hooks/
β”œβ”€β”€ hydra_forge/
β”œβ”€β”€ io/
└── conftest.py

Environment layer: .venv/

Hydra Forge uses explicit, isolated Python environments:


.venv/
β”œβ”€β”€ user-core-313/
β”œβ”€β”€ dev-core-313/
β”œβ”€β”€ docs-core-313/
└── .venv_map.json

Environment names encode role, profile, and Python version. For example, dev-core-313 means development environment, core profile, CPython 3.13.


Contributor perspective


What this structure optimizes for

It does not optimize for minimal file count or ad-hoc experimentation.


Summary

The Hydra Forge project structure encodes engineering decisions directly into the filesystem, enabling safe evolution without tribal knowledge.

See this structure being generated live