Skip to content
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

merge prototype updates #3

Merged
merged 3 commits into from
Feb 7, 2022
Merged

merge prototype updates #3

merged 3 commits into from
Feb 7, 2022

Conversation

davidselassie
Copy link
Contributor

Includes missed changes from prototype repo.

  • with_traceback! captures block
  • Adds input helper module
  • Fixes TdPyAny equality

This lets you use `?` within the PyO3-using code and get tracebacks
for all the errors within. Does this by putting the calling expression
in a closure and then immediately calls it.

One day we could use
https://doc.rust-lang.org/nightly/unstable-book/language-features/try-blocks.html

Cleans up all the `with_traceback!` use sites and adds some I missed.
Does some Maturin boilerplate to allow us to have a mixed Python /
Rust package.

Adds an `inp` package with three helpers:

1. `single_batch` to put all your data in the same epoch
2. `tumbling_epoch` to open a new epoch every some number of seconds
3. `fully_ordered` which opens a new epoch per item

Updates the examples to use these.
Runs formatter on all the Python files.

Kills the stateful example because it's not right anyway. New version
forthcoming.
Turns out both `Py` and `PyAny`'s impl of `eq` just compare
pointers. So the previous code didn't actually look at the Python
values. I think it "worked" because CPython does int and string
interning so the actual objects would be identical. It stopped working
when I started needing to clone values for some of my further
experimentation.

This uses `PyAny.rich_compare` to call out to Python's `__eq__` and
friends for equality.
@davidselassie davidselassie merged commit ef9aff1 into main Feb 7, 2022
@davidselassie davidselassie deleted the merge-prototype-updates branch February 7, 2022 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants