Skip to main content

asfquart - a Quart framework for the ASF

PyPI PyPI - Python Versions Unit Tests Apache License

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:

  • simple construction of the APP
  • default config.yaml
  • watching the .py and config for changes, to cause a restart/reload
  • watch SIGINT to halt and SIGUSR2 to restart/reload
  • template watching and rendering for EZT templates
  • URL path routing for pages and API endpoints
  • Oauth with our ASF provider for authn
  • LDAP group testing for authz
  • long-running tasks and their lifecycle management

Current (known, public) users of asfquart:

Future users of asfquart:

  • Apache STeVe
  • Identity management (replaces the old id.a.o)
  • Gitbox UI
  • ??

Primer

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()

Installation

Create and activate a virtual environment and then install asfquart using pip:

$ pip install "asfquart"

Note: Adding the [aioldap] extra will install optional dependencies for LDAP support that will require additional system dependencies:

$ pip install "asfquart[aioldap]"

Building asfquart package

Prerequisites:

  • poetry: install e.g. with pipx pipx install poetry

Building the package:

$ poetry build

Running the tests:

$ poetry run pytest

Examples

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

Metadata

Release files for asfquart 0.1.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asfquart 0.1.12
File Size Uploaded
asfquart-0.1.12.tar.gz 22.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for asfquart 0.1.12
File Interpreter ABI Platform
asfquart-0.1.12-py3-none-any.whl Python 3 none any Details

Total release size: 46.2 kB

Release files / asfquart-0.1.12.tar.gz

Download URL asfquart-0.1.12.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ddbf7bab454ab8e6dca27649b227ab365bd4084f6e5a3271a6e15c51a9af9640
BLAKE2b-256 checksum
How to use checksums
9e5f5d67a6511f727794a36417a84f695796a609a627edbd89691facdc33bd76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.12.3 Linux/6.6.76-08096-g300882a0a131

Release files / asfquart-0.1.12-py3-none-any.whl

Download URL asfquart-0.1.12-py3-none-any.whl
Size 24.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80ec03522cc8b0ce17e5a91af077d6a4b6557b35fb274816f97a02890be0f678
BLAKE2b-256 checksum
How to use checksums
9cc58969e7aa06d448ffe9492a203e956717c4f7bc286602580a27141416adda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.12.3 Linux/6.6.76-08096-g300882a0a131

Release history Release notifications | RSS feed

This release

0.1.12 This release

2 release files

0.1.11

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page