GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - python-trio/unasync: The async transformation code.

BranchesTags
Open more actions menu

Latest commit

 

History

138 Commits
138 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
ci
ci
 
 
docs
docs
 
 
newsfragments
newsfragments
 
 
src/unasync
src/unasync
 
 
tests
tests
 
 
.coveragerc
.coveragerc
 
 
.gitignore
.gitignore
 
 
.readthedocs.yml
.readthedocs.yml
 
 
LICENSE
LICENSE
 
 
LICENSE.APACHE2
LICENSE.APACHE2
 
 
LICENSE.MIT
LICENSE.MIT
 
 
MANIFEST.in
MANIFEST.in
 
 
README.rst
README.rst
 
 
ci.sh
ci.sh
 
 
pyproject.toml
pyproject.toml
 
 
pytest.ini
pytest.ini
 
 
setup.py
setup.py
 
 
test-requirements.txt
test-requirements.txt
 
 

Repository files navigation

unasync

Documentation Status Travis Build Status AppVeyor Build Status Coverage Status

Welcome to unasync, a project that can transform your asynchronous code into synchronous code.

See urllib3/urllib3#1323 for more details about unasync.

Users

  • The official Elasticsearch Python client: https://github.com/elastic/elasticsearch-py
  • Hip, a HTTP client: https://github.com/python-trio/hip
  • httpcore, another low-level HTTP client uses a different implementation of the same idea: https://github.com/encode/httpcore

Installation

pip install unasync

Usage

To use the unasync project you need to install the package and then create a _async folder where you will place the asynchronous code that you want to transform into synchronous code.

And then in your setup.py place the following code.

import unasync

setuptools.setup(
    ...
    cmdclass={'build_py': unasync.cmdclass_build_py()},
    ...
)

And when you will build your package you will get your synchronous code in _sync folder.

If you'd like to customize where certain rules are applied you can pass customized unasync.Rule instances to unasync.cmdclass_build_py()

import unasync

setuptools.setup(
    ...
    cmdclass={'build_py': unasync.cmdclass_build_py(rules=[
        # This rule transforms files within 'ahip' -> 'hip'
        # instead of the default '_async' -> '_sync'.
        unasync.Rule("/ahip/", "/hip/"),

        # This rule's 'fromdir' is more specific so will take precedent
        # over the above rule if the path is within /ahip/tests/...
        # This rule adds an additional token replacement over the default replacements.
        unasync.Rule("/ahip/tests/", "/hip/tests/", additional_replacements={"ahip": "hip"}),
    ])},
    ...
)

Documentation

https://unasync.readthedocs.io/en/latest/

License: Your choice of MIT or Apache License 2.0

About

The async transformation code.

Resources

Readme
Activity
Custom properties

Stars

109 stars

Watchers

3 watching

Forks

16 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.