asyncer

Asyncer, async and await, focused on developer experience.

https://github.com/fastapi/asyncer

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.4%) to scientific vocabulary

Keywords

anyio async asyncio python trio

Keywords from Contributors

json-schema openapi3 pydantic python-types redoc starlette uvicorn swagger-ui spacy-extension spacy
Last synced: 6 months ago · JSON representation ·

Repository

Asyncer, async and await, focused on developer experience.

Basic Info
Statistics
  • Stars: 2,051
  • Watchers: 18
  • Forks: 74
  • Open Issues: 8
  • Releases: 8
Topics
anyio async asyncio python trio
Created about 4 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing Funding License Citation Security

README.md

Asyncer

Asyncer, async and await, focused on developer experience.

Test Publish Coverage Package version


Documentation: https://asyncer.tiangolo.com

Source Code: https://github.com/fastapi/asyncer


Asyncer is a small library built on top of AnyIO.

Asyncer has a small number of utility functions that allow working with async, await, and concurrent code in a more convenient way under my (@tiangolo - Sebastián Ramírez) very opinionated and subjective point of view.

The main goal of Asyncer is to improve developer experience by providing better support for autocompletion and inline errors in the editor, and more certainty that the code is bug-free by providing better support for type checking tools like mypy.

Asyncer also tries to improve convenience and simplicity when working with async code mixed with regular blocking code, allowing to use them together in a simpler way... again, under my very subjective point of view.

🚨 Warning

This small library only exists to be able to use these utility functions until (and if) they are integrated into AnyIO.

It will probably take some time for that to happen (or to be decided if it will be included or not).

So I made this to be able to use these ideas right now. 🤓

Can I Use It?

Yes 🎉 (but continue reading).

You can use this and evaluate the library API design I'm proposing. It will probably be useful to know if it works and is useful for you (I hope so).

But still, consider this lab material, expect it to change a bit. 🧪

If you use it, pin the exact Asyncer version for your project, to make sure it all works.

Have tests for your project (as you should, anyway). And upgrade the version once you know that the new version continues to work correctly.

Still, it's just 4 functions, so there's not much to change, if you had to refactor your code to update something it would not be much.

And if you don't want to add asyncer as a dependency to your project, you can also just copy the main file and try out those functions, it's quite small (but in that case you won't get updates easily).

Requirements

As Asyncer is based on AnyIO it will be also installed automatically when you install Asyncer.

Installation

```console $ pip install asyncer ---> 100% Successfully installed asyncer anyio ```

How to Use

You can read more about each of the use cases and utility functions in Asyncer in the tutorial.

As a sneak preview of one of the utilities, you can call sync code from async code using asyncify():

```Python import time

import anyio from asyncer import asyncify

def dosyncwork(name: str): time.sleep(1) return f"Hello, {name}"

async def main(): message = await asyncify(dosyncwork)(name="World") print(message)

anyio.run(main) ```

Asyncer's asyncify() will use AnyIO underneath to do the smart thing, avoid blocking the main async event loop, and run the sync/blocking function in a worker thread.

Editor Support

Everything in Asyncer is designed to get the best developer experience possible, with the best editor support.

  • Autocompletion for function arguments:

  • Autocompletion for return values:

  • Inline errors in editor:

  • Support for tools like mypy, that can help you verify that your code is correct, and prevent many bugs.

License

This project is licensed under the terms of the MIT license.

Owner

  • Name: FastAPI
  • Login: fastapi
  • Kind: organization

FastAPI and friends open source projects. Created and managed by @tiangolo.

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: Asyncer
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Sebastián
    family-names: Ramírez
    email: tiangolo@gmail.com
identifiers:
repository-code: 'https://github.com/fastapi/asyncer'
url: 'https://asyncer.tiangolo.com'
abstract: >-
  Asyncer, async and await, focused on developer experience.
keywords:
  - asyncer
  - anyio
  - trio
  - asyncio
license: MIT

GitHub Events

Total
  • Watch event: 355
  • Delete event: 84
  • Issue comment event: 93
  • Push event: 96
  • Pull request review comment event: 1
  • Pull request review event: 18
  • Pull request event: 172
  • Fork event: 15
  • Create event: 82
Last Year
  • Watch event: 355
  • Delete event: 84
  • Issue comment event: 93
  • Push event: 96
  • Pull request review comment event: 1
  • Pull request review event: 18
  • Pull request event: 172
  • Fork event: 15
  • Create event: 82

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 363
  • Total Committers: 18
  • Avg Commits per committer: 20.167
  • Development Distribution Score (DDS): 0.545
Past Year
  • Commits: 162
  • Committers: 6
  • Avg Commits per committer: 27.0
  • Development Distribution Score (DDS): 0.506
Top Committers
Name Email Commits
github-actions g****s@g****m 165
Sebastián Ramírez t****o@g****m 112
dependabot[bot] 4****] 53
pre-commit-ci[bot] 6****] 15
Sofie Van Landeghem s****g 3
Franco Gil 4****o 2
Khiem Doan d****y@g****m 2
Esteban Maya e****9@g****m 1
Hung-I Wang w****e@g****m 1
Jonas Krüger Svensson j****s@h****m 1
Lev l****t@g****m 1
Marcelo Trylesinski m****e@g****m 1
Mark Parker m****p@g****m 1
Michael Oliver m****_@o****m 1
Paul Sanders p****1@g****m 1
Zhymabek Roman 6****n 1
giladsheffer g****7@g****m 1
नवुले पवन कुमार राव p****e@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 6
  • Total pull requests: 216
  • Average time to close issues: 3 months
  • Average time to close pull requests: about 1 month
  • Total issue authors: 6
  • Total pull request authors: 20
  • Average comments per issue: 3.0
  • Average comments per pull request: 1.26
  • Merged pull requests: 105
  • Bot issues: 1
  • Bot pull requests: 161
Past Year
  • Issues: 1
  • Pull requests: 123
  • Average time to close issues: about 19 hours
  • Average time to close pull requests: 15 days
  • Issue authors: 1
  • Pull request authors: 5
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.85
  • Merged pull requests: 38
  • Bot issues: 1
  • Bot pull requests: 118
Top Authors
Issue Authors
  • samuelcolvin (1)
  • tiangolo (1)
  • wu-clan (1)
  • smoeinbbp (1)
  • sumit-158 (1)
  • jessekrubin (1)
Pull Request Authors
  • dependabot[bot] (201)
  • tiangolo (54)
  • pre-commit-ci[bot] (22)
  • svlandeg (3)
  • realFranco (3)
  • Lancetnik (2)
  • waketzheng (2)
  • Gowee (2)
  • JonasKs (1)
  • Kludex (1)
  • msehnout (1)
  • khiemdoan (1)
  • Stealthii (1)
  • sanders41 (1)
  • windson (1)
Top Labels
Issue Labels
question (5) answered (3) internal (1)
Pull Request Labels
dependencies (201) internal (169) python (144) github_actions (36) refactor (4) investigate (2) feature (2) bug (2) answered (1) docs (1)

Dependencies

pyproject.toml pypi
  • autoflake ^1.4 develop
  • black ^21.5-beta.1 develop
  • coverage ^6.2 develop
  • flake8 ^4.0.1 develop
  • isort ^5.9.3 develop
  • mdx-include ^1.4.1 develop
  • mkdocs ^1.2.1 develop
  • mkdocs-material ^8.1.4 develop
  • mypy ^0.930 develop
  • pytest ^6.2.4 develop
  • anyio ^3.4.0
  • python ^3.6.2
.github/actions/comment-docs-preview-in-pr/action.yml actions
  • Dockerfile * docker
.github/actions/watch-previews/action.yml actions
  • Dockerfile * docker
.github/workflows/build-docs.yml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • mxschmitt/action-tmate v3 composite
  • nwtgck/actions-netlify v1.2.4 composite
.github/workflows/issue-manager.yml actions
  • tiangolo/issue-manager 0.4.0 composite
.github/workflows/latest-changes.yml actions
  • actions/checkout v3 composite
  • docker://tiangolo/latest-changes 0.0.3 composite
  • mxschmitt/action-tmate v3 composite
.github/workflows/preview-docs.yml actions
  • ./.github/actions/comment-docs-preview-in-pr * composite
  • actions/checkout v3 composite
  • dawidd6/action-download-artifact v2.24.2 composite
  • nwtgck/actions-netlify v1.2.4 composite
.github/workflows/publish.yml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • mxschmitt/action-tmate v3 composite
.github/workflows/smokeshow.yml actions
  • actions/setup-python v4 composite
  • dawidd6/action-download-artifact v2.24.2 composite
.github/workflows/test.yml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • mxschmitt/action-tmate v3 composite
.github/actions/comment-docs-preview-in-pr/Dockerfile docker
  • python 3.7 build
.github/actions/watch-previews/Dockerfile docker
  • python 3.7 build