This is a Quart framework for ASF web applications.
On top of Quart, this package layers a lot of functionality, much of which is specific to the ASF and its infrastructure and preferred approaches for website application development.
asfquart adds the following items to basic quart:
APPconfig.yamlCurrent (known, public) users of asfquart:
Future users of asfquart:
See the documentation page for more information.
import asfquart from asfquart.auth import Requirements as R def my_app() -> asfquart.base.QuartApp: # Construct the quart service. By default, the oauth gateway is enabled at /oauth. app = asfquart.construct("my_app_service") @app.route("/") async def homepage(): return "Hello!" @app.route("/secret") @asfquart.auth.require(R.committer) async def secret_page(): return "Secret stuff!" return app if __name__ == "__main__": app = my_app() # Run the application in an extended debug mode: # - reload the app when any source / config file get changed app.runx(port=8000) else: # Serve the application via an ASGI server, e.g. hypercorn app = my_app()
Create and activate a virtual environment and then install asfquart using uv or pip:
# With uv uv add asfquart # With uv pip-compatible interface uv pip install asfquart # With standard pip pip install asfquart
Note: Adding the [aioldap] extra will install optional dependencies for LDAP support that will require additional system dependencies:
# With uv uv add asfquart --extra aioldap # With uv pip-compatible interface uv pip install "asfquart[aioldap]" # With standard pip pip install "asfquart[aioldap]"
Install the required dependencies for development:
uv sync
Install the optional dependencies for development:
uv sync --extra aioldap
Running the tests:
uv sync --all-extras --group test uv run pytest
Building the package:
uv build
There is a simple test application included (./examples/snippets/simple_app.py) to outline the basic setup. To run the application in development mode, type:
make example-dev
to run it with an ASGI server for production, type:
make example-run