MIT License

项目介绍

miguelgrinberg/greenletio 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 MIT License 许可证,目前获得 163 个 Star、7 次 Fork。

仓库全名
miguelgrinberg/greenletio
开源许可证
MIT License
Star 数
163
Fork 数
7
未关闭 Issue
2

README 摘要

greenletio This project allows synchronous and asynchronous functions to be used together. Unlike other methods based on executors and thread or process pools, greenletio allows synchronous functions to work like their asynchronous counterparts, without the need to create expensive threads or processes. Examples The following are some of the possibilities when using greenletio. Convert a sync function into an…

完整内容见 GitHub 原始 README 或本页 。

常见问题

greenletio 用什么语言开发?

主要使用 Python 编写,采用 MIT License 许可证,目前有 163 个 Star。

greenletio 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 greenletio 的源码?

可以直接克隆仓库:git clone https://github.com/miguelgrinberg/greenletio.git,默认分支为 main;安装与运行步骤见仓库 README。

greenletio 最近还在维护吗?

仓库最近一次更新为 8月30日,当前有 2 个未关闭 Issue;Star 数为 163,可作为社区活跃度的参考。

关于

Asyncio integration with sync code using greenlets.

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
183
价值分
100
活跃状态
活跃

README

greenletio

tests

This project allows synchronous and asynchronous functions to be used together. Unlike other methods based on executors and thread or process pools, greenletio allows synchronous functions to work like their asynchronous counterparts, without the need to create expensive threads or processes.

Examples

The following are some of the possibilities when using greenletio.

Convert a sync function into an awaitable

import asyncio
from greenletio import async_

@async_
def sync_function(arg):
    pass

async def async_function():
    await sync_function(42)

asyncio.run(async_function())

Use await inside a sync function

from greenletio import await_

async def async_function():
    pass

def sync_function():
    await_(async_function())

Call an async function as a normal function

from greenletio import await_

@await_
async def async_function():
    pass

def sync_function():
    async_function()

Resources

This project relies on contributions from its users. If you benefit from it please consider making a single or ongoing monetary contribution in one of the following platforms:

Thank you!

评论

暂无评论