Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## staging_1.0.0 #92 +/- ##
=================================================
+ Coverage 95.50% 95.81% +0.30%
=================================================
Files 42 46 +4
Lines 4097 4419 +322
=================================================
+ Hits 3913 4234 +321
- Misses 184 185 +1 ☔ View full report in Codecov by Sentry. |
…previous naming caused confusion when viewed from the python repo. Then we had to import PyTriGrid for example which would be a class originating from rust, so then RustTriGrid would have made more sense. I decided to use 'PyO3' for that makes sense when seen from both the python and rust perspectives
|
I encountered an issue related to mutability. Using commit: 8f19e69 Notice here how the rotation is updated, but the corners as returned by tile.corners() do not reflect this change. The tile.grid (python grid) needs to somehow be coupled to the tile._tile.grid (PyO3 grid). The desired behavior is for the python grid to be mutable in a way where modifying the grid is propagated to all the tiles. This makes updating all the tiles cheap. The user can then opt-in to immutability by passing a copy of the grid to the tile on initiation. But to allow the mutability, the setup needs rethinking. |
|
A robust/safe way to fix this problem is to make Tile._tile a property, where a new PyO3 tile class is instantiated every time, but this means that every call to an attribute or method on the python Tile object is then creating a fresh PyO3 class. This feels unnecessarily inefficient. |
|
Fundamentally, the PyO3 objects are not mutable.
This is where, in order to make an informed decision I have to consider the end goal. What I consider to be the end goal of the Tile class is to be used in a DataTile that will replace the BoundedGrid class. The reasoning is that the tiles can deal with rotated grids where the BoundedGrid implementation can not. The grid associated with the DataTile will be immutable because the data only makes sense with that specific grid configuration. I was hoping to enforce this immutability on the DataTile level and not on the Tile level, but if we want to use PyO3 objects I think we are forced to also make the Tile immutable. If the Tile is implemented in pure Python for the sake of mutability, we cannot then create the DataTile, which builds on top of Tile, in Rust anymore. Since the DataTile will have multiple methods related to data processing such as interpolation, I don't think it is wise to force these methods to be in Python only for the sake of mutability. Hence I believe it best to keep the Tile implementation mostly in Rust and have a thin Python wrapper that will have to make a copy of the grid in order to avoid Python grid associated with the Tile from diverging with the PyO3 grid associated with the PyO3 tile. |
No description provided.