This is a short command line application built with click
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.
Python versions are managed with asdf and Poetry is for dependency management. A requirements.txt is included if you prefer to use pip.
pip install -r requirements.txt
asdf install python 3.12.3
pip install poetry
asdf reshim
poetry env use python3.12
source .venv/bin/activate
poetry install
$ 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.
$ 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.
$ 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.