classcore 1.10__tar.gz → 1.11__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.11/.gitignore +7 -0
  2. {classcore-1.10 → classcore-1.11}/PKG-INFO +9 -2
  3. {classcore-1.10 → classcore-1.11}/README.rst +6 -0
  4. {classcore-1.10 → classcore-1.11}/pyproject.toml +11 -5
  5. classcore-1.11/sources/classcore/README.md +452 -0
  6. {classcore-1.10 → classcore-1.11}/sources/classcore/__/imports.py +3 -0
  7. {classcore-1.10 → classcore-1.11}/sources/classcore/__init__.py +1 -1
  8. {classcore-1.10 → classcore-1.11}/sources/classcore/nomina.py +34 -0
  9. classcore-1.11/sources/classcore/standard/README.md +202 -0
  10. {classcore-1.10 → classcore-1.11}/sources/classcore/standard/classes.py +10 -24
  11. {classcore-1.10 → classcore-1.11}/sources/classcore/standard/nomina.py +0 -1
  12. classcore-1.10/.gitignore +0 -15
  13. {classcore-1.10 → classcore-1.11}/LICENSE.txt +0 -0
  14. {classcore-1.10 → classcore-1.11}/sources/classcore/__/__init__.py +0 -0
  15. {classcore-1.10 → classcore-1.11}/sources/classcore/__/doctab.py +0 -0
  16. {classcore-1.10 → classcore-1.11}/sources/classcore/__/nomina.py +0 -0
  17. {classcore-1.10 → classcore-1.11}/sources/classcore/decorators.py +0 -0
  18. {classcore-1.10 → classcore-1.11}/sources/classcore/exceptions.py +0 -0
  19. {classcore-1.10 → classcore-1.11}/sources/classcore/factories.py +0 -0
  20. {classcore-1.10 → classcore-1.11}/sources/classcore/py.typed +0 -0
  21. {classcore-1.10 → classcore-1.11}/sources/classcore/standard/__.py +0 -0
  22. {classcore-1.10 → classcore-1.11}/sources/classcore/standard/__init__.py +0 -0
  23. {classcore-1.10 → classcore-1.11}/sources/classcore/standard/behaviors.py +0 -0
  24. {classcore-1.10 → classcore-1.11}/sources/classcore/standard/decorators.py +0 -0
  25. {classcore-1.10 → classcore-1.11}/sources/classcore/standard/dynadoc.py +0 -0
  26. {classcore-1.10 → classcore-1.11}/sources/classcore/standard/modules.py +0 -0
  27. {classcore-1.10 → classcore-1.11}/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
1
  Metadata-Version: 2.4
2
2
  Name: classcore
3
- Version: 1.10
3
+ Version: 1.11
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
@@ -348,6 +350,10 @@ directory = 'repair'
348
350
  name = 'Repairs'
349
351
  showcontent = true
350
352
 
353
+ [tool.vibelinter]
354
+ context = 3
355
+ exclude_paths = [ '.auxiliary/**', '.venv/**', 'tests/**', ]
356
+
351
357
  [tool.vulture]
352
358
  paths = [ '.auxiliary/configuration/vulturefood.py', 'sources' ]
353
359
  min_confidence = 60
@@ -0,0 +1,452 @@
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
+ - `ProtocolObject`: Protocol class with immutability and concealment
87
+ - Variants for selective mutability (`ObjectMutable`, etc.)
88
+
89
+ **Metaclasses:**
90
+ - `Class`: Metaclass for standard classes
91
+ - `Dataclass`: Metaclass that auto-applies dataclass decorator
92
+ - `Protocol`: Metaclass for protocol classes
93
+ - Mutable variants of each
94
+
95
+ **Decorators:**
96
+ - `class_with_standard_behaviors`: Add behaviors to existing classes
97
+ - `dataclass_with_standard_behaviors`: Dataclass creation with behaviors
98
+ - `protocol_with_standard_behaviors`: Protocol creation with behaviors
99
+
100
+ **Module Utilities:**
101
+ - `reclassify_module`: Apply immutability and concealment to module objects
102
+ - `finalize_module`: Complete module initialization with standard behaviors
103
+
104
+ ### Utility Layer
105
+
106
+ Location: `utilities.py`
107
+
108
+ Provides essential operations for metaclass machinery:
109
+
110
+ - `mangle_name`: Creates unique attribute names using SHA-256 hashing to
111
+ avoid inheritance collisions
112
+ - `getattr0/setattr0/delattr0`: Access mangled attributes while respecting
113
+ `__slots__`
114
+ - `repair_class_reproduction`: Fixes closure cells when decorators replace
115
+ classes (CPython/PyPy-specific)
116
+ - `describe_object`: Generates human-readable object descriptions for error
117
+ messages
118
+
119
+ ## Data Flow
120
+
121
+ ### Class Creation Flow
122
+
123
+ 1. User defines class with standard metaclass or inherits from standard base
124
+ 2. Metaclass `__new__` invoked via `produce_class_constructor`
125
+ 3. Preprocessors modify bases, namespace, arguments, decorators
126
+ 4. Superclass `__new__` creates initial class object
127
+ 5. Progress flag prevents recursive processing
128
+ 6. Postprocessors execute (e.g., adding behavior configurations)
129
+ 7. Decorators applied via `apply_decorators`
130
+ 8. If decorator replaces class, closures repaired
131
+ 9. Metaclass `__init__` invoked via `produce_class_initializer`
132
+ 10. Completers execute (e.g., freezing behaviors)
133
+ 11. Progress flag cleared
134
+ 12. Fully initialized class returned
135
+
136
+ ### Attribute Access Flow (Instances)
137
+
138
+ **Assignment (`obj.attr = value`):**
139
+ 1. `__setattr__` intercepted by assigner core function
140
+ 2. Check for immutability behavior flag
141
+ 3. If immutable, verify against mutables (names, regexes, predicates)
142
+ 4. If allowed, delegate to ligation (super or core override)
143
+ 5. If denied, raise `AttributeImmutability` error
144
+
145
+ **Visibility (`dir(obj)`):**
146
+ 1. `__dir__` intercepted by surveyor core function
147
+ 2. Collect all attributes from object and class hierarchy
148
+ 3. Check visibility verifiers (names, regexes, predicates)
149
+ 4. Filter attributes based on verifiers
150
+ 5. Return filtered set
151
+
152
+ ## Key Architectural Patterns
153
+
154
+ ### Factory Pattern
155
+
156
+ Metaclass components are produced by factory functions rather than fixed
157
+ inheritance hierarchies. This enables composition of behaviors and runtime
158
+ customization of class creation logic.
159
+
160
+ ### Decorator Composition
161
+
162
+ Multiple decorators can be applied in sequence, with automatic handling of
163
+ class replacements. The `decoration_by` function enables declarative
164
+ composition of decorator stacks.
165
+
166
+ ### Hook-Based Extension
167
+
168
+ Every critical point in the class lifecycle offers hooks:
169
+
170
+ - Preprocessors: Modify class construction inputs
171
+ - Postprocessors: Augment constructed classes
172
+ - Completers: Finalize initialized classes
173
+ - Preparers: Adjust decorator lists before application
174
+
175
+ ### Verifier Pattern
176
+
177
+ Behavior exclusions (mutability, visibility) use a uniform verifier interface:
178
+
179
+ - Literal `'*'`: Allow all
180
+ - Sequence of strings: Exact name matches
181
+ - Sequence of `re.Pattern`: Regex matches
182
+ - Sequence of callables: Predicate functions
183
+
184
+ This provides flexible, user-customizable behavior rules.
185
+
186
+ ### Core Function Replacement
187
+
188
+ Critical behaviors (assignment, deletion, visibility) can be replaced entirely
189
+ by providing alternative "core" functions. This enables deep customization
190
+ without subclassing.
191
+
192
+ ## Integration Points
193
+
194
+ ### Dataclasses
195
+
196
+ Standard metaclasses automatically apply `dataclasses.dataclass` during
197
+ class construction, with configurability for `frozen`, `slots`, etc. The
198
+ decorator application system ensures proper handling of the class replacement
199
+ that occurs with `slots=True`.
200
+
201
+ ### Protocols
202
+
203
+ Standard protocol classes combine `typing.Protocol` with immutability and
204
+ concealment. Special handling for ABC-related mutable attributes
205
+ (`_abc_cache`, `_abc_registry`, etc.) ensures protocol functionality.
206
+
207
+ ### Type Checkers
208
+
209
+ Metaclasses use `@dataclass_transform` decorator to signal dataclass
210
+ behavior to type checkers. This enables proper type inference and checking
211
+ for classes produced by standard metaclasses.
212
+
213
+ ### Module Objects
214
+
215
+ Module reclassification applies class-level behaviors to module objects,
216
+ enabling immutable, concealed module namespaces for API control.
217
+
218
+ ## Dependencies
219
+
220
+ ### External Dependencies
221
+
222
+ The library depends on standard library modules only:
223
+
224
+ - `dataclasses`: Automatic dataclass generation
225
+ - `functools`: Decorator utilities and partials
226
+ - `hashlib`: Attribute name mangling (SHA-256)
227
+ - `inspect`: Class and function introspection
228
+ - `platform`: Python implementation detection for platform-specific repairs
229
+ - `re`: Regular expression support for verifiers
230
+ - `typing`: Type hints and protocol support
231
+ - `collections.abc`: Abstract base classes
232
+
233
+ ### Internal Dependencies
234
+
235
+ - `dynadoc`: Documentation generation with fragment interpolation
236
+ - `frigid`: Immutable data structures for internal use
237
+ - `falsifier`: Base classes for falsey objects
238
+
239
+ ## Extension Points
240
+
241
+ Users can extend the library at multiple levels:
242
+
243
+ **Decorator Level**
244
+ Create custom class decorators and compose with `decoration_by`.
245
+
246
+ **Metaclass Level**
247
+ Build custom metaclasses using factory functions with custom hooks.
248
+
249
+ **Behavior Level**
250
+ Replace core functions for assignment, deletion, visibility, or error
251
+ provision.
252
+
253
+ **Verifier Level**
254
+ Implement custom predicate functions for mutability/visibility rules.
255
+
256
+ **Hook Level**
257
+ Provide preprocessors, postprocessors, completers, or preparers for
258
+ lifecycle customization.
259
+
260
+ ## Filesystem Organization
261
+
262
+ ### Root Directory
263
+
264
+ ```
265
+ python-classcore/
266
+ ├── LICENSE.txt # Project license
267
+ ├── README.rst # Project overview and quick start
268
+ ├── pyproject.toml # Python packaging and tool configuration
269
+ ├── documentation/ # Sphinx documentation source
270
+ ├── sources/ # All source code
271
+ ├── tests/ # Test suites
272
+ └── .auxiliary/ # Development workspace
273
+ ```
274
+
275
+ ### Package Structure
276
+
277
+ ```
278
+ sources/
279
+ └── classcore/ # Main Python package
280
+ ├── __/ # Centralized import hub
281
+ │ ├── __init__.py # Re-exports core utilities
282
+ │ ├── imports.py # External library imports
283
+ │ ├── nomina.py # Naming constants
284
+ │ └── doctab.py # Documentation table fragments
285
+ ├── __init__.py # Package entry point
286
+ ├── py.typed # Type checking marker
287
+ ├── decorators.py # Class decorator utilities
288
+ ├── exceptions.py # Package exception classes
289
+ ├── factories.py # Metaclass factory functions
290
+ ├── nomina.py # Public naming types and utilities
291
+ ├── utilities.py # Class manipulation utilities
292
+ └── standard/ # Standard behaviors subpackage
293
+ ├── __.py # Inherits parent imports
294
+ ├── __init__.py # Subpackage entry point
295
+ ├── behaviors.py # Immutability and concealment logic
296
+ ├── classes.py # Standard metaclasses and base classes
297
+ ├── decorators.py # Standard class decorators
298
+ ├── dynadoc.py # Documentation configuration
299
+ ├── modules.py # Module reclassification utilities
300
+ └── nomina.py # Standard-specific naming types
301
+ ```
302
+
303
+ ### Module Responsibilities
304
+
305
+ #### Core Package (`sources/classcore/`)
306
+
307
+ `__/__init__.py`
308
+ : Re-exports commonly used imports from `imports.py` for convenient access
309
+ via `from . import __` in all package modules.
310
+
311
+ `__/imports.py`
312
+ : Centralizes all external library imports. Provides abbreviated aliases for
313
+ frequently used types and modules (e.g., `cabc` for
314
+ `collections.abc`, `typx` for `typing`).
315
+
316
+ `__/nomina.py`
317
+ : Package-specific naming constants and utilities used internally by the
318
+ `__` import hub.
319
+
320
+ `__/doctab.py`
321
+ : Documentation table with reusable fragments for dynadoc interpolation.
322
+
323
+ `__init__.py`
324
+ : Package entry point. Exports public API, applies standard behaviors to
325
+ package module, sets version.
326
+
327
+ `decorators.py`
328
+ : Class decorator utilities:
329
+
330
+ - `apply_decorators`: Apply decorator sequences with class replacement
331
+ handling
332
+ - `decoration_by`: Compose multiple decorators
333
+ - `produce_class_construction_decorator`: Create metaclass `__new__`
334
+ decorators
335
+ - `produce_class_initialization_decorator`: Create metaclass `__init__`
336
+ decorators
337
+
338
+ `exceptions.py`
339
+ : Package exception hierarchy. All exceptions use standard behaviors
340
+ (immutability and concealment) themselves.
341
+
342
+ `factories.py`
343
+ : Metaclass component factories:
344
+
345
+ - `produce_class_constructor`: Generate customizable `__new__` with
346
+ hooks
347
+ - `produce_class_initializer`: Generate customizable `__init__` with
348
+ hooks
349
+
350
+ `nomina.py`
351
+ : Public naming types, type aliases, and protocols used throughout the
352
+ package. Defines interfaces for hooks, verifiers, and core functions.
353
+
354
+ `utilities.py`
355
+ : Class manipulation utilities:
356
+
357
+ - `mangle_name`: Create unique attribute names
358
+ - `getattr0/setattr0/delattr0`: Mangled attribute access
359
+ - `repair_class_reproduction`: Fix closures after class replacement
360
+ - `describe_object`: Generate error message descriptions
361
+
362
+ #### Standard Subpackage (`sources/classcore/standard/`)
363
+
364
+ `__.py`
365
+ : Inherits all imports from parent `__` via `from ..__ import *`.
366
+ Demonstrates the cascading import pattern for subpackages.
367
+
368
+ `__init__.py`
369
+ : Subpackage entry point. Exports all standard classes, decorators, and
370
+ utilities. Applies standard behaviors to subpackage module.
371
+
372
+ `behaviors.py`
373
+ : Core implementation of standard behaviors:
374
+
375
+ - `assign_attribute_if_mutable`: Conditional attribute assignment
376
+ - `delete_attribute_if_mutable`: Conditional attribute deletion
377
+ - `survey_visible_attributes`: Filter attributes for `dir()`
378
+ - Verifier processing for names, regexes, and predicates
379
+
380
+ `classes.py`
381
+ : Standard metaclasses and base classes:
382
+
383
+ - `Class` / `Object`: Standard class with full behaviors
384
+ - `Dataclass` / `DataclassObject`: Auto-dataclass with behaviors
385
+ - `Protocol` / `ProtocolObject`: Protocol with behaviors
386
+ - Mutable variants for each
387
+
388
+ `decorators.py`
389
+ : Standard class decorators:
390
+
391
+ - `class_with_standard_behaviors`: Apply behaviors to existing class
392
+ - `dataclass_with_standard_behaviors`: Create dataclass with behaviors
393
+ - `protocol_with_standard_behaviors`: Create protocol with behaviors
394
+ - `class_factory`: Generic factory for creating custom metaclasses
395
+
396
+ `dynadoc.py`
397
+ : Dynadoc configuration for standard behaviors. Provides documentation
398
+ fragments that describe behaviors automatically applied to classes.
399
+
400
+ `modules.py`
401
+ : Module reclassification utilities:
402
+
403
+ - `reclassify_module`: Apply behaviors to single module
404
+ - `finalize_module`: Complete module initialization (used by package)
405
+
406
+ `nomina.py`
407
+ : Standard-specific naming types and constants. Defines behavior labels
408
+ and attribute naming functions.
409
+
410
+ All package modules use the standard `__` import pattern as documented
411
+ in the common architecture guide.
412
+
413
+ ### Component Integration
414
+
415
+ #### Import Hub Usage
416
+
417
+ All modules access common dependencies through the `__` import hub:
418
+
419
+ ```python
420
+ # In any module at sources/classcore/
421
+ from . import __
422
+
423
+ # Use abbreviated imports
424
+ def example( items: __.cabc.Sequence[ str ] ) -> __.typx.Any:
425
+ return __.funct.partial( some_function, items )
426
+ ```
427
+
428
+ This pattern:
429
+
430
+ - Eliminates redundant import statements
431
+ - Provides consistent naming across modules
432
+ - Centralizes import changes to `__/imports.py`
433
+ - Reduces module namespace pollution
434
+
435
+ #### Subpackage Extension
436
+
437
+ The `standard/` subpackage demonstrates the cascading import pattern.
438
+ Its `__.py` inherits parent imports and can add specialized dependencies:
439
+
440
+ ```python
441
+ # sources/classcore/standard/__.py
442
+ from ..__ import * # Inherit all parent imports
443
+ from ..exceptions import * # Add package exceptions
444
+ ```
445
+
446
+ Modules in `standard/` use the same import pattern but gain access to both
447
+ parent and subpackage-specific imports.
448
+
449
+ ## Sister Projects
450
+
451
+ - **[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.
452
+ - **[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.
@@ -37,3 +37,6 @@ import dynadoc as ddoc
37
37
  import typing_extensions as typx
38
38
  # --- BEGIN: Injected by Copier ---
39
39
  # --- END: Injected by Copier ---
40
+
41
+ # --- BEGIN: Injected by Copier ---
42
+ # --- 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.11'
66
66
 
67
67
 
68
68
  standard.finalize_module(
@@ -64,6 +64,40 @@ DecoratorsMutable: __.typx.TypeAlias = __.typx.Annotated[
64
64
  ''' ),
65
65
  ]
66
66
 
67
+ ClassDecorator: __.typx.TypeAlias = __.typx.Annotated[
68
+ __.cabc.Callable[ [ type[ __.U ] ], type[ __.U ] ],
69
+ __.ddoc.Doc(
70
+ ''' Class decorator.
71
+
72
+ Takes class argument and returns class.
73
+ ''' ),
74
+ ]
75
+ ClassDecorators: __.typx.TypeAlias = __.typx.Annotated[
76
+ __.cabc.Sequence[ ClassDecorator[ __.U ] ],
77
+ __.ddoc.Doc(
78
+ ''' Sequence of class decorators.
79
+
80
+ Each element takes a class argument and returns a class.
81
+ ''' ),
82
+ ]
83
+ ClassDecoratorFactory: __.typx.TypeAlias = __.typx.Annotated[
84
+ __.cabc.Callable[ ..., ClassDecorator[ __.U ] ],
85
+ __.ddoc.Doc(
86
+ ''' Factory that produces class decorators.
87
+
88
+ Returns a class decorator when called.
89
+ ''' ),
90
+ ]
91
+ ModuleReclassifier: __.typx.TypeAlias = __.typx.Annotated[
92
+ __.cabc.Callable[ [ __.cabc.Mapping[ str, __.typx.Any ] ], None ],
93
+ __.ddoc.Doc(
94
+ ''' Reclassifies module attributes.
95
+
96
+ Takes a mapping of attribute names to values and applies
97
+ reclassification (e.g., immutability and concealment).
98
+ ''' ),
99
+ ]
100
+
67
101
  DecorationPreparer: __.typx.TypeAlias = __.typx.Annotated[
68
102
  __.cabc.Callable[ [ type[ __.U ], DecoratorsMutable[ __.U ] ], None ],
69
103
  __.ddoc.Doc(
@@ -0,0 +1,202 @@
1
+ # classcore.standard
2
+
3
+ The `standard` subpackage provides pre-configured implementations of
4
+ classcore's behaviors for common use cases. It includes base classes,
5
+ metaclasses, decorators, and module utilities that combine immutability and
6
+ concealment with standard Python features like dataclasses and protocols.
7
+
8
+ ## Base Classes
9
+
10
+ ### `Object`
11
+
12
+ Standard class with full immutability and concealment behaviors. Instances
13
+ have immutable attributes and concealed internal attributes.
14
+
15
+ ```python
16
+ from classcore.standard import Object
17
+
18
+ class Point(Object):
19
+ x: float
20
+ y: float
21
+ ```
22
+
23
+ ### `DataclassObject`
24
+
25
+ Automatic dataclass conversion with standard behaviors. Unlike
26
+ `dataclass(frozen=True)`, attributes can still be manipulated via
27
+ `__post_init__`.
28
+
29
+ ```python
30
+ from dataclasses import field
31
+ from math import sqrt
32
+ from classcore.standard import DataclassObject
33
+
34
+ class Point2d(DataclassObject):
35
+ x: float
36
+ y: float
37
+ hypotenuse: float = field(init=False)
38
+ def __post_init__(self) -> None:
39
+ x, y = self.x, self.y
40
+ self.hypotenuse = sqrt(x*x + y*y)
41
+ ```
42
+
43
+ ### `ProtocolObject`
44
+
45
+ Protocol class with immutability and concealment. Combines `typing.Protocol`
46
+ with standard behaviors. Immutability and concealment are inherited by
47
+ subclassed implementations.
48
+
49
+ ### Mutable Variants
50
+
51
+ - `ObjectMutable`: Object with concealment only (no immutability)
52
+ - `DataclassObjectMutable`: DataclassObject with concealment only
53
+ - `ProtocolObjectMutable`: ProtocolObject with concealment only
54
+
55
+ ## Metaclasses
56
+
57
+ ### `Class`
58
+
59
+ Metaclass for standard classes. Provides immutability and concealment to
60
+ any class that uses this metaclass.
61
+
62
+ ### `Dataclass`
63
+
64
+ Metaclass that automatically applies `dataclasses.dataclass` during class
65
+ construction. Configurable for `frozen`, `slots`, etc.
66
+
67
+ ### `Protocol`
68
+
69
+ Metaclass for protocol classes. Combines `typing.Protocol` with standard
70
+ behaviors.
71
+
72
+ ### Mutable Variants
73
+
74
+ - `ClassMutable`: Metaclass with concealment only
75
+ - `DataclassMutable`: Dataclass metaclass with concealment only
76
+ - `ProtocolMutable`: Protocol metaclass with concealment only
77
+
78
+ ## Decorators
79
+
80
+ ### `class_with_standard_behaviors`
81
+
82
+ Apply standard behaviors to an existing class.
83
+
84
+ ```python
85
+ from classcore.standard import class_with_standard_behaviors
86
+
87
+ @class_with_standard_behaviors()
88
+ class ExistingClass:
89
+ x: int = 10
90
+ ```
91
+
92
+ ### `dataclass_with_standard_behaviors`
93
+
94
+ Create a dataclass with standard behaviors applied.
95
+
96
+ ```python
97
+ from classcore.standard import dataclass_with_standard_behaviors
98
+
99
+ @dataclass_with_standard_behaviors()
100
+ class Point:
101
+ x: float
102
+ y: float
103
+ ```
104
+
105
+ ### `protocol_with_standard_behaviors`
106
+
107
+ Create a protocol with standard behaviors applied.
108
+
109
+ ### `class_factory`
110
+
111
+ Generic factory for creating custom metaclasses with standard behaviors.
112
+
113
+ ## Module Utilities
114
+
115
+ ### `reclassify_module`
116
+
117
+ Apply immutability and concealment to a single module object.
118
+
119
+ ```python
120
+ from classcore.standard import reclassify_module
121
+
122
+ reclassify_module(__name__)
123
+ ```
124
+
125
+ ### `finalize_module`
126
+
127
+ Complete module initialization with standard behaviors. Used internally by
128
+ the package to apply behaviors to all subpackage modules.
129
+
130
+ ### `reclassify_modules` (deprecated)
131
+
132
+ Apply behaviors to entire packages recursively. Deprecated in favor of
133
+ `finalize_module` for individual module control.
134
+
135
+ ## Behavior System
136
+
137
+ ### Immutability
138
+
139
+ Attributes are immutable by default. Assignment attempts raise
140
+ `AttributeImmutability`. Deletion attempts raise
141
+ `AttributeDeletionImmutability`.
142
+
143
+ ### Concealment
144
+
145
+ Internal attributes are concealed from `dir()` output. Only public
146
+ attributes and explicitly visible attributes are shown.
147
+
148
+ ### Selective Mutability
149
+
150
+ Specify mutable attributes using verifiers:
151
+
152
+ - **Names**: Exact string matches
153
+ - **Regexes**: Regular expression patterns
154
+ - **Predicates**: Custom callable functions
155
+
156
+ ```python
157
+ from classcore.standard import ObjectMutableByNames
158
+
159
+ class Config(ObjectMutableByNames, mutable_names=('debug', 'verbose')):
160
+ debug: bool = False
161
+ verbose: bool = False
162
+ name: str = 'default'
163
+ ```
164
+
165
+ ### Verifier Interface
166
+
167
+ Behavior exclusions use a uniform verifier interface:
168
+
169
+ - Literal `'*'`: Allow all
170
+ - Sequence of strings: Exact name matches
171
+ - Sequence of `re.Pattern`: Regex matches
172
+ - Sequence of callables: Predicate functions
173
+
174
+ ## Integration with Dataclasses
175
+
176
+ Standard metaclasses automatically apply `dataclasses.dataclass` during
177
+ class construction. The decorator application system ensures proper handling
178
+ of the class replacement that occurs with `slots=True`.
179
+
180
+ Key features:
181
+ - `__post_init__` can still modify attributes (unlike `frozen=True`)
182
+ - Slot classes are properly supported
183
+ - Type checkers recognize the dataclass transform
184
+
185
+ ## Integration with Protocols
186
+
187
+ Standard protocol classes combine `typing.Protocol` with immutability and
188
+ concealment. Special handling for ABC-related mutable attributes
189
+ (`_abc_cache`, `_abc_registry`, etc.) ensures protocol functionality.
190
+
191
+ ## Import Pattern
192
+
193
+ The standard subpackage uses the cascading import pattern:
194
+
195
+ ```python
196
+ # sources/classcore/standard/__.py
197
+ from ..__ import * # Inherit all parent imports
198
+ from ..exceptions import * # Add package exceptions
199
+ ```
200
+
201
+ Modules in `standard/` use the same `__` import pattern as the parent
202
+ package, gaining access to both parent and subpackage-specific imports.
@@ -27,6 +27,12 @@ from . import dynadoc as _dynadoc
27
27
  from . import nomina as _nomina
28
28
 
29
29
 
30
+ _abc_class_mutables = (
31
+ '_abc_cache',
32
+ '_abc_negative_cache',
33
+ '_abc_negative_cache_version',
34
+ '_abc_registry',
35
+ )
30
36
  _dynadoc_configuration = (
31
37
  _dynadoc.produce_dynadoc_configuration( table = __.fragments ) )
32
38
  _class_factory = __.funct.partial(
@@ -208,12 +214,7 @@ class DataclassObjectMutable( metaclass = DataclassMutable ):
208
214
  class Protocol(
209
215
  __.typx.Protocol,
210
216
  metaclass = ProtocolClass,
211
- class_mutables = (
212
- '_abc_cache',
213
- '_abc_negative_cache',
214
- '_abc_negative_cache_version',
215
- '_abc_registry',
216
- ),
217
+ class_mutables = _abc_class_mutables,
217
218
  ):
218
219
  ''' Standard base protocol class. '''
219
220
 
@@ -226,12 +227,7 @@ class Protocol(
226
227
  class ProtocolMutable(
227
228
  __.typx.Protocol,
228
229
  metaclass = ProtocolClass,
229
- class_mutables = (
230
- '_abc_cache',
231
- '_abc_negative_cache',
232
- '_abc_negative_cache_version',
233
- '_abc_registry',
234
- ),
230
+ class_mutables = _abc_class_mutables,
235
231
  instances_mutables = '*',
236
232
  ):
237
233
  ''' Base protocol class with mutable instance attributes. '''
@@ -245,12 +241,7 @@ class ProtocolMutable(
245
241
  class DataclassProtocol(
246
242
  __.typx.Protocol,
247
243
  metaclass = ProtocolDataclass,
248
- class_mutables = (
249
- '_abc_cache',
250
- '_abc_negative_cache',
251
- '_abc_negative_cache_version',
252
- '_abc_registry',
253
- ),
244
+ class_mutables = _abc_class_mutables,
254
245
  ):
255
246
  ''' Standard base protocol dataclass. '''
256
247
 
@@ -263,12 +254,7 @@ class DataclassProtocol(
263
254
  class DataclassProtocolMutable(
264
255
  __.typx.Protocol,
265
256
  metaclass = ProtocolDataclassMutable,
266
- class_mutables = (
267
- '_abc_cache',
268
- '_abc_negative_cache',
269
- '_abc_negative_cache_version',
270
- '_abc_registry',
271
- ),
257
+ class_mutables = _abc_class_mutables,
272
258
  ):
273
259
  ''' Base protocol dataclass with mutable instance attributes. '''
274
260
 
@@ -109,7 +109,6 @@ class ClassPreparer( __.typx.Protocol ):
109
109
 
110
110
 
111
111
  DynadocConfiguration: __.typx.TypeAlias = __.cabc.Mapping[ str, __.typx.Any ]
112
- # TODO: Use argument type aliases from 'dynadoc' package.
113
112
  DynadocContextArgument: __.typx.TypeAlias = __.typx.Annotated[
114
113
  __.ddoc.Context,
115
114
  __.ddoc.Doc(
classcore-1.10/.gitignore DELETED
@@ -1,15 +0,0 @@
1
- .env
2
- .claude
3
- .gemini
4
- .mcp.json
5
- .opencode
6
- .*.swp
7
- AGENTS.md
8
- CLAUDE.md
9
- CONVENTIONS.md
10
- GEMINI.md
11
- opencode.jsonc
12
- __pycache__/
13
- bugs/
14
- build/
15
- dist/
File without changes