Code Monkey home page Code Monkey logo

Comments (6)

proofit404 avatar proofit404 commented on August 23, 2024 2

First of all, we should adopt tests/test_base_async.py from tests/test_base.py. This should be a copy-pasted module with async await properly set. pytest-asyncio can be used to run them. This tests should be skipped on python 2.

from stories.

thedrow avatar thedrow commented on August 23, 2024

I've been browsing the code for a bit and I can't wrap my head around this yet.
I really need this for Celery.

from stories.

proofit404 avatar proofit404 commented on August 23, 2024

Hi,

To support coroutines we should do a few things.

  1. Write async function similar to this: https://github.com/dry-python/stories/blob/fb7aa246183eb844023c7c1de984de7482698e72/src/stories/_exec/function.py#L6

  2. Method list should be something more than a list https://github.com/dry-python/stories/blob/fb7aa246183eb844023c7c1de984de7482698e72/src/stories/_wrap.py#L12 Wrap function should check each method and detect coroutines. If there is at least one coroutine in the method list we should wrap regular functions in the async callables.

  3. After that, we should use this execute function and method list together in the call and run methods https://github.com/dry-python/stories/blob/fb7aa246183eb844023c7c1de984de7482698e72/src/stories/_mounted.py#L46 I guess we can use an object with __await__ method.

@supadrupa is interested in this feature too. Maybe we all can collaborate to implement it. I promise to finish in-progress features quickly and roll out a new release.

Regards, Artem.

from stories.

thedrow avatar thedrow commented on August 23, 2024

I'd love to collaborate on this.

from stories.

proofit404 avatar proofit404 commented on August 23, 2024

There is some work going on to implement this: supadrupa@17aee22

from stories.

 avatar commented on August 23, 2024

🎉 This issue has been resolved in version 0.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

from stories.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.