Skip to content

Commit 50545a8

Browse files
committed
Documentation: Architecture: Fill out architecture documents.
Add comprehensive architecture documentation including: - System overview with layered architecture description - Detailed component responsibilities and data flows - Key architectural patterns and integration points - Product requirements with functional requirements and user stories - Enhanced filesystem documentation with module responsibilities The documentation covers the factory, decorator, behavior, standard, and utility layers, along with class creation and attribute access flows. Also documents extension points, dependencies, and architectural goals. Co-Authored-By: Claude (Sonnet 4.5) <noreply@anthropic.com>
1 parent c73b389 commit 50545a8

3 files changed

Lines changed: 937 additions & 13 deletions

File tree

documentation/architecture/filesystem.rst

Lines changed: 168 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,181 @@ The main Python package follows the standard ``sources/`` directory pattern:
5757
.. code-block::
5858
5959
sources/
60-
├── classcore/ # Main Python package
61-
│ ├── __/ # Centralized import hub
62-
│ │ ├── __init__.py # Re-exports core utilities
63-
│ │ ├── imports.py # External library imports
64-
│ │ └── nomina.py # python-classcore-specific naming constants
65-
│ ├── __init__.py # Package entry point
66-
│ ├── py.typed # Type checking marker
67-
│ └── [modules].py # Feature-specific modules
68-
60+
└── classcore/ # Main Python package
61+
├── __/ # Centralized import hub
62+
│ ├── __init__.py # Re-exports core utilities
63+
│ ├── imports.py # External library imports
64+
│ ├── nomina.py # Naming constants
65+
│ └── doctab.py # Documentation table fragments
66+
├── __init__.py # Package entry point
67+
├── py.typed # Type checking marker
68+
├── decorators.py # Class decorator utilities
69+
├── exceptions.py # Package exception classes
70+
├── factories.py # Metaclass factory functions
71+
├── nomina.py # Public naming types and utilities
72+
├── utilities.py # Class manipulation utilities
73+
└── standard/ # Standard behaviors subpackage
74+
├── __.py # Inherits parent imports
75+
├── __init__.py # Subpackage entry point
76+
├── behaviors.py # Immutability and concealment logic
77+
├── classes.py # Standard metaclasses and base classes
78+
├── decorators.py # Standard class decorators
79+
├── dynadoc.py # Documentation configuration
80+
├── modules.py # Module reclassification utilities
81+
└── nomina.py # Standard-specific naming types
82+
83+
Module Responsibilities
84+
-------------------------------------------------------------------------------
85+
86+
Core Package (``sources/classcore/``)
87+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88+
89+
``__/__init__.py``
90+
Re-exports commonly used imports from ``imports.py`` for convenient access
91+
via ``from . import __`` in all package modules.
92+
93+
``__/imports.py``
94+
Centralizes all external library imports. Provides abbreviated aliases for
95+
frequently used types and modules (e.g., ``cabc`` for
96+
``collections.abc``, ``typx`` for ``typing``).
97+
98+
``__/nomina.py``
99+
Package-specific naming constants and utilities used internally by the
100+
``__`` import hub.
101+
102+
``__/doctab.py``
103+
Documentation table with reusable fragments for dynadoc interpolation.
104+
105+
``__init__.py``
106+
Package entry point. Exports public API, applies standard behaviors to
107+
package module, sets version.
108+
109+
``decorators.py``
110+
Class decorator utilities:
111+
112+
- ``apply_decorators``: Apply decorator sequences with class replacement
113+
handling
114+
- ``decoration_by``: Compose multiple decorators
115+
- ``produce_class_construction_decorator``: Create metaclass ``__new__``
116+
decorators
117+
- ``produce_class_initialization_decorator``: Create metaclass ``__init__``
118+
decorators
119+
120+
``exceptions.py``
121+
Package exception hierarchy. All exceptions use standard behaviors
122+
(immutability and concealment) themselves.
123+
124+
``factories.py``
125+
Metaclass component factories:
126+
127+
- ``produce_class_constructor``: Generate customizable ``__new__`` with
128+
hooks
129+
- ``produce_class_initializer``: Generate customizable ``__init__`` with
130+
hooks
131+
132+
``nomina.py``
133+
Public naming types, type aliases, and protocols used throughout the
134+
package. Defines interfaces for hooks, verifiers, and core functions.
135+
136+
``utilities.py``
137+
Class manipulation utilities:
138+
139+
- ``mangle_name``: Create unique attribute names
140+
- ``getattr0/setattr0/delattr0``: Mangled attribute access
141+
- ``repair_class_reproduction``: Fix closures after class replacement
142+
- ``describe_object``: Generate error message descriptions
143+
144+
Standard Subpackage (``sources/classcore/standard/``)
145+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146+
147+
``__.py``
148+
Inherits all imports from parent ``__`` via ``from ..__ import *``.
149+
Demonstrates the cascading import pattern for subpackages.
150+
151+
``__init__.py``
152+
Subpackage entry point. Exports all standard classes, decorators, and
153+
utilities. Applies standard behaviors to subpackage module.
154+
155+
``behaviors.py``
156+
Core implementation of standard behaviors:
157+
158+
- ``assign_attribute_if_mutable``: Conditional attribute assignment
159+
- ``delete_attribute_if_mutable``: Conditional attribute deletion
160+
- ``survey_visible_attributes``: Filter attributes for ``dir()``
161+
- Verifier processing for names, regexes, and predicates
162+
163+
``classes.py``
164+
Standard metaclasses and base classes:
165+
166+
- ``Class`` / ``Object``: Standard class with full behaviors
167+
- ``Dataclass`` / ``DataclassObject``: Auto-dataclass with behaviors
168+
- ``Protocol`` / ``ProtocolObject``: Protocol with behaviors
169+
- Mutable variants for each
170+
171+
``decorators.py``
172+
Standard class decorators:
173+
174+
- ``class_with_standard_behaviors``: Apply behaviors to existing class
175+
- ``dataclass_with_standard_behaviors``: Create dataclass with behaviors
176+
- ``protocol_with_standard_behaviors``: Create protocol with behaviors
177+
- ``class_factory``: Generic factory for creating custom metaclasses
178+
179+
``dynadoc.py``
180+
Dynadoc configuration for standard behaviors. Provides documentation
181+
fragments that describe behaviors automatically applied to classes.
182+
183+
``modules.py``
184+
Module reclassification utilities:
185+
186+
- ``reclassify_module``: Apply behaviors to single module
187+
- ``finalize_module``: Complete module initialization (used by package)
188+
189+
``nomina.py``
190+
Standard-specific naming types and constants. Defines behavior labels
191+
and attribute naming functions.
69192

70193
All package modules use the standard ``__`` import pattern as documented
71194
in the common architecture guide.
72195

73196
Component Integration
74197
===============================================================================
75198

199+
Import Hub Usage
200+
-------------------------------------------------------------------------------
201+
202+
All modules access common dependencies through the ``__`` import hub:
203+
204+
.. code-block:: python
205+
206+
# In any module at sources/classcore/
207+
from . import __
208+
209+
# Use abbreviated imports
210+
def example( items: __.cabc.Sequence[ str ] ) -> __.typx.Any:
211+
return __.funct.partial( some_function, items )
212+
213+
This pattern:
214+
215+
- Eliminates redundant import statements
216+
- Provides consistent naming across modules
217+
- Centralizes import changes to ``__/imports.py``
218+
- Reduces module namespace pollution
219+
220+
Subpackage Extension
221+
-------------------------------------------------------------------------------
222+
223+
The ``standard/`` subpackage demonstrates the cascading import pattern.
224+
Its ``__.py`` inherits parent imports and can add specialized dependencies:
225+
226+
.. code-block:: python
227+
228+
# sources/classcore/standard/__.py
229+
from ..__ import * # Inherit all parent imports
230+
from ..exceptions import * # Add package exceptions
231+
232+
Modules in ``standard/`` use the same import pattern but gain access to both
233+
parent and subpackage-specific imports.
234+
76235
Architecture Evolution
77236
===============================================================================
78237

0 commit comments

Comments
 (0)