Functions
load_collections
Load collection definitions from project's collections.py file.
Searches for collections.py in the…
load_collections
def load_collections(project_root: Path, collection_file: str = 'collections.py') -> dict[str, CollectionConfig[Any]]
Load collection definitions from project's collections.py file.
Searches for collections.py in the project root and loads the
collectionsdictionary containing CollectionConfig instances.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
project_root |
Path |
— | Path to project root directory |
collection_file |
str |
'collections.py' |
Name of collections file (default: collections.py) |
Returns
Dictionary mapping collection names to CollectionConfig instances.
Returns empty dict if no collections file found.dict[str, CollectionConfig[Any]]
—
get_collection_for_path
Determine which collection a content file belongs to.
Matches the file path against collection dir…
get_collection_for_path
def get_collection_for_path(file_path: Path, content_root: Path, collections: dict[str, CollectionConfig[Any]]) -> tuple[str | None, CollectionConfig[Any] | None]
Determine which collection a content file belongs to.
Matches the file path against collection directories to find the applicable collection.
Parameters 3
| Name | Type | Default | Description |
|---|---|---|---|
file_path |
Path |
— | Path to content file |
content_root |
Path |
— | Root content directory |
collections |
dict[str, CollectionConfig[Any]] |
— | Dictionary of loaded collections |
Returns
Tuple of (collection_name, CollectionConfig) if file is in a collection,
or (None, None) if file doesn't belong to any collection.tuple[str | None, CollectionConfig[Any] | None]
—
validate_collections_config
Validate collection configurations.
Checks that collection directories exist and are valid.
validate_collections_config
def validate_collections_config(collections: dict[str, CollectionConfig[Any]], content_root: Path) -> list[str]
Validate collection configurations.
Checks that collection directories exist and are valid.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
collections |
dict[str, CollectionConfig[Any]] |
— | Dictionary of loaded collections |
content_root |
Path |
— | Root content directory |
Returns
List of warning messages for invalid configurations.list[str]
—