refactor: rename loader/model packages to loaders/models
- Rename docforge.loader → docforge.loaders and docforge.model → docforge.models - Update all imports, type stubs, CLI, tests, and documentation references - Align MkDocs navigation and docforge.nav.yml with new package structure - Adjust module docstrings and comments for consistency with pluralized naming
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
`doc-forge` is a renderer-agnostic Python documentation compiler designed for
|
||||
speed, flexibility, and beautiful output. It decouples the introspection of
|
||||
your code from the rendering process, allowing you to generate documentation
|
||||
for various platforms (starting with MkDocs) from a single internal model.
|
||||
for various platforms (starting with MkDocs) from a single internal models.
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -45,16 +45,16 @@ pip install doc-forge
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `docforge.loader`: Introspects source code using static analysis (`griffe`).
|
||||
- `docforge.model`: The internal representation of your project, modules, and objects.
|
||||
- `docforge.renderers`: Converters that turn the model into physical files.
|
||||
- `docforge.loaders`: Introspects source code using static analysis (`griffe`).
|
||||
- `docforge.models`: The internal representation of your project, modules, and objects.
|
||||
- `docforge.renderers`: Converters that turn the models into physical files.
|
||||
- `docforge.nav`: Managers for logical-to-physical path mapping and navigation.
|
||||
"""
|
||||
|
||||
from .loader import GriffeLoader, discover_module_paths
|
||||
from .loaders import GriffeLoader, discover_module_paths
|
||||
from .renderers import MkDocsRenderer
|
||||
from .cli import main
|
||||
from . import model
|
||||
from . import models
|
||||
|
||||
__all__ = [
|
||||
"GriffeLoader",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from .loader import GriffeLoader, discover_module_paths
|
||||
from .loaders import GriffeLoader, discover_module_paths
|
||||
from .renderers import MkDocsRenderer
|
||||
from .cli import main
|
||||
from . import model
|
||||
from . import models
|
||||
|
||||
__all__ = [
|
||||
"GriffeLoader",
|
||||
|
||||
@@ -8,7 +8,7 @@ from typing import Sequence, Optional
|
||||
|
||||
import click
|
||||
|
||||
from docforge.loader import GriffeLoader, discover_module_paths
|
||||
from docforge.loaders import GriffeLoader, discover_module_paths
|
||||
from docforge.renderers.mkdocs import MkDocsRenderer
|
||||
from docforge.cli.mkdocs import mkdocs_cmd
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
# Loader Layer
|
||||
|
||||
The `docforge.loader` package is responsible for discovering Python source files
|
||||
The `docforge.loaders` package is responsible for discovering Python source files
|
||||
and extracting their documentation using static analysis.
|
||||
|
||||
## Core Features
|
||||
@@ -1,6 +1,6 @@
|
||||
"""
|
||||
This module provides the GriffeLoader, which uses the 'griffe' library to
|
||||
introspect Python source code and populate the doc-forge Project model.
|
||||
introspect Python source code and populate the doc-forge Project models.
|
||||
"""
|
||||
|
||||
import logging
|
||||
@@ -15,7 +15,7 @@ from griffe import (
|
||||
AliasResolutionError,
|
||||
)
|
||||
|
||||
from docforge.model import Module, Project, DocObject
|
||||
from docforge.models import Module, Project, DocObject
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -83,7 +83,7 @@ class GriffeLoader:
|
||||
skip_import_errors: bool = None,
|
||||
) -> Project:
|
||||
"""
|
||||
Load multiple modules and combine them into a single Project model.
|
||||
Load multiple modules and combine them into a single Project models.
|
||||
|
||||
Args:
|
||||
module_paths: A list of dotted paths to the modules to load.
|
||||
@@ -116,7 +116,7 @@ class GriffeLoader:
|
||||
|
||||
def load_module(self, path: str) -> Module:
|
||||
"""
|
||||
Load a single module and convert its introspection data into the docforge model.
|
||||
Load a single module and convert its introspection data into the docforge models.
|
||||
|
||||
Args:
|
||||
path: The dotted path of the module to load.
|
||||
@@ -1,7 +1,7 @@
|
||||
from typing import List, Optional
|
||||
from pathlib import Path
|
||||
|
||||
from docforge.model import Module, Project
|
||||
from docforge.models import Module, Project
|
||||
|
||||
|
||||
def discover_module_paths(
|
||||
@@ -12,7 +12,7 @@ def discover_module_paths(
|
||||
|
||||
|
||||
class GriffeLoader:
|
||||
"""Griffe-based introspection loader.
|
||||
"""Griffe-based introspection loaders.
|
||||
|
||||
This is the only supported introspection backend in doc-forge.
|
||||
"""
|
||||
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
# Model Layer
|
||||
|
||||
The `docforge.model` package provides the core data structures used to represent
|
||||
The `docforge.models` package provides the core data structures used to represent
|
||||
Python source code in a documentation-focused hierarchy.
|
||||
|
||||
## Key Components
|
||||
@@ -1,12 +1,12 @@
|
||||
"""
|
||||
This module defines the Module class, which represents a Python module or package
|
||||
in the doc-forge documentation model. It acts as a container for top-level
|
||||
in the doc-forge documentation models. It acts as a container for top-level
|
||||
documented objects.
|
||||
"""
|
||||
|
||||
from typing import Dict, Iterable, Optional
|
||||
|
||||
from docforge.model.object import DocObject
|
||||
from docforge.models.object import DocObject
|
||||
|
||||
|
||||
class Module:
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Dict, Iterable, Optional
|
||||
|
||||
from docforge.model.object import DocObject
|
||||
from docforge.models.object import DocObject
|
||||
|
||||
|
||||
class Module:
|
||||
@@ -1,6 +1,6 @@
|
||||
"""
|
||||
This module defines the DocObject class, the fundamental recursive unit of the
|
||||
doc-forge documentation model. A DocObject represents a single Python entity
|
||||
doc-forge documentation models. A DocObject represents a single Python entity
|
||||
(class, function, method, or attribute) and its nested members.
|
||||
"""
|
||||
|
||||
@@ -5,7 +5,7 @@ project. It aggregates multiple Module instances into a single named entity.
|
||||
|
||||
from typing import Dict, Iterable
|
||||
|
||||
from docforge.model.module import Module
|
||||
from docforge.models.module import Module
|
||||
|
||||
|
||||
class Project:
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Dict, Iterable
|
||||
|
||||
from docforge.model.module import Module
|
||||
from docforge.models.module import Module
|
||||
|
||||
|
||||
class Project:
|
||||
@@ -2,7 +2,7 @@
|
||||
# Renderers Layer
|
||||
|
||||
The `docforge.renderers` package handles the transformation of the internal
|
||||
documentation model into physical files formatted for specific documentation
|
||||
documentation models into physical files formatted for specific documentation
|
||||
engines.
|
||||
|
||||
## Current Implementations
|
||||
|
||||
@@ -7,7 +7,7 @@ DocRenderer protocol.
|
||||
from pathlib import Path
|
||||
from typing import Protocol
|
||||
|
||||
from docforge.model import Project
|
||||
from docforge.models import Project
|
||||
|
||||
|
||||
class RendererConfig:
|
||||
@@ -16,7 +16,7 @@ class RendererConfig:
|
||||
|
||||
Args:
|
||||
out_dir: The directory where documentation files should be written.
|
||||
project: The introspected project model to be rendered.
|
||||
project: The introspected project models to be rendered.
|
||||
"""
|
||||
|
||||
def __init__(self, out_dir: Path, project: Project) -> None:
|
||||
@@ -40,7 +40,7 @@ class DocRenderer(Protocol):
|
||||
Generate renderer-specific source files for the given project.
|
||||
|
||||
Args:
|
||||
project: The project model containing modules and objects.
|
||||
project: The project models containing modules and objects.
|
||||
out_dir: Target directory for the generated files.
|
||||
"""
|
||||
...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from pathlib import Path
|
||||
from typing import Protocol
|
||||
|
||||
from docforge.model import Project
|
||||
from docforge.models import Project
|
||||
|
||||
|
||||
class RendererConfig:
|
||||
|
||||
@@ -5,7 +5,7 @@ compatible with the MkDocs 'material' theme and 'mkdocstrings' extension.
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from docforge.model import Project
|
||||
from docforge.models import Project
|
||||
|
||||
|
||||
class MkDocsRenderer:
|
||||
@@ -19,10 +19,10 @@ class MkDocsRenderer:
|
||||
def generate_sources(self, project: Project, out_dir: Path) -> None:
|
||||
"""
|
||||
Produce a set of Markdown files in the output directory based on the
|
||||
provided Project model.
|
||||
provided Project models.
|
||||
|
||||
Args:
|
||||
project: The project model to render.
|
||||
project: The project models to render.
|
||||
out_dir: Target directory for documentation files.
|
||||
"""
|
||||
modules = list(project.get_all_modules())
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from pathlib import Path
|
||||
from typing import Set
|
||||
|
||||
from docforge.model import Project, Module
|
||||
from docforge.models import Project, Module
|
||||
|
||||
|
||||
class MkDocsRenderer:
|
||||
|
||||
Reference in New Issue
Block a user