Multi-project discovery, validation, and metadata extraction
Location: infrastructure/project/
Quick Reference: Modules Guide | API Reference
- Project Discovery: Finds valid projects under
projects/by applying the same structure validator used by the pipeline - Structure Validation: Verifies required
src/andtests/directories;src/must contain Python files.scripts/andmanuscript/are optional but expected for normal pipeline/rendering workflows. - Metadata Extraction: Reads project configuration (title, authors, DOI, testing thresholds)
- Multi-Project Support: Enables N independent projects within a single repository
- Local CodeGraph Helpers: Builds optional CodeGraph commands and verifies template-root indexes do not include private project paths
from pathlib import Path
from infrastructure.project import discover_projects
# Discover all projects under projects/
projects = discover_projects(Path("."))
for project in projects:
print(f"{project.name}: {project.path}")from pathlib import Path
from infrastructure.project import validate_project_structure
is_valid, message = validate_project_structure(Path("projects/templates/template_code_project"))
if is_valid:
print("Project structure is valid")
else:
print(f"Issue: {message}")from pathlib import Path
from infrastructure.project import get_project_metadata
metadata = get_project_metadata(Path("projects/templates/template_code_project"))
print(f"Title: {metadata.title}")
print(f"Authors: {metadata.authors}")from pathlib import Path
from infrastructure.project import build_codegraph_init_command
command = build_codegraph_init_command(Path("."))
print(command.display)Use the runbook in
docs/guides/codegraph-local.md before
initializing indexes in a checkout with private symlinked projects.
A directory is a valid project if and only if:
- It exists as a subdirectory of
projects/ - It does not start with
_or. - It contains
src/with at least one Python file - It contains
tests/
Projects in projects/working/ and projects/archive/ are not discovered.
manuscript/config.yaml is still required for rendering metadata and normal
project workflows, but it is not the low-level discovery predicate.
| Symbol | Type | Purpose |
|---|---|---|
ProjectInfo |
Dataclass | Project metadata container |
discover_projects |
Function | Find all valid projects |
build_codegraph_init_command |
Function | Build local CodeGraph init command |
verify_codegraph_scope_payload |
Function | Check CodeGraph files JSON for private project paths |
get_project_metadata |
Function | Extract config.yaml metadata |
validate_project_structure |
Function | Verify directory structure |
- Modules Guide — Module overview
- Multi-Project Management — Multi-project workflows
- Infrastructure AGENTS.md — Machine-readable API spec