chore(release): 0.0.7
Squash-merge lib-standardisation: adopt repo standards across packaging, tooling, docs, and CI. - standardize pyproject.toml (canonical packaging, lint config, extras, GSDFC pydoclint) - add py.typed marker, modernize type hints and Google-style docstrings - nest generated docs under docs/lib and docs/mcp; add hand-written wiki - adopt standard Type A PyPI CI pipeline (tag==version guard + quality gate) - promote generated CHANGELOG.md; bump version to 0.0.7
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from .project import Project
|
||||
from .module import Module
|
||||
from .object import DocObject
|
||||
from .project import Project
|
||||
|
||||
__all__ = [
|
||||
"Project",
|
||||
|
||||
@@ -7,9 +7,16 @@ This module defines the `Module` class used in the doc-forge documentation
|
||||
model. A `Module` acts as a container for top-level documented objects
|
||||
(classes, functions, variables, and other members) discovered during
|
||||
introspection.
|
||||
|
||||
---
|
||||
|
||||
Notes:
|
||||
- Only public members are stored; private names are filtered by the loader.
|
||||
|
||||
---
|
||||
"""
|
||||
|
||||
from typing import Dict, Iterable, Optional
|
||||
from collections.abc import Iterable
|
||||
|
||||
from docforge.models.object import DocObject
|
||||
|
||||
@@ -26,17 +33,17 @@ class Module:
|
||||
path (str):
|
||||
Dotted import path of the module.
|
||||
|
||||
docstring (Optional[str]):
|
||||
docstring (str | None):
|
||||
Module-level documentation string, if present.
|
||||
|
||||
members (Dict[str, DocObject]):
|
||||
members (dict[str, DocObject]):
|
||||
Mapping of object names to their corresponding `DocObject` representations.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
path: str,
|
||||
docstring: Optional[str] = None,
|
||||
docstring: str | None = None,
|
||||
) -> None:
|
||||
"""
|
||||
Initialize a Module instance.
|
||||
@@ -45,12 +52,12 @@ class Module:
|
||||
path (str):
|
||||
Dotted import path identifying the module.
|
||||
|
||||
docstring (Optional[str]):
|
||||
docstring (str | None):
|
||||
Module-level documentation text, if available.
|
||||
"""
|
||||
self.path = path
|
||||
self.docstring = docstring
|
||||
self.members: Dict[str, DocObject] = {}
|
||||
self.members: dict[str, DocObject] = {}
|
||||
|
||||
def add_object(self, obj: DocObject) -> None:
|
||||
"""
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
from typing import Dict, Iterable, Optional
|
||||
from collections.abc import Iterable
|
||||
|
||||
from docforge.models.object import DocObject
|
||||
|
||||
|
||||
class Module:
|
||||
"""Represents a documented Python module."""
|
||||
|
||||
path: str
|
||||
docstring: Optional[str]
|
||||
members: Dict[str, DocObject]
|
||||
docstring: str | None
|
||||
members: dict[str, DocObject]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
path: str,
|
||||
docstring: Optional[str] = ...,
|
||||
docstring: str | None = ...,
|
||||
) -> None: ...
|
||||
|
||||
def add_object(self, obj: DocObject) -> None: ...
|
||||
|
||||
def get_object(self, name: str) -> DocObject: ...
|
||||
|
||||
def get_all_objects(self) -> Iterable[DocObject]: ...
|
||||
|
||||
@@ -7,9 +7,17 @@ This module defines the `DocObject` class, the fundamental recursive unit of
|
||||
the doc-forge documentation model. Each `DocObject` represents a Python
|
||||
entity such as a class, function, method, or attribute, and may contain nested
|
||||
members that form a hierarchical documentation structure.
|
||||
|
||||
---
|
||||
|
||||
Notes:
|
||||
- `DocObject` instances form a tree mirroring the Python import hierarchy.
|
||||
- Objects are renderer-agnostic and may be consumed by any renderer.
|
||||
|
||||
---
|
||||
"""
|
||||
|
||||
from typing import Dict, Iterable, Optional
|
||||
from collections.abc import Iterable
|
||||
|
||||
|
||||
class DocObject:
|
||||
@@ -30,13 +38,13 @@ class DocObject:
|
||||
path (str):
|
||||
Fully qualified dotted path to the object.
|
||||
|
||||
signature (Optional[str]):
|
||||
signature (str | None):
|
||||
Callable signature if the object represents a callable.
|
||||
|
||||
docstring (Optional[str]):
|
||||
docstring (str | None):
|
||||
Raw docstring text extracted from the source code.
|
||||
|
||||
members (Dict[str, DocObject]):
|
||||
members (dict[str, DocObject]):
|
||||
Mapping of member names to child `DocObject` instances.
|
||||
"""
|
||||
|
||||
@@ -45,8 +53,8 @@ class DocObject:
|
||||
name: str,
|
||||
kind: str,
|
||||
path: str,
|
||||
signature: Optional[str] = None,
|
||||
docstring: Optional[str] = None,
|
||||
signature: str | None = None,
|
||||
docstring: str | None = None,
|
||||
) -> None:
|
||||
"""
|
||||
Initialize a DocObject instance.
|
||||
@@ -61,10 +69,10 @@ class DocObject:
|
||||
path (str):
|
||||
Fully qualified dotted path of the object.
|
||||
|
||||
signature (Optional[str]):
|
||||
signature (str | None):
|
||||
Callable signature if applicable.
|
||||
|
||||
docstring (Optional[str]):
|
||||
docstring (str | None):
|
||||
Documentation string associated with the object.
|
||||
"""
|
||||
self.name = name
|
||||
@@ -72,7 +80,7 @@ class DocObject:
|
||||
self.path = path
|
||||
self.signature = signature
|
||||
self.docstring = docstring
|
||||
self.members: Dict[str, "DocObject"] = {}
|
||||
self.members: dict[str, DocObject] = {}
|
||||
|
||||
def add_member(self, obj: "DocObject") -> None:
|
||||
"""
|
||||
@@ -82,7 +90,8 @@ class DocObject:
|
||||
nested objects to their parent containers.
|
||||
|
||||
Args:
|
||||
obj: Documentation object to add as a member.
|
||||
obj (DocObject):
|
||||
Documentation object to add as a member.
|
||||
"""
|
||||
self.members[obj.name] = obj
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from typing import Dict, Iterable, Optional
|
||||
|
||||
from collections.abc import Iterable
|
||||
|
||||
class DocObject:
|
||||
"""Represents a documented Python object."""
|
||||
@@ -7,21 +6,18 @@ class DocObject:
|
||||
name: str
|
||||
kind: str
|
||||
path: str
|
||||
signature: Optional[str]
|
||||
docstring: Optional[str]
|
||||
members: Dict[str, "DocObject"]
|
||||
signature: str | None
|
||||
docstring: str | None
|
||||
members: dict[str, DocObject]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
kind: str,
|
||||
path: str,
|
||||
signature: Optional[str] = ...,
|
||||
docstring: Optional[str] = ...,
|
||||
signature: str | None = ...,
|
||||
docstring: str | None = ...,
|
||||
) -> None: ...
|
||||
|
||||
def add_member(self, obj: "DocObject") -> None: ...
|
||||
|
||||
def get_member(self, name: str) -> "DocObject": ...
|
||||
|
||||
def get_all_members(self) -> Iterable["DocObject"]: ...
|
||||
def add_member(self, obj: DocObject) -> None: ...
|
||||
def get_member(self, name: str) -> DocObject: ...
|
||||
def get_all_members(self) -> Iterable[DocObject]: ...
|
||||
|
||||
@@ -6,9 +6,17 @@ Documentation model representing a project.
|
||||
This module defines the `Project` class, the top-level container used by
|
||||
doc-forge to represent a documented codebase. A `Project` aggregates multiple
|
||||
modules and provides access to them through a unified interface.
|
||||
|
||||
---
|
||||
|
||||
Notes:
|
||||
- Modules are keyed by their dotted import path.
|
||||
- Objects are renderer-agnostic; the same model feeds every renderer.
|
||||
|
||||
---
|
||||
"""
|
||||
|
||||
from typing import Dict, Iterable
|
||||
from collections.abc import Iterable
|
||||
|
||||
from docforge.models.module import Module
|
||||
|
||||
@@ -24,7 +32,7 @@ class Project:
|
||||
name (str):
|
||||
Name of the project.
|
||||
|
||||
modules (Dict[str, Module]):
|
||||
modules (dict[str, Module]):
|
||||
Mapping of module paths to `Module` instances.
|
||||
"""
|
||||
|
||||
@@ -35,9 +43,17 @@ class Project:
|
||||
Args:
|
||||
name (str):
|
||||
Name used to identify the documentation project.
|
||||
|
||||
Example:
|
||||
Create a project and register a module:
|
||||
|
||||
```python
|
||||
project = Project("mypackage")
|
||||
project.add_module(module)
|
||||
```
|
||||
"""
|
||||
self.name = name
|
||||
self.modules: Dict[str, Module] = {}
|
||||
self.modules: dict[str, Module] = {}
|
||||
|
||||
def add_module(self, module: Module) -> None:
|
||||
"""
|
||||
@@ -85,4 +101,4 @@ class Project:
|
||||
list[str]:
|
||||
A list containing the dotted paths of all modules in the project.
|
||||
"""
|
||||
return list(self.modules.keys())
|
||||
return list(self.modules.keys())
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
from typing import Dict, Iterable
|
||||
from collections.abc import Iterable
|
||||
|
||||
from docforge.models.module import Module
|
||||
|
||||
|
||||
class Project:
|
||||
"""Represents a documentation project."""
|
||||
|
||||
name: str
|
||||
modules: Dict[str, Module]
|
||||
modules: dict[str, Module]
|
||||
|
||||
def __init__(self, name: str) -> None: ...
|
||||
|
||||
def add_module(self, module: Module) -> None: ...
|
||||
|
||||
def get_module(self, path: str) -> Module: ...
|
||||
|
||||
def get_all_modules(self) -> Iterable[Module]: ...
|
||||
|
||||
def get_module_list(self) -> list[str]: ...
|
||||
|
||||
Reference in New Issue
Block a user