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

Async Pykka Proof of Concept #218

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Async Pykka Proof of Concept #218

wants to merge 13 commits into from

Conversation

x0ul
Copy link
Contributor

@x0ul x0ul commented Aug 31, 2024

I am working on an async Python project and wanted to use Pykka, so I decided to extend Pykka to work with async/await. Since this requires API changes, I made a new src/pykka/asyncio subdirectory and copied over specific files needing modifications (this is how redis does it, no idea if it's a good idea but it seemed to make things go smoothly).

There is also a new tests/asyncio subdirectory full of tests for this new code. 99%+ of the tests are the same, just modified for async. I removed one or two that were no longer relevant, and added one or two new ones.

Linters, type checkers, etc. should all be passing.

Still to do:

  • Documentation: I updated docs in most sources but not in the docs directory.
  • Performance test: didn't do it yet
  • (Maybe) Fix some leaky abstractions in Events, Mailbox, etc. that I did quickly

I'm interested to hear what you think about this :)

@jodal
Copy link
Owner

jodal commented Aug 31, 2024

I've been considering to do something like this myself several times, but has never taken the step. I guess throwing backwards compatibility out and just see where it takes you is a valuable exercise.

I don't think I'd merge a copy of everything, but I'd be very much interested in having a look at what you've done and consider if we could go in this direction.

What do you think about moving everything from pykka.asyncio back to pykka? Then this PR would become a nice way to see what you've changed.

@x0ul
Copy link
Contributor Author

x0ul commented Sep 3, 2024

Sorry for the delay in replying, I'm in the middle of moving house and will be away from the keyboard for the next few days. I'll get to this in a week, if that's alright.

What do you think about moving everything from pykka.asyncio back to pykka? Then this PR would become a nice way to see what you've changed.

Yes, I can do that, however it will definitely break API compatibility with original pykka because of the need to mark many functions as async.

Perhaps pykka-async as a separate project could be a reasonable way forward, any thoughts?

@jodal
Copy link
Owner

jodal commented Sep 4, 2024

That's entirely alright!

I was just thinking that this would be a good first step just to easier review the differences. I agree that the changes probably are too large to easily integrate into Pykka, but there might be pieces that we could fit in to reduce the diff or extensions point we could create.

If it becomes a project of its own, I think the name should be more different, as pykka-async almost indicates an extension to Pykka, but there are no guarantees that the async fork would stay in sync with the sync version over time. Anyway, that's a discussion for later.

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.

2 participants