Skip to main content

Documentation

Overview

This project aims to resolve problem of configuring an application, which needs to have initialization step (for example: for gathering settings or establishing connections) and use Python style code (context managers and decorators) with dependency injection to get those data.

For example, normally you would need to use two separate mechanism for connection to the database (one for web, and one for celery). Mostly it uses the web framework configuration, to use in the celery code. It is fine, until a third sub-application arrives. Or you have many microservices, where web frameworks are different depending on the microservice purpose.

Second goal was to make synchronized code without any globals or magic. That is why using Quack Quack you know when the application is initialized (started), or where to look for code you are using.

In order to use QQ, you don’t need to use hacks in some starting files, like importing something from django, starting the application, and the import the rest.

Quick Using Example

To use Quack Quack you need to create the application class (inherited from qq.Application) in which you need to add plugins. After configuring, you need to “start” (initialize) the application. After that you can use the application as context manager. Also, you can make simple decorator, so you can use injectors (dependency injection) in function’s arguments.

from qq import Application
from qq import Context
from qq import SimpleInjector
from qq.plugins import SettingsPlugin
from qq.plugins.types import Settings
from qq.injectors import SetApplication
from qq.injectors import SetInjector


class MyApplication(Application):
    def create_plugins(self):
        self.plugins["settings"] = SettingsPlugin("settings")


application = MyApplication()
application.start("application")

with Context(application) as ctx:
    print(ctx["settings"])

app = SetApplication(application)


@app
@SetInjector("settings", SimpleInjector("settings"))
def samplefun(settings: Settings):
    print(settings)


samplefun()
samplefun({"info": "fake settings"})  # dependency injection !!

context["settings"] in above example, is a variable made by the SettingsPlugin. If you would like to know more, please go to the Tutorial

Installation

pip install quackquack

Metadata

Release files for quackquack 1.3.3

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

Source distribution (sdist)

Source distribution for quackquack 1.3.3
File Size Uploaded
quackquack-1.3.3.tar.gz 12.8 kB Details

Built distribution (wheel)

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

Total release size: 35.5 kB

Release files / quackquack-1.3.3.tar.gz

Download URL quackquack-1.3.3.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ab4f89e2749231edb2450301efb4e43971e9334be607e24ae611fbd6180eb6c3
BLAKE2b-256 checksum
How to use checksums
85df0f4bddc779c79c9287f4bbc7b95ea91d3827e13d75cdf51404b24ba57888
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.2 Linux/6.13.7-arch1-1

Release files / quackquack-1.3.3-py3-none-any.whl

Download URL quackquack-1.3.3-py3-none-any.whl
Size 22.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ec9cedc1ec6033532115fe4510fb47ef632fa7cdeb3d37c6df2a727250c9f21
BLAKE2b-256 checksum
How to use checksums
1e49d8926dcbfa4af4cc1e5e7364a5cd7aa0bacb964afb4af971697f0e2ab1be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.2 Linux/6.13.7-arch1-1

Release history Release notifications | RSS feed

This release

1.3.3 This release

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.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