-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to yrs 0.16 #117
Upgrade to yrs 0.16 #117
Conversation
1caac4e
to
b082607
Compare
I've come up with a solution for the above mentioned problem: another level of indirection in the form of The tests in The test for
I had to introduce some extra methods on I think this PR still needs more cleaning up (e.g. regarding naming). But if this is roughly the right direction, I could look into upgrading the other YTypes. |
If this will add support for |
@Horusiath hello! I think that Stefan and I are both pretty motivated and excited to get this going! I can also get some other engineers on my team involved. However none of us is really a Rust expert so we might need some tips and pointers or potentially even more support. Can you help us get this moving, or if not, do you know who can? Excited to help! |
@stefanw Do you still plan to work on this PR? |
So not to hold on to TransactionMut.
32712a7
to
462171c
Compare
I rebased on main and converted I will work on the other types, but I would still appreciate feedback on the new transaction style and especially on the unsafe blocks. |
That's great @stefanw, thanks for working on this. |
Adjust test to replace UNDEFINED root node that is now named after name in doc.
Still missing: items, keys, values iterator views.
I updated the PR description with latest progress and remaining TODOs that I can see. |
I just wrote up some related thoughts in this discussion. XML Treewalker may also be the solution that I am looking for! |
As a Debian developer trying to package ypy, I'm happy to see progress on that PR. Let me know if I can do anything to help (if only check that I can build ypy on current Debian unstable). |
Test triggers a debug assert in yrs. The test case has been ported to yrs and is currently ignored while under investigation: https://github.com/y-crdt/y-crdt/blob/v0.16.10/yrs/src/types/array.rs#L1351-L1353
All tests pass now (skipped one that is buggy in Possible TODOs:
|
Thanks a lot for pushing on this @stefanw!
Which is here: Lines 57 to 61 in cf7383b
Do you know what's the issue? |
Could you provide the Python code that causes this? The ypy types need to keep an optional reference to the ydoc but prelims don’t have one. Ideally, I should make better use of the Rust type system to avoid ‘unwrap’s. |
Since I was editing a notebook, it's probably in ynotebook.py. |
@davidbrochart Thanks, I found the bug, fixed it and added a test case. I also tried a jupyter notebook with real time collaboration and it seems to work! Summary of other changes:
This is now getting closer to being finished. Do you want me to clean up history? (it's not too bad, but not really linear either) |
I checked on my side as well, everything seems to work fine. This is really awesome, thanks again for your work! |
I'll merge today if there are no objections. |
It's really fantastic effort. Since all mayor issues seems to be taken into account, I'd suggest merging it now. We can polish the implementation over time. As far as I looked there are not serious issues - sure there may be some things regarding style and API design, but these should not be stopping us from merge. We can discuss them later. |
I released v0.7.0a1. |
Thanks everyone!! Very excited to check it out! |
This PR upgrades
yrs
to 0.16 and attempts to deal with the consequences while keeping the Python API the same as discussed in #106. This is a draft PR to get feedback.The approach here is the one proposed by @Waidhoferj in #106: The
YDoc
(throughYDocInner
) keeps aWeak
reference to aYTransaction
and the YTypes get an optional reference to the document in order to start or get hold of a running transaction behind the scences (.e.g in__len__
).I've implemented this for
YArray
and stubbed/commented out the other types for now and the tests mostly pass fortests/test_y_array.py
.The tests that don't pass (8 of 46) are due to the following problem that I haven't been able to solve yet:
items
,keys
andvalues
Views are currently faked by returning alist
with the corresponding items with no connection to the original. This needs to be fixed.XMLFragment
Python APIAny feedback is appreciated! Please be aware that I'm relatively new to Rust. I'm especially unsure about the
unsafe
code I used to makeTransactionMut<'doc>
lifetimes'static
(because#[pymethods]
don't allow lifetime annotations).