McRogueFace/tools
John McCardle 464af6a549 fix(bindings): make dynamic module attributes dir()-discoverable
mcrfpy.current_scene, .scenes, .timers, .animations, .default_transition,
.default_transition_duration and .save_dir were served by a PEP-562 module
__getattr__. getattr/hasattr worked, but the names were absent from
dir(mcrfpy) -- and all three generators (docs, stubs, api manifest) discover
module symbols via dir(). So the single most common idiom in the engine,
`mcrfpy.current_scene = ...`, appeared in no generated documentation at all,
and had to be hand-authored and hand-verified against a live binary for the
website.

Replace the __getattr__/tp_setattro string-matching with real getset
descriptors on McRFPyModuleType (which was already a custom module type, so
this is a small change) carrying MCRF_PROPERTY docstrings.

Descriptors alone are NOT sufficient, contrary to what the issue proposed:
CPython's module.__dir__ reports only the module __dict__ keys, so type-level
descriptors stay invisible to dir(). Verified empirically, then fixed by
overriding __dir__ on the module type to union the two. This is the part that
actually closes the bug.

The generators then need to read the DESCRIPTOR, not getattr()'s value: at
generation time current_scene is None, which is how a first pass typed it
`current_scene: NoneType`. All three now introspect type(mcrfpy), and
api_delta.py learns a module_attributes section so these can no longer drift
silently. The api-surface snapshot gets its own dynamic-attribute section for
the same reason -- keying it on the value type would make the golden flip
depending on whether a scene happened to be active.

Behavior preserved: read-only attrs still raise AttributeError on assignment,
range/type validation on the writable ones is unchanged, and unknown
attributes still raise AttributeError.

Suite 331/331.

closes #356
2026-07-13 23:47:04 -04:00
..
hooks Untrack generated docs; add API manifest infra and pre-commit hook 2026-07-11 20:57:31 -04:00
api_delta.py fix(bindings): make dynamic module attributes dir()-discoverable 2026-07-13 23:47:04 -04:00
audit_pymethoddef.py Add tools/audit_pymethoddef.py - MCRF_METHOD/MCRF_PROPERTY compliance auditor 2026-04-18 12:30:25 -04:00
build_debug_libs.sh Fix build_debug_libs.sh flag quoting so --asan/--tsan can rebuild 2026-06-21 16:44:33 -04:00
capture_audio_synth_header.py Fix capture_audio_synth_header.py for headless --exec mode 2026-04-18 23:25:17 -04:00
check_frozen_docstrings.sh Add docstring-macro validation scripts for #314 F15 2026-06-21 00:11:15 -04:00
generate_all_docs.sh Wire strict frozen-docstring gate into the doc pipeline (#314 F15) 2026-06-21 06:45:11 -04:00
generate_api_manifest.py fix(bindings): make dynamic module attributes dir()-discoverable 2026-07-13 23:47:04 -04:00
generate_color_table.py Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00
generate_dynamic_docs.py fix(bindings): make dynamic module attributes dir()-discoverable 2026-07-13 23:47:04 -04:00
generate_man_page.sh docs: Complete Phase 7 documentation system with parser fixes and man pages 2025-10-30 21:20:50 -04:00
generate_stubs.py Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00
generate_stubs_v2.py fix(bindings): make dynamic module attributes dir()-discoverable 2026-07-13 23:47:04 -04:00
package.sh Untrack generated docs; add API manifest infra and pre-commit hook 2026-07-11 20:57:31 -04:00
package_stdlib.py distribution packaging 2026-01-09 12:00:59 -05:00
stdlib_modules.yaml distribution packaging 2026-01-09 12:00:59 -05:00
test_link_transform.py feat: add link transformation to documentation generator 2025-10-30 11:39:54 -04:00
test_vector_docs.py feat: convert PyVector properties to use macros 2025-10-30 11:33:49 -04:00
ui_methods_documentation.py Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00
untrack_generated_docs.sh Untrack generated docs; add API manifest infra and pre-commit hook 2026-07-11 20:57:31 -04:00
validate_file_docstrings.sh Add docstring-macro validation scripts for #314 F15 2026-06-21 00:11:15 -04:00