classcore 1.10__tar.gz → 1.12__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. classcore-1.12/.gitignore +7 -0
  2. {classcore-1.10 → classcore-1.12}/PKG-INFO +10 -3
  3. {classcore-1.10 → classcore-1.12}/README.rst +6 -0
  4. {classcore-1.10 → classcore-1.12}/pyproject.toml +12 -5
  5. classcore-1.12/sources/classcore/README.md +457 -0
  6. {classcore-1.10 → classcore-1.12}/sources/classcore/__/imports.py +4 -0
  7. {classcore-1.10 → classcore-1.12}/sources/classcore/__init__.py +1 -1
  8. {classcore-1.10 → classcore-1.12}/sources/classcore/decorators.py +23 -5
  9. {classcore-1.10 → classcore-1.12}/sources/classcore/factories.py +1 -1
  10. {classcore-1.10 → classcore-1.12}/sources/classcore/nomina.py +70 -13
  11. classcore-1.12/sources/classcore/standard/README.md +216 -0
  12. {classcore-1.10 → classcore-1.12}/sources/classcore/standard/behaviors.py +1 -1
  13. {classcore-1.10 → classcore-1.12}/sources/classcore/standard/classes.py +188 -30
  14. {classcore-1.10 → classcore-1.12}/sources/classcore/standard/decorators.py +5 -5
  15. {classcore-1.10 → classcore-1.12}/sources/classcore/standard/nomina.py +0 -1
  16. classcore-1.10/.gitignore +0 -15
  17. {classcore-1.10 → classcore-1.12}/LICENSE.txt +0 -0
  18. {classcore-1.10 → classcore-1.12}/sources/classcore/__/__init__.py +0 -0
  19. {classcore-1.10 → classcore-1.12}/sources/classcore/__/doctab.py +0 -0
  20. {classcore-1.10 → classcore-1.12}/sources/classcore/__/nomina.py +0 -0
  21. {classcore-1.10 → classcore-1.12}/sources/classcore/exceptions.py +0 -0
  22. {classcore-1.10 → classcore-1.12}/sources/classcore/py.typed +0 -0
  23. {classcore-1.10 → classcore-1.12}/sources/classcore/standard/__.py +0 -0
  24. {classcore-1.10 → classcore-1.12}/sources/classcore/standard/__init__.py +0 -0
  25. {classcore-1.10 → classcore-1.12}/sources/classcore/standard/dynadoc.py +0 -0
  26. {classcore-1.10 → classcore-1.12}/sources/classcore/standard/modules.py +0 -0
  27. {classcore-1.10 → classcore-1.12}/sources/classcore/utilities.py +0 -0
@@ -0,0 +1,7 @@
1
+ .env
2
+ *.so
3
+ .*.swp
4
+ __pycache__/
5
+ bugs/
6
+ build/
7
+ dist/
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: classcore
3
- Version: 1.10
3
+ Version: 1.12
4
4
  Summary: Foundational class factories and decorators.
5
5
  Project-URL: Homepage, https://github.com/emcd/python-classcore
6
6
  Project-URL: Documentation, https://emcd.github.io/python-classcore
@@ -19,11 +19,12 @@ Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Programming Language :: Python :: 3.11
20
20
  Classifier: Programming Language :: Python :: 3.12
21
21
  Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
22
23
  Classifier: Programming Language :: Python :: Implementation :: CPython
23
24
  Classifier: Programming Language :: Python :: Implementation :: PyPy
24
25
  Classifier: Topic :: Software Development
25
26
  Requires-Python: >=3.10
26
- Requires-Dist: dynadoc
27
+ Requires-Dist: dynadoc~=1.4
27
28
  Requires-Dist: typing-extensions
28
29
  Description-Content-Type: text/x-rst
29
30
 
@@ -283,6 +284,9 @@ Other Projects by This Author 🌟
283
284
  * `python-accretive <https://github.com/emcd/python-accretive>`_ (`accretive <https://pypi.org/project/accretive/>`_ on PyPI)
284
285
 
285
286
  🌌 A Python library package which provides **accretive data structures** - collections which can grow but never shrink.
287
+ * `python-detextive <https://github.com/emcd/python-detextive>`_ (`detextive <https://pypi.org/project/detextive/>`_ on PyPI)
288
+
289
+ 🕵️ A Python library which provides consolidated text detection capabilities for reliable content analysis. Offers MIME type detection, character set detection, and line separator processing.
286
290
  * `python-dynadoc <https://github.com/emcd/python-dynadoc>`_ (`dynadoc <https://pypi.org/project/dynadoc/>`_ on PyPI)
287
291
 
288
292
  📝 A Python library package which bridges the gap between **rich annotations** and **automatic documentation generation** with configurable renderers and support for reusable fragments.
@@ -295,6 +299,9 @@ Other Projects by This Author 🌟
295
299
  * `python-icecream-truck <https://github.com/emcd/python-icecream-truck>`_ (`icecream-truck <https://pypi.org/project/icecream-truck/>`_ on PyPI)
296
300
 
297
301
  🍦 **Flavorful Debugging** - A Python library which enhances the powerful and well-known ``icecream`` package with flavored traces, configuration hierarchies, customized outputs, ready-made recipes, and more.
302
+ * `python-librovore <https://github.com/emcd/python-librovore>`_ (`librovore <https://pypi.org/project/librovore/>`_ on PyPI)
303
+
304
+ 🐲 **Documentation Search Engine** - An intelligent documentation search and extraction tool that provides both a command-line interface for humans and an MCP (Model Context Protocol) server for AI agents. Search across Sphinx and MkDocs sites with fuzzy matching, extract clean markdown content, and integrate seamlessly with AI development workflows.
298
305
  * `python-mimeogram <https://github.com/emcd/python-mimeogram>`_ (`mimeogram <https://pypi.org/project/mimeogram/>`_ on PyPI)
299
306
 
300
307
  📨 A command-line tool for **exchanging collections of files with Large Language Models** - bundle multiple files into a single clipboard-ready document while preserving directory structure and metadata... good for code reviews, project sharing, and LLM interactions.
@@ -254,6 +254,9 @@ Other Projects by This Author 🌟
254
254
  * `python-accretive <https://github.com/emcd/python-accretive>`_ (`accretive <https://pypi.org/project/accretive/>`_ on PyPI)
255
255
 
256
256
  🌌 A Python library package which provides **accretive data structures** - collections which can grow but never shrink.
257
+ * `python-detextive <https://github.com/emcd/python-detextive>`_ (`detextive <https://pypi.org/project/detextive/>`_ on PyPI)
258
+
259
+ 🕵️ A Python library which provides consolidated text detection capabilities for reliable content analysis. Offers MIME type detection, character set detection, and line separator processing.
257
260
  * `python-dynadoc <https://github.com/emcd/python-dynadoc>`_ (`dynadoc <https://pypi.org/project/dynadoc/>`_ on PyPI)
258
261
 
259
262
  📝 A Python library package which bridges the gap between **rich annotations** and **automatic documentation generation** with configurable renderers and support for reusable fragments.
@@ -266,6 +269,9 @@ Other Projects by This Author 🌟
266
269
  * `python-icecream-truck <https://github.com/emcd/python-icecream-truck>`_ (`icecream-truck <https://pypi.org/project/icecream-truck/>`_ on PyPI)
267
270
 
268
271
  🍦 **Flavorful Debugging** - A Python library which enhances the powerful and well-known ``icecream`` package with flavored traces, configuration hierarchies, customized outputs, ready-made recipes, and more.
272
+ * `python-librovore <https://github.com/emcd/python-librovore>`_ (`librovore <https://pypi.org/project/librovore/>`_ on PyPI)
273
+
274
+ 🐲 **Documentation Search Engine** - An intelligent documentation search and extraction tool that provides both a command-line interface for humans and an MCP (Model Context Protocol) server for AI agents. Search across Sphinx and MkDocs sites with fuzzy matching, extract clean markdown content, and integrate seamlessly with AI development workflows.
269
275
  * `python-mimeogram <https://github.com/emcd/python-mimeogram>`_ (`mimeogram <https://pypi.org/project/mimeogram/>`_ on PyPI)
270
276
 
271
277
  📨 A command-line tool for **exchanging collections of files with Large Language Models** - bundle multiple files into a single clipboard-ready document while preserving directory structure and metadata... good for code reviews, project sharing, and LLM interactions.
@@ -15,7 +15,7 @@ license = 'Apache-2.0'
15
15
  readme = { 'file' = 'README.rst', 'content-type' = 'text/x-rst' }
16
16
  requires-python = '>= 3.10'
17
17
  dependencies = [
18
- 'dynadoc',
18
+ 'dynadoc ~= 1.4',
19
19
  'typing-extensions',
20
20
  # --- BEGIN: Injected by Copier ---
21
21
  # --- END: Injected by Copier ---
@@ -30,6 +30,7 @@ classifiers = [ # https://pypi.org/classifiers
30
30
  'Programming Language :: Python :: 3.11',
31
31
  'Programming Language :: Python :: 3.12',
32
32
  'Programming Language :: Python :: 3.13',
33
+ 'Programming Language :: Python :: 3.14',
33
34
  'Programming Language :: Python :: Implementation :: CPython',
34
35
  'Programming Language :: Python :: Implementation :: PyPy',
35
36
  # --- END: Injected by Copier ---
@@ -93,12 +94,12 @@ strict-naming = false
93
94
  python = '3.10'
94
95
  [tool.hatch.envs.develop]
95
96
  description = ''' Development environment. '''
97
+ builder = true
96
98
  dependencies = [
97
- 'Jinja2',
98
99
  'coverage[toml]',
99
100
  'furo',
100
101
  'isort',
101
- 'packaging',
102
+ 'myst-parser',
102
103
  'pre-commit',
103
104
  'pyright',
104
105
  'pytest',
@@ -128,10 +129,10 @@ docsgen = [
128
129
  ]
129
130
  linters = [
130
131
  """ruff check --quiet sources documentation tests""",
132
+ # """vibelinter check""",
131
133
  # --- BEGIN: Injected by Copier ---
132
134
  # --- END: Injected by Copier ---
133
135
  """isort --check-only --diff sources tests""",
134
- """vulture""",
135
136
  """pyright sources""",
136
137
  ]
137
138
  packagers = [
@@ -173,7 +174,8 @@ python = [
173
174
  '3.11',
174
175
  '3.12',
175
176
  '3.13',
176
- 'pypy3.10',
177
+ '3.14',
178
+ 'pypy3.11',
177
179
  ]
178
180
  # [tool.hatch.metadata]
179
181
  # allow-direct-references = true
@@ -253,6 +255,7 @@ cache_dir = '.auxiliary/caches/pytest'
253
255
  markers = [
254
256
  "slow: long-running tests",
255
257
  ]
258
+ asyncio_default_fixture_loop_scope = "function"
256
259
 
257
260
  [tool.ruff]
258
261
  #builtins = [ 'ic' ]
@@ -348,6 +351,10 @@ directory = 'repair'
348
351
  name = 'Repairs'
349
352
  showcontent = true
350
353
 
354
+ [tool.vibelinter]
355
+ context = 3
356
+ exclude_paths = [ '.auxiliary/**', '.venv/**', 'tests/**', ]
357
+
351
358
  [tool.vulture]
352
359
  paths = [ '.auxiliary/configuration/vulturefood.py', 'sources' ]
353
360
  min_confidence = 60
@@ -0,0 +1,457 @@
1
+ # classcore
2
+
3
+ Classcore is a foundational library for creating classes with customized
4
+ behaviors, particularly immutability and concealment. The library operates at
5
+ the metaclass level to provide composable, inheritable behaviors while
6
+ maintaining compatibility with standard Python features like dataclasses and
7
+ protocols.
8
+
9
+ ## Architectural Goals
10
+
11
+ **Composability**
12
+ Enable incremental addition of class behaviors through decorators,
13
+ metaclasses, and inheritance without conflicts or unexpected interactions.
14
+
15
+ **Transparency**
16
+ Work seamlessly with existing Python features (dataclasses, protocols,
17
+ ABCs) and tools (type checkers, IDEs).
18
+
19
+ **Customizability**
20
+ Provide extension points at every layer for users to adapt behaviors to
21
+ specific needs through verifiers, hooks, and core function replacements.
22
+
23
+ **Performance**
24
+ Minimize runtime overhead through strategic caching and lazy evaluation
25
+ while centralizing import costs at package initialization.
26
+
27
+ ## High-Level Architecture
28
+
29
+ The system follows a layered architecture with clear separation of concerns:
30
+
31
+ ### Core Factory Layer
32
+
33
+ Location: `factories.py`
34
+
35
+ Produces metaclass components with customizable hooks:
36
+
37
+ - `produce_class_constructor`: Creates `__new__` implementations with
38
+ preprocessor and postprocessor hooks
39
+ - `produce_class_initializer`: Creates `__init__` implementations with
40
+ completer hooks
41
+
42
+ These factories enable the construction of metaclasses that can intercept and
43
+ augment class creation at multiple lifecycle points.
44
+
45
+ ### Decorator Layer
46
+
47
+ Location: `decorators.py`
48
+
49
+ Manages class decoration and replacement:
50
+
51
+ - `apply_decorators`: Applies decorator sequences while handling class
52
+ replacements
53
+ - `decoration_by`: Composes multiple decorators with preparation hooks
54
+ - `produce_class_construction_decorator`: Wraps constructor logic into
55
+ metaclass `__new__`
56
+ - `produce_class_initialization_decorator`: Wraps initializer logic into
57
+ metaclass `__init__`
58
+
59
+ Critical feature: Repairs class closures when decorators replace classes
60
+ (e.g., `dataclass(slots=True)`), ensuring `super()` continues to function
61
+ correctly.
62
+
63
+ ### Behavior Layer
64
+
65
+ Location: `standard/behaviors.py`
66
+
67
+ Implements immutability and concealment enforcement:
68
+
69
+ - Attribute assignment control with selective mutability
70
+ - Attribute deletion control
71
+ - Attribute visibility filtering for `dir()`
72
+ - Verifier system supporting names, regexes, and predicates
73
+
74
+ The verifier system allows fine-grained control: specify mutable attributes by
75
+ name, pattern, or custom predicate functions.
76
+
77
+ ### Standard Layer
78
+
79
+ Location: `standard/`
80
+
81
+ Pre-configured implementations for common use cases:
82
+
83
+ **Base Classes:**
84
+ - `Object`: Standard class with immutability and concealment
85
+ - `DataclassObject`: Automatic dataclass conversion with standard behaviors
86
+ - `Protocol`: Protocol base class with immutability and concealment
87
+ - `AbstractObject`: Abstract class with ABC machinery and behaviors
88
+ - Variants for selective mutability (`ObjectMutable`, etc.)
89
+
90
+ **Metaclasses:**
91
+ - `Class`: Metaclass for standard classes
92
+ - `Dataclass`: Metaclass that auto-applies dataclass decorator
93
+ - `AbstractClass`: Metaclass combining `Class` with `abc.ABCMeta`
94
+ - `ProtocolClass`: Metaclass for protocol classes
95
+ - Mutable variants of each
96
+
97
+ **Decorators:**
98
+ - `with_standard_behaviors`: Add behaviors to existing classes
99
+ - `dataclass_with_standard_behaviors`: Dataclass creation with behaviors
100
+
101
+ **Module Utilities:**
102
+ - `reclassify_module`: Apply immutability and concealment to module objects
103
+ - `finalize_module`: Complete module initialization with standard behaviors
104
+
105
+ ### Utility Layer
106
+
107
+ Location: `utilities.py`
108
+
109
+ Provides essential operations for metaclass machinery:
110
+
111
+ - `mangle_name`: Creates unique attribute names using SHA-256 hashing to
112
+ avoid inheritance collisions
113
+ - `getattr0/setattr0/delattr0`: Access mangled attributes while respecting
114
+ `__slots__`
115
+ - `repair_class_reproduction`: Fixes closure cells when decorators replace
116
+ classes (CPython/PyPy-specific)
117
+ - `describe_object`: Generates human-readable object descriptions for error
118
+ messages
119
+
120
+ ## Data Flow
121
+
122
+ ### Class Creation Flow
123
+
124
+ 1. User defines class with standard metaclass or inherits from standard base
125
+ 2. Metaclass `__new__` invoked via `produce_class_constructor`
126
+ 3. Preprocessors modify bases, namespace, arguments, decorators
127
+ 4. Superclass `__new__` creates initial class object
128
+ 5. Progress flag prevents recursive processing
129
+ 6. Postprocessors execute (e.g., adding behavior configurations)
130
+ 7. Decorators applied via `apply_decorators`
131
+ 8. If decorator replaces class, closures repaired
132
+ 9. Metaclass `__init__` invoked via `produce_class_initializer`
133
+ 10. Completers execute (e.g., freezing behaviors)
134
+ 11. Progress flag cleared
135
+ 12. Fully initialized class returned
136
+
137
+ ### Attribute Access Flow (Instances)
138
+
139
+ **Assignment (`obj.attr = value`):**
140
+ 1. `__setattr__` intercepted by assigner core function
141
+ 2. Check for immutability behavior flag
142
+ 3. If immutable, verify against mutables (names, regexes, predicates)
143
+ 4. If allowed, delegate to ligation (super or core override)
144
+ 5. If denied, raise `AttributeImmutability` error
145
+
146
+ **Visibility (`dir(obj)`):**
147
+ 1. `__dir__` intercepted by surveyor core function
148
+ 2. Collect all attributes from object and class hierarchy
149
+ 3. Check visibility verifiers (names, regexes, predicates)
150
+ 4. Filter attributes based on verifiers
151
+ 5. Return filtered set
152
+
153
+ ## Key Architectural Patterns
154
+
155
+ ### Factory Pattern
156
+
157
+ Metaclass components are produced by factory functions rather than fixed
158
+ inheritance hierarchies. This enables composition of behaviors and runtime
159
+ customization of class creation logic.
160
+
161
+ ### Decorator Composition
162
+
163
+ Multiple decorators can be applied in sequence, with automatic handling of
164
+ class replacements. The `decoration_by` function enables declarative
165
+ composition of decorator stacks.
166
+
167
+ ### Hook-Based Extension
168
+
169
+ Every critical point in the class lifecycle offers hooks:
170
+
171
+ - Preprocessors: Modify class construction inputs
172
+ - Postprocessors: Augment constructed classes
173
+ - Completers: Finalize initialized classes
174
+ - Preparers: Adjust decorator lists before application
175
+
176
+ ### Verifier Pattern
177
+
178
+ Behavior exclusions (mutability, visibility) use a uniform verifier interface:
179
+
180
+ - Literal `'*'`: Allow all
181
+ - Sequence of strings: Exact name matches
182
+ - Sequence of `re.Pattern`: Regex matches
183
+ - Sequence of callables: Predicate functions
184
+
185
+ This provides flexible, user-customizable behavior rules.
186
+
187
+ ### Core Function Replacement
188
+
189
+ Critical behaviors (assignment, deletion, visibility) can be replaced entirely
190
+ by providing alternative "core" functions. This enables deep customization
191
+ without subclassing.
192
+
193
+ ## Integration Points
194
+
195
+ ### Dataclasses
196
+
197
+ Standard metaclasses automatically apply `dataclasses.dataclass` during
198
+ class construction, with configurability for `frozen`, `slots`, etc. The
199
+ decorator application system ensures proper handling of the class replacement
200
+ that occurs with `slots=True`.
201
+
202
+ ### Protocols
203
+
204
+ Standard protocol classes combine `typing.Protocol` with immutability and
205
+ concealment. Special handling for ABC-related mutable attributes
206
+ (`_abc_cache`, `_abc_registry`, etc.) ensures protocol functionality.
207
+
208
+ ### Type Checkers
209
+
210
+ Metaclasses use `@dataclass_transform` decorator to signal dataclass
211
+ behavior to type checkers. This enables proper type inference and checking
212
+ for classes produced by standard metaclasses.
213
+
214
+ ### Module Objects
215
+
216
+ Module reclassification applies class-level behaviors to module objects,
217
+ enabling immutable, concealed module namespaces for API control.
218
+
219
+ ## Dependencies
220
+
221
+ ### External Dependencies
222
+
223
+ The library depends on standard library modules only:
224
+
225
+ - `dataclasses`: Automatic dataclass generation
226
+ - `functools`: Decorator utilities and partials
227
+ - `hashlib`: Attribute name mangling (SHA-256)
228
+ - `inspect`: Class and function introspection
229
+ - `platform`: Python implementation detection for platform-specific repairs
230
+ - `re`: Regular expression support for verifiers
231
+ - `typing`: Type hints and protocol support
232
+ - `collections.abc`: Abstract base classes
233
+
234
+ ### Internal Dependencies
235
+
236
+ - `dynadoc`: Documentation generation with fragment interpolation
237
+ - `frigid`: Immutable data structures for internal use
238
+ - `falsifier`: Base classes for falsey objects
239
+
240
+ ## Extension Points
241
+
242
+ Users can extend the library at multiple levels:
243
+
244
+ **Decorator Level**
245
+ Create custom class decorators and compose with `decoration_by`.
246
+
247
+ **Metaclass Level**
248
+ Build custom metaclasses using factory functions with custom hooks.
249
+
250
+ **Behavior Level**
251
+ Replace core functions for assignment, deletion, visibility, or error
252
+ provision.
253
+
254
+ **Verifier Level**
255
+ Implement custom predicate functions for mutability/visibility rules.
256
+
257
+ **Hook Level**
258
+ Provide preprocessors, postprocessors, completers, or preparers for
259
+ lifecycle customization.
260
+
261
+ ## Filesystem Organization
262
+
263
+ ### Root Directory
264
+
265
+ ```
266
+ python-classcore/
267
+ ├── LICENSE.txt # Project license
268
+ ├── README.rst # Project overview and quick start
269
+ ├── pyproject.toml # Python packaging and tool configuration
270
+ ├── documentation/ # Sphinx documentation source
271
+ ├── sources/ # All source code
272
+ ├── tests/ # Test suites
273
+ └── .auxiliary/ # Development workspace
274
+ ```
275
+
276
+ ### Package Structure
277
+
278
+ ```
279
+ sources/
280
+ └── classcore/ # Main Python package
281
+ ├── __/ # Centralized import hub
282
+ │ ├── __init__.py # Re-exports core utilities
283
+ │ ├── imports.py # External library imports
284
+ │ ├── nomina.py # Naming constants
285
+ │ └── doctab.py # Documentation table fragments
286
+ ├── __init__.py # Package entry point
287
+ ├── py.typed # Type checking marker
288
+ ├── decorators.py # Class decorator utilities
289
+ ├── exceptions.py # Package exception classes
290
+ ├── factories.py # Metaclass factory functions
291
+ ├── nomina.py # Public naming types and utilities
292
+ ├── utilities.py # Class manipulation utilities
293
+ └── standard/ # Standard behaviors subpackage
294
+ ├── __.py # Inherits parent imports
295
+ ├── __init__.py # Subpackage entry point
296
+ ├── behaviors.py # Immutability and concealment logic
297
+ ├── classes.py # Standard metaclasses and base classes
298
+ ├── decorators.py # Standard class decorators
299
+ ├── dynadoc.py # Documentation configuration
300
+ ├── modules.py # Module reclassification utilities
301
+ └── nomina.py # Standard-specific naming types
302
+ ```
303
+
304
+ ### Module Responsibilities
305
+
306
+ #### Core Package (`sources/classcore/`)
307
+
308
+ `__/__init__.py`
309
+ : Re-exports commonly used imports from `imports.py` for convenient access
310
+ via `from . import __` in all package modules.
311
+
312
+ `__/imports.py`
313
+ : Centralizes all external library imports. Provides abbreviated aliases for
314
+ frequently used types and modules (e.g., `cabc` for
315
+ `collections.abc`, `typx` for `typing`).
316
+
317
+ `__/nomina.py`
318
+ : Package-specific naming constants and utilities used internally by the
319
+ `__` import hub.
320
+
321
+ `__/doctab.py`
322
+ : Documentation table with reusable fragments for dynadoc interpolation.
323
+
324
+ `__init__.py`
325
+ : Package entry point. Exports public API, applies standard behaviors to
326
+ package module, sets version.
327
+
328
+ `decorators.py`
329
+ : Class decorator utilities:
330
+
331
+ - `apply_decorators`: Apply decorator sequences with class replacement
332
+ handling
333
+ - `decoration_by`: Compose multiple decorators
334
+ - `produce_class_construction_decorator`: Create metaclass `__new__`
335
+ decorators
336
+ - `produce_class_initialization_decorator`: Create metaclass `__init__`
337
+ decorators
338
+
339
+ `exceptions.py`
340
+ : Package exception hierarchy. All exceptions use standard behaviors
341
+ (immutability and concealment) themselves.
342
+
343
+ `factories.py`
344
+ : Metaclass component factories:
345
+
346
+ - `produce_class_constructor`: Generate customizable `__new__` with
347
+ hooks
348
+ - `produce_class_initializer`: Generate customizable `__init__` with
349
+ hooks
350
+
351
+ `nomina.py`
352
+ : Public naming types, type aliases, and protocols used throughout the
353
+ package. Defines interfaces for hooks, verifiers, and core functions.
354
+
355
+ `utilities.py`
356
+ : Class manipulation utilities:
357
+
358
+ - `mangle_name`: Create unique attribute names
359
+ - `getattr0/setattr0/delattr0`: Mangled attribute access
360
+ - `repair_class_reproduction`: Fix closures after class replacement
361
+ - `describe_object`: Generate error message descriptions
362
+
363
+ #### Standard Subpackage (`sources/classcore/standard/`)
364
+
365
+ `__.py`
366
+ : Inherits all imports from parent `__` via `from ..__ import *`.
367
+ Demonstrates the cascading import pattern for subpackages.
368
+
369
+ `__init__.py`
370
+ : Subpackage entry point. Exports all standard classes, decorators, and
371
+ utilities. Applies standard behaviors to subpackage module.
372
+
373
+ `behaviors.py`
374
+ : Core implementation of standard behaviors:
375
+
376
+ - `assign_attribute_if_mutable`: Conditional attribute assignment
377
+ - `delete_attribute_if_mutable`: Conditional attribute deletion
378
+ - `survey_visible_attributes`: Filter attributes for `dir()`
379
+ - Verifier processing for names, regexes, and predicates
380
+
381
+ `classes.py`
382
+ : Standard metaclasses and base classes:
383
+
384
+ - `Class` / `Object`: Standard class with full behaviors
385
+ - `AbstractClass` / `AbstractObject`: Abstract class with ABC machinery
386
+ (abstract method enforcement, virtual subclass registration); mixes
387
+ with external `abc.ABCMeta`-based classes
388
+ - `Dataclass` / `DataclassObject`: Auto-dataclass with behaviors
389
+ - `ProtocolClass` / `Protocol`, `ProtocolMutable`,
390
+ `DataclassProtocol`, `DataclassProtocolMutable`: Protocol classes
391
+ with behaviors
392
+ - Mutable variants for each
393
+
394
+ `decorators.py`
395
+ : Standard class decorators:
396
+
397
+ - `with_standard_behaviors`: Apply behaviors to existing class
398
+ - `dataclass_with_standard_behaviors`: Create dataclass with behaviors
399
+ - `class_factory`: Generic factory for creating custom metaclasses
400
+
401
+ `dynadoc.py`
402
+ : Dynadoc configuration for standard behaviors. Provides documentation
403
+ fragments that describe behaviors automatically applied to classes.
404
+
405
+ `modules.py`
406
+ : Module reclassification utilities:
407
+
408
+ - `reclassify_module`: Apply behaviors to single module
409
+ - `finalize_module`: Complete module initialization (used by package)
410
+
411
+ `nomina.py`
412
+ : Standard-specific naming types and constants. Defines behavior labels
413
+ and attribute naming functions.
414
+
415
+ All package modules use the standard `__` import pattern as documented
416
+ in the common architecture guide.
417
+
418
+ ### Component Integration
419
+
420
+ #### Import Hub Usage
421
+
422
+ All modules access common dependencies through the `__` import hub:
423
+
424
+ ```python
425
+ # In any module at sources/classcore/
426
+ from . import __
427
+
428
+ # Use abbreviated imports
429
+ def example( items: __.cabc.Sequence[ str ] ) -> __.typx.Any:
430
+ return __.funct.partial( some_function, items )
431
+ ```
432
+
433
+ This pattern:
434
+
435
+ - Eliminates redundant import statements
436
+ - Provides consistent naming across modules
437
+ - Centralizes import changes to `__/imports.py`
438
+ - Reduces module namespace pollution
439
+
440
+ #### Subpackage Extension
441
+
442
+ The `standard/` subpackage demonstrates the cascading import pattern.
443
+ Its `__.py` inherits parent imports and can add specialized dependencies:
444
+
445
+ ```python
446
+ # sources/classcore/standard/__.py
447
+ from ..__ import * # Inherit all parent imports
448
+ from ..exceptions import * # Add package exceptions
449
+ ```
450
+
451
+ Modules in `standard/` use the same import pattern but gain access to both
452
+ parent and subpackage-specific imports.
453
+
454
+ ## Sister Projects
455
+
456
+ - **[frigid](https://github.com/emcd/python-frigid)** — Fully immutable data structures. Like classcore, but values cannot be added or changed after creation. Useful for configuration objects, constants, and thread-safe data carriers.
457
+ - **[accretive](https://github.com/emcd/python-accretive)** — Grow-only data structures. Values can be added (never modified or removed) after creation. Useful for registries, plugin systems, and sticky-state configurations.
@@ -23,6 +23,7 @@
23
23
  # ruff: noqa: F401
24
24
 
25
25
 
26
+ import abc
26
27
  import collections.abc as cabc
27
28
  import dataclasses as dcls
28
29
  import functools as funct
@@ -37,3 +38,6 @@ import dynadoc as ddoc
37
38
  import typing_extensions as typx
38
39
  # --- BEGIN: Injected by Copier ---
39
40
  # --- END: Injected by Copier ---
41
+
42
+ # --- BEGIN: Injected by Copier ---
43
+ # --- END: Injected by Copier ---
@@ -62,7 +62,7 @@ from .factories import *
62
62
 
63
63
 
64
64
  __version__: __.typx.Annotated[ str, __.ddoc.Visibilities.Reveal ]
65
- __version__ = '1.10'
65
+ __version__ = '1.12'
66
66
 
67
67
 
68
68
  standard.finalize_module(
@@ -89,8 +89,14 @@ def produce_class_construction_decorator(
89
89
  decorators: _nomina.Decorators[ __.T ] = ( ),
90
90
  **arguments: __.typx.Any,
91
91
  ) -> type[ object ]:
92
- superf = super( clscls, clscls_ ).__new__
93
- # TODO? Short-circuit if not at start of MRO.
92
+ superf = __.typx.cast(
93
+ _nomina.ClassConstructorLigation,
94
+ super( clscls, clscls_ ).__new__ )
95
+ if clscls is not clscls_:
96
+ # Parent metaclass within a hierarchy: delegate without
97
+ # duplicating preprocessing or decoration.
98
+ return superf(
99
+ clscls_, name, bases, namespace, **arguments )
94
100
  return constructor(
95
101
  clscls_, superf,
96
102
  name, bases, namespace, arguments, decorators )
@@ -107,7 +113,11 @@ def produce_class_construction_decorator(
107
113
  decorators: _nomina.Decorators[ __.T ] = ( ),
108
114
  **arguments: __.typx.Any,
109
115
  ) -> type[ object ]:
110
- # TODO? Short-circuit if not at start of MRO.
116
+ if clscls is not clscls_:
117
+ # Parent metaclass within a hierarchy: delegate without
118
+ # duplicating preprocessing or decoration.
119
+ return original(
120
+ clscls_, name, bases, namespace, **arguments )
111
121
  return constructor(
112
122
  clscls_, original,
113
123
  name, bases, namespace, arguments, decorators )
@@ -138,7 +148,11 @@ def produce_class_initialization_decorator(
138
148
  cls: type, *posargs: __.typx.Any, **nomargs: __.typx.Any
139
149
  ) -> None:
140
150
  ligation = super( clscls, cls ).__init__
141
- # TODO? Short-circuit if not at start of MRO.
151
+ if clscls is not type( cls ):
152
+ # Parent metaclass within a hierarchy: delegate without
153
+ # duplicating completion logic.
154
+ ligation( *posargs, **nomargs )
155
+ return
142
156
  initializer( cls, ligation, posargs, nomargs )
143
157
 
144
158
  clscls.__init__ = initialize_with_super
@@ -149,8 +163,12 @@ def produce_class_initialization_decorator(
149
163
  def initialize_with_original(
150
164
  cls: type, *posargs: __.typx.Any, **nomargs: __.typx.Any
151
165
  ) -> None:
166
+ if clscls is not type( cls ):
167
+ # Parent metaclass within a hierarchy: delegate without
168
+ # duplicating completion logic.
169
+ original( cls, *posargs, **nomargs )
170
+ return
152
171
  ligation = __.funct.partial( original, cls )
153
- # TODO? Short-circuit if not at start of MRO.
154
172
  initializer( cls, ligation, posargs, nomargs )
155
173
 
156
174
  clscls.__init__ = initialize_with_original