Deprecate nodes, robust object tracking and attribute validation - #74
Merged
Merged
Conversation
Node functionality is moving to nodebpy. Public functions and classes in databpy.nodes now emit a FutureWarning and will be removed in 0.11.0.
BlenderObject resolves its object by session_uid within a session and by a persistent uuid (obj["_databpy_uuid"]) after a file load. Removed objects now raise LinkedObjectError instead of resolving to a duplicate. register() and unregister() are deprecated; unregister() is a no-op so it can't break other add-ons. Legacy Object.uuid values are migrated and kept in sync until 0.11.0. Fix create_bob(uuid=...) raising LinkedObjectError.
- Store 1D unsigned ints as INT and unsigned 2D as INT32_2D instead of wrapping in INT8 / INT16_2D. - Raise AttributeMismatchError for integer overflow, NaN/inf into ints and complex data instead of casting silently. - Raise a clear ValueError when no attribute type can be inferred. - Accept array-like data. - Writing to an existing attribute uses its type and domain when atype or domain is omitted; an explicit domain mismatch raises. - Replace the vertex reassignment workaround with update_tag(), fixing writes to empty geometry.
AttributeArray syncs through __array_ufunc__ and __array_function__, so every in-place operator, out= and ufunc.at write reaches Blender, along with fill, sort, put, partition, np.copyto, np.place, np.putmask and np.fill_diagonal. Augmented assignment on a view syncs once instead of twice. The object is tracked by session_uid rather than a direct reference, and syncing raises LinkedObjectError if it was removed or a file was loaded.
- Support faces with mixed sizes and raise on out-of-range edge/face indices in create_mesh_object and new_from_pydata. - Create point clouds with PointCloud.resize() instead of converting a mesh, which failed in unlinked collections and left an orphan mesh. - create_curves_object raises if only one of positions and curve_sizes is given. - centroid() accepts boolean masks and unsigned indices, and raises on unsupported dtypes.
- All databpy errors subclass DatabpyError. - Missing attributes raise AttributeNotFoundError, a NamedAttributeError that is also a KeyError, including bob["name"] which previously raised a bare KeyError. - NamedAttributeError still subclasses AttributeError until 0.11.0. - Removing a required attribute raises NamedAttributeError instead of Blender's RuntimeError. - The string attribute warning points at the caller, so it shows once per call site.
- ObjectTracker detects new objects by session_uid, so renamed objects aren't reported as new, and latest() returns the newest object. - Add py.typed. - Remove the databpy.nodes.utils import that the utils export shadowed. - Remove duplicate polars dev dependency.
- Apply ruff fixes and formatting. - Keep ValueError/AttributeError for invalid types (TRY004) for backwards compatibility. - Configure ruff: ignore SIM118 (bpy collections iterate over items), allow B018/BLE001 in tests and exclude the generated README.md. - Format README.qmd code and silence a polars deprecation warning in the rendered README.
- Widen annotations to match accepted input: array-likes for attribute data, object constructors and lerp; any sequence for move_to_collection; the base bpy.types.Attribute for Attribute(). - AttributeArray raises TypeError for objects without attributes. - Fix lerp with list inputs and tests/run.py when pytest returns an int. - Configure ty: exclude the deprecated databpy.nodes, and ignore rules in tests that come from optional and union types in the bpy stubs.
Resolves conflicts with the ruff/ty pass in #73: adopt its TypeError for invalid types, zero-suppression typing and narrowing helpers, deprecate its new node helpers, and merge the 0.9.0 changelog sections.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #74 +/- ##
==========================================
+ Coverage 93.99% 95.35% +1.36%
==========================================
Files 14 16 +2
Lines 999 1141 +142
==========================================
+ Hits 939 1088 +149
+ Misses 60 53 -7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Within a session, BlenderObject now also checks the object's uuid after finding it by session_uid, raising LinkedObjectError when another wrapper has stored its own uuid on the object. This restores the previous behaviour MolecularNodes relies on when reloading an entity.
0.9.0 has been released, so these changes go in a new 0.10.0 changelog section and deprecations are removed in 0.12.0 to keep a two minor release window.
bpy 5.2 only has cp313 wheels, so allowing Python 3.14 breaks installs on environments that pick the newest Python, such as CI. Point BLENDER_USER_EXTENSIONS at a temporary directory in the tests, so packages from extensions installed in the user's Blender (including other copies of databpy) don't shadow this project.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Robustness pass ahead of wider use in other projects. See
docs/changelog.qmd(0.9.0) for the full list.databpy.nodes(moving to nodebpy) andregister()/unregister()withFutureWarning, removal in 0.11.0.unregister()is now a no-op so it can't break other add-ons.session_uidwithin a session and a persistentobj["_databpy_uuid"]across file loads. LegacyObject.uuidvalues are migrated.AttributeArraysyncs all in-place modifications and no longer holds direct references.DatabpyErrorandAttributeNotFoundError(also aKeyError).centroidmasks).