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

Remove tractor.run() #183

Closed
Tracked by #197
goodboy opened this issue Dec 28, 2020 · 0 comments
Closed
Tracked by #197

Remove tractor.run() #183

goodboy opened this issue Dec 28, 2020 · 0 comments

Comments

@goodboy
Copy link
Owner

goodboy commented Dec 28, 2020

Once #181 lands and all dependent projects are ported, we can safely move to the new trio.run() based entry api.

The ideal user facing API instead looks like:

import trio
import tractor

async def main():

    # actor runtime is started implicitly inside the first used nursery if this actor is the root
    async with tractor.open_nursery() as n:
        portal = await n.run_in_actor(trio.sleep(1))
        
trio.run(main)

or, if the user wants to start up the actor runtime / tree manually:

import trio
import tractor

async def main():

    # this starts up the IPC / channel machinery without having to open an actor nursery.
    # you could also just open an actor nursery and sleep in it's body I guess?
    async with tractor.open_root_actor() as actor:
        # run a top level root actor and that's it.
        await trio.sleep_forever()
        
trio.run(main)

This is of course all up for discussion.
I'm prone to maybe offer a tractor.lowlevel (like trio) for stuff like this open_root_actor().

Luckily since most of our docs reference examples, one those are changed there should be little work to do on that front.

@goodboy goodboy mentioned this issue Feb 24, 2021
8 tasks
@goodboy goodboy mentioned this issue Sep 15, 2022
4 tasks
goodboy added a commit that referenced this issue Sep 15, 2022
It's been deprecated for a while now and all docs and tests have been
changed.

Closes #183
goodboy added a commit that referenced this issue Sep 15, 2022
It's been deprecated for a while now and all docs and tests have been
changed.

Closes #183
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant