Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/desertthunder/async-python-demo
https://github.com/desertthunder/async-python-demo
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/desertthunder/async-python-demo
- Owner: desertthunder
- Created: 2024-11-24T05:58:53.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-11-24T06:01:49.000Z (about 1 month ago)
- Last Synced: 2024-11-24T07:17:28.549Z (about 1 month ago)
- Language: Python
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Async Python
This is a short command line application built with [click](https://click.palletsprojects.com/en/8.0.x/)
to demonstrate the concepts of asynchronous programming in Python. The application includes two
subcommands, `http` and `queue`, which demonstrate the use of asynchronous HTTP requests and simple
distributed task queues, respectively.## Setup
Python versions are managed with [asdf](https://asdf-vm.com/) and [Poetry](https://python-poetry.org/)
is for dependency management. A requirements.txt is included if you prefer to use pip.### `pip` Setup
```bash
pip install -r requirements.txt
```### `poetry` Setup
```bash
asdf install python 3.12.3
pip install poetry
asdf reshim
``````bash
poetry env use python3.12
source .venv/bin/activate
poetry install
```## Usage
```bash
$ python -m cli --help
Usage: python -m cli [OPTIONS] COMMAND [ARGS]...Demo Command line for asynchronous programming post.
Options:
--help Show this message and exit.Commands:
http Requests & HTTPx demo.
queue Basic task queue demo.
``````bash
$ python -m cli http --help
Usage: python -m cli http [OPTIONS] COMMAND [ARGS]...Requests & HTTPx demo.
Options:
--help Show this message and exit.Commands:
async Run asynchronous HTTP requests using HTTPx.
requests Run HTTP requests using the requests library.
sync Run synchronous HTTP requests using HTTPx.
``````bash
$ python -m cli queue --help
Usage: python -m cli queue [OPTIONS] COMMAND [ARGS]...Basic task queue demo.
Options:
--help Show this message and exit.Commands:
async Run asynchronous non-blocking tasks.
sync Run synchronous blocking tasks.
```