asyncode
Python package for emulating Python's interactive interpreter in asynchronous contexts.
Installation
Use the package manager pip to install asyncode:
pip install asyncode
Dependencies
- Python ≥ 3.5 (no CI for Python < 3.8)
Usage
This package's external API consists in two classes, AsyncInteractiveInterpreter and AsyncInteractiveConsole, which subclass respectively code.InteractiveInterpreter and code.InteractiveConsole.
These classes are meant to be used in already running asynchronous contexts. Minimal useful code will need to subclass provided classes to implement specific functions:
import asyncode
class MyAsyncConsole(asyncode.AsyncInteractiveConsole):
"""AsyncInteractiveConsole adapted to running environment"""
async def write(self, data):
"""Use specific function"""
await some_output_coroutine(data)
async def raw_input(self, prompt=""):
"""Use specific functions"""
if prompt:
await some_output_coroutine(prompt)
data = await some_input_coroutine()
return data
async def run_interpreter():
"""Run an interactive Python interpreter"""
console = MyAsyncConsole()
try:
await console.interact()
except SystemExit:
# Do not exit the whole program when sending "exit()" or "quit()"
await some_output_coroutine("Bye!")
Read the docs for more informations.
Contributing
Pull requests are welcome. Do not hesitate to get in touch with me (see below) for any question or suggestion about this project!
License
This work is shared under the MIT license.
© 2020 Loïc Simon (loic.simon@espci.org)
Metadata
Release files for asyncode 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| asyncode-1.0.0.tar.gz | 7.4 kB | Without provenance | Details for asyncode-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| asyncode-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for asyncode-1.0.0-py3-none-any.whl |
Total release size: 13.8 kB
Release files / asyncode-1.0.0.tar.gz
| Download URL | asyncode-1.0.0.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab8a1629f5e35d26efcc70f5a5d5b571c2abd02d46a865be53476a50b291e2d6
|
|
BLAKE2b-256 checksum How to use checksums |
80c9c44a372a915b6a89cd6fb4da41b96a05a27c0d1dc8f0800f843f12d0c723
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0
|
Release files / asyncode-1.0.0-py3-none-any.whl
| Download URL | asyncode-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb2e14c2d3753926f3c07444c1a2fb9f78a1751b0e7233c3c663e6473995a395
|
|
BLAKE2b-256 checksum How to use checksums |
c9507b53705358434f63f651f379eeb3f2f4cf0609c07de591db9fe53eb34c1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0
|
Security for asyncode 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.