20 Commits

Author SHA1 Message Date
7e1e18d845 Fix ContextTempOverride.logging_set missing enable param on 5.0
Blender 5.0's logging_set has no docstring, so introspection produced
an empty param list. Add fallback to inject the enable: bool param
when the method is discovered without params.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:46:48 +02:00
004b6b11bc Fix Context.property type to tuple[bpy_struct, str, int]
bpy.context.property returns (data_block, data_path, array_index) where
the data_block is a bpy_struct that supports keyframe_insert etc.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:07:53 +02:00
fe6deadfc7 Add overrides to all versions and fix 4.3 temp_override hang
- Copy gpu.state, bpy.path, gpu.types overrides to 4.0-4.5
- Add bpy.msgbus override for 4.5
- Skip temp_override probe on Blender < 4.4 (hangs on 4.3)
- Fix _is_getset_writable to use docstring hints instead of __set__ probe

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 10:41:25 +02:00
3d0c8f74be Discover bpy.msgbus and other C submodules with short __name__
Fix _discover_submodules_via_dir to also match modules whose __name__
is just the attribute name (e.g. "msgbus" instead of "bpy.msgbus").
This discovers bpy.msgbus with clear_by_owner, publish_rna, subscribe_rna.

Also use collections.abc.Sequence instead of _Sequence alias, and add
@property with setter for writable mathutils RNA properties.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 18:32:42 +02:00
175b1bd7e5 Fix fixed-length RNA arrays to use bpy_prop_array instead of list
Fixed-length RNA array properties (e.g. lock_location, color) are
bpy_prop_array at runtime, not list. Only dynamic-length arrays were
correctly typed before.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 17:38:32 +02:00
35a370a412 Map RNA float array properties to mathutils types using subtype
RNA properties with subtypes like TRANSLATION, XYZ, EULER, QUATERNION,
COLOR, MATRIX are now mapped to the corresponding mathutils types
(Vector, Euler, Quaternion, Color, Matrix) instead of list[float].

Also:
- Add gpu.types override for 5.1 (uniform_float accepts mathutils types)
- Fix README snippet to use assert for active_object None check

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 17:32:24 +02:00
a25340f7cf Fix bpy_types.Context annotation not being qualified to bpy.types.Context
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 16:39:50 +02:00
80d5311e33 Add ContextTempOverride as context manager, support __enter__/__exit__ dunders
- Discover ContextTempOverride by probing Context.temp_override() return value
- Add __enter__ and __exit__ to _USEFUL_DUNDERS set
- Fix __enter__ return type to Self, __exit__ params to standard CM signature
- Add Self import to bpy.types generator when used in type annotations
- Remove ContextTempOverride from undefined type map (now a real class)

Remaining conformance issue: context.copy() returns dict[str, object] which
loses specific types when unpacked with **kwargs into temp_override params.
This is an inherent limitation of the copy() -> dict pattern.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 12:47:44 +02:00
a30e772cf8 Discover Python API functions on RNA types (Context.copy, etc.)
Pick up Python functions defined on RNA classes that have RST docstrings
(:rtype: or :type:), indicating they are public API methods rather than
operator/panel implementation details.

Also add Iterable and mathutils imports to bpy.types stub generator
for functions that reference these types in their annotations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 12:34:19 +02:00
cfcb66620a Fix all typecheck errors in source code
- Fix partially unknown types from empty set() literals with annotations
- Use getattr-based indexing for runtime probes on object-typed instances
- Fix val_type annotation for hidden type discovery
- Use raw_type string check instead of isinstance for classmethod detection
- Access classmethod.__func__ via getattr to avoid partial unknown types
- Fix struct base type narrowing in collect_all_type_strings

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 17:29:40 +02:00
b4158d8ca2 Read Python type annotations from function signatures
Functions with type hints (e.g. bpy_extras.anim_utils) now have their
parameter and return types picked up from inspect.signature annotations,
falling back from docstring :type:/:rtype: directives.

- Add _annotation_to_type_str to clean annotation strings
- Replace _bpy_types.X with bpy.types.X, Union[X, Y] with X | Y
- Qualify bare mathutils types (Vector, Matrix, etc.)
- Normalize NoneType to None

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 17:22:21 +02:00
a523a9fcb7 Synthesize __buffer__ for C types supporting buffer protocol (Python 3.12+)
When running on Python 3.12+, probe classes with memoryview() and add
__buffer__(flags: int, /) -> memoryview if the buffer protocol is supported.
This enables type-safe memoryview() calls on mathutils types in Blender 5.1+.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 15:25:27 +01:00
441631d69a Fix all typecheck errors across all 8 Blender versions (4.0-5.1)
- Fix Sequence name clash in bpy.types by never importing it directly
- Qualify all bare Sequence[ to collections.abc.Sequence[ in bpy.types
- Force writable properties to readonly when overriding parent @property
- Auto-detect classes used as generics and add Generic[_T] base
- Include struct bases in type string collection for import detection
- Strip RST backslash-space before generic brackets in docstrings
- Convert "string in ['X', 'Y']" docstring pattern to Literal types
- Strip single backtick RST markup from type annotations
- Fix Callable[[object, ...], X] -> Callable[..., X]
- Add Callable import to bpy.types generator
- Map ContextTempOverride to object, handle BMVertSkin removal in 5.1
- Fix Literal[...] = False incompatible defaults
- Update test for collect_inherited_info rename

Result: 0 errors on all versions (4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 5.0, 5.1)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 12:41:38 +01:00
6ecd996f35 Fix typecheck errors across all Blender versions
- Strip single backtick RST markup from type annotations (` int ` -> int)
- Convert "string in ['X', 'Y']" docstring patterns to Literal types
- Map undefined ContextTempOverride type to object
- Add Callable import to bpy.types stub generator
- Fix Callable[[object, ...], X] -> Callable[..., X] for varargs
- Fix Literal[...] = False incompatible defaults to use ...
- Include classmethod-wrapped C builtins in RNA type C-method scan

Remaining pre-existing errors:
- 4.0-4.3: Sequence name clash with bpy.types.Sequence
- 4.0: Node.type structural RNA conflict
- 5.1: BMElemSeq/BMLayerCollection not declared as generic

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 11:33:22 +01:00
b3b282d8b0 Fix all conformance test failures
- Discover C-level classmethods on RNA types (e.g. Space.draw_handler_add)
- Fix getset_descriptor writability detection via __set__ probing
- Widen writable mathutils properties to accept Sequence[float]
- Widen __setitem__ value to accept parent container type (vec[:] = Vector)
- Widen mathutils params (Vector, Euler, etc.) to also accept Sequence[float]
- Filter self param from C method_descriptor signatures
- Add 5.1 overrides for LocRotScale and Quaternion.__init__
- Comment out memoryview tests (buffer protocol requires Python 3.12+)
- Disable reportUnusedExpression and reportUnknownMemberType in conformance

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 18:29:28 +01:00
c2876bc184 Widen mathutils param types, fix getset_descriptor writability, add conformance tests
- Widen bare mathutils type params (Vector, Euler, etc.) to also accept
  Sequence[float], matching Blender's mathutils_array_parse C behavior
- Fix getset_descriptor readonly detection by probing __set__ on the
  descriptor instead of checking fset (which doesn't exist on C descriptors)
- Accept int | slice keys in __getitem__/__setitem__/__delitem__
- Accept Sequence[element_type] values in __setitem__ for slice assignment
- Add mathutils overrides for Matrix.Translation and Matrix.Scale
- Extend apply_overrides to support ClassName.method_name keys
- Add conformance test files from Blender docs examples
- Disable reportUnusedExpression in conformance checks

Remaining known conformance issues:
- draw_handler_add missing from SpaceView3D
- Vector not nominally Sequence[float] (buffer protocol, swizzle setters)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 18:06:11 +01:00
9fa2f1c200 Add conformance tests and fix introspection issues
- Add conformance test framework with poe conformance task
- Add test files for mathutils, bpy, and gpu API patterns
- Fix self param leaking into signatures from C method_descriptors
- Synthesize __iter__ for classes with __getitem__ but no explicit __iter__
- Add __iter__ runtime probing to discover Iterator[element_type]
- Add :raises to directive lookahead to fix rtype parsing
- Add 5.1 override for Matrix.Translation to accept Vector

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 17:45:01 +01:00
e4739448c2 Add dunder methods, hidden type discovery, uniform_float override, and docstring fixes
- Introspect dunder methods (__getitem__, __len__, __add__, __matmul__, etc.)
  on C extension classes with runtime probing for return types
- Discover hidden C types from property values (e.g. MatrixAccess from Matrix.col)
- Add gpu.types override for uniform_float to accept Matrix, Vector, Euler,
  Quaternion, and Color (matching Blender's mathutils_array_parse C implementation)
- Extend apply_overrides to support ClassName.method_name keys for struct methods
- Parse standalone :type: annotations in property docstrings (is_frozen -> bool)
- Strip (readonly) and (never None) from docstring type annotations
- Add :raises to directive lookahead to prevent rtype bleeding into raises text
- Fix NoneType -> None normalization in runtime type probing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 17:18:09 +01:00
6ea41f3b4d Add rna_type/bl_rna, GeometrySet, bpy.ops typing, publish task, and README updates
- Add rna_type and bl_rna as readonly properties on bpy_struct (fixes fake-bpy-module#419)
- Discover non-RNA C classes in bpy.types like GeometrySet (fixes fake-bpy-module#436)
- Introspect bpy.ops operator wrapper with poll(), idname(), get_rna_type(), bl_options
- Handle builtin name shadowing (e.g. bpy.ops.object) with builtins. qualification
- Add poe publish task for building and publishing to PyPI
- Update project URLs to Gitea, improve generated README, add disclaimer
- Fix f-string lint warning and type annotation for introspect_class

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 15:07:35 +01:00
852a5de700 Initial commit
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 13:00:51 +01:00