Skip to main content

Búvár

This is heavily inspired by Pyramid and my daily needs to fastly create and maintain microservice like applications.

Requires Python 3.14 or newer.

a plugin mechanic

  • plugin may depend on other plugins

  • plugins yield tasks to run

  • a context registry serves as a store for application components created by plugins

  • a dependency injection creates intermediate components

  • a config source is mapped to plugin specific configuration and may be fully overridden by environment vars

  • structlog boilerplate for json/tty logging

  • fork the process and share bound sockets

  • pytest fixtures to reduce testing boilerplate

You bootstrap like following:

from buvar import plugin

plugin.stage("some.module.with.prepare")
# some.module.with.prepare
from buvar import context, plugin

class Foo:
    ...


async def task():
    asyncio.sleep(1)


async def server():
    my_component = context.get(Foo)
    await asyncio.Future()


# there is also plugin.Teardown and plugin.Cancel
async def prepare(load: plugin.Loader):
    await load('.another.plugin')

    # create some long lasting components
    my_component = context.add(Foo())

    # you may run simple tasks
    yield task()

    # you may run server tasks
    yield server()

a components and dependency injection solution

Dependency injection relies on registered adapters, which may be a function, a method, a class, a classmethod or a generic classmthod.

Dependencies are looked up in components or may be provided via kwargs.

Return type annotations may be classes, generic aliases (list[Foo], dict[str, Foo]) or PEP 695 type X = ... aliases.

from buvar import di

class Bar:
    pass

class Foo:
    def __init__(self, bar: Bar = None):
        self.bar = bar

    @classmethod
    async def adapt(cls, baz: str) -> Foo:
        return Foo()

async def adapt(bar: Bar) -> Foo
    foo = Foo(bar)
    return foo


async def task():
    foo = await di.nject(Foo, baz="baz")
    assert foo.bar is None

    bar = Bar()
    foo = await di.nject(Foo, bar=bar)
    assert foo.bar is bar

async def prepare():
    di.register(Foo.adapt)
    di.register(adapt)

    yield task()

a config source

buvar.config.ConfigSource is just a dict, which merges arbitrary dicts into one. It serves as the single source of truth for application variability.

You can load a section of config values into your custom attrs class instance. ConfigSource will override values by environment variables if present.

config.toml

log_level = "DEBUG"
show_warnings = "yes"

[foobar]
some = "value"
export APP_FOOBAR_SOME=thing
import attr
import toml

from buvar import config

@attr.s(auto_attribs=True)
class GeneralConfig:
    log_level: str = "INFO"
    show_warnings: bool = config.bool_var(False)


@attr.s(auto_attribs=True)
class FoobarConfig:
   some: str


source = config.ConfigSource(toml.load('config.toml'), env_prefix="APP")

general_config = source.load(GeneralConfig)
assert general_config == GeneralConfig(log_level="DEBUG", show_warnings=True)

foobar_config = source.load(FoobarConfig, 'foobar')
assert foobar_config.some == "thing"

There is a shortcut to the above approach provided by buvar.config.Config, which requires to be subclassed from it with a distinct section attribute. If one adds a buvar.config.ConfigSource component, he will receive the mapped config in one call.

from buvar import config, plugin


@attr.s(auto_attribs=True)
class GeneralConfig(config.Config):
    log_level: str = "INFO"
    show_warnings: bool = config.bool_var(False)


@attr.s(auto_attribs=True)
class FoobarConfig(config.Config, section="foobar"):
    some: str


async def prepare(load: plugin.Loader):
    # this would by typically placed in the main CLI entry point
    source = context.add(config.ConfigSource(toml.load('config.toml'), env_prefix="APP"))

    # to provide the adapter to di, which could also be done in the main entry point
    await load(config)
    foobar_config = await di.nject(FoobarConfig)

a structlog

Just structlog boilerplate.

import sys

from buvar import log

log_config = log.LogConfig(tty=sys.stdout.isatty(), level="DEBUG")
log_config.setup()

forked process and shared sockets

You may fork your process and bind and share sockets, to leverage available CPUs e.g. for serving an aiohttp microservice.

Signals like INT, TERM, HUP are forwarded to the child processes.

import aiohttp.web
from buvar import fork, plugin, di, context
from buvar_aiohttp import AioHttpConfig


async def hello(request):
    return aiohttp.web.Response(body=b"Hello, world")


async def prepare_aiohttp(load: plugin.Loader):
    await load("buvar_aiohttp")

    app = await di.nject(aiohttp.web.Application)
    app.router.add_route("GET", "/", hello)


context.add(AioHttpConfig(host="0.0.0.0", port=5678))

fork.stage(prepare_aiohttp, forks=0, sockets=["tcp://:5678"])

pytest

There are a couple of pytest fixtures provided to get your context into a reasonable state:

buvar_config_source

A dict with arbitrary application settings.

buvar_context

The basic context staging operates on.

buvar_stage

The actual stage processing all plugins.

buvar_load

The loader to add plugins to the stage.

buvar_plugin_context

The context all plugins share, when they are prepared.

Following markers may be applied to a test

buvar_plugins(plugin, ...)

Load all plugins into plugin context.

import pytest


async def prepare():
    from buvar import context

    context.add("foobar")


@pytest.mark.asyncio
@pytest.mark.buvar_plugins("tests.test_testing")
async def test_wrapped_stage_context():
    from buvar import context, plugin

    assert context.get(str) == "foobar"
    assert context.get(plugin.Cancel)


@pytest.mark.asyncio
@pytest.mark.buvar_plugins()
async def test_wrapped_stage_context_load(buvar_load):
    from buvar import context, plugin

    await buvar_load(prepare)
    assert context.get(str) == "foobar"
    assert context.get(plugin.Cancel)

Metadata

Release files for buvar 0.44.20

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

Source distribution (sdist)

Source distribution for buvar 0.44.20
File Size Uploaded Provenance Actions
buvar-0.44.20.tar.gz 34.5 kB With provenance Details for buvar-0.44.20.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for buvar 0.44.20
File Actions
buvar-0.44.20-cp314-cp314t-musllinux_1_2_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ x86-64 Details for buvar-0.44.20-cp314-cp314t-musllinux_1_2_x86_64.whl
buvar-0.44.20-cp314-cp314t-musllinux_1_2_aarch64.whl CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ ARM64 Details for buvar-0.44.20-cp314-cp314t-musllinux_1_2_aarch64.whl
buvar-0.44.20-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ ARM64, Linux glibc 2.28+ ARM64 Details for buvar-0.44.20-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
buvar-0.44.20-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.5+ x86-64, Linux glibc 2.28+ x86-64 Details for buvar-0.44.20-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
buvar-0.44.20-cp314-cp314t-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 Details for buvar-0.44.20-cp314-cp314t-macosx_11_0_arm64.whl
buvar-0.44.20-cp314-cp314-musllinux_1_2_x86_64.whl CPython 3.14 CPython 3.14 Linux musl 1.2+ x86-64 Details for buvar-0.44.20-cp314-cp314-musllinux_1_2_x86_64.whl
buvar-0.44.20-cp314-cp314-musllinux_1_2_aarch64.whl CPython 3.14 CPython 3.14 Linux musl 1.2+ ARM64 Details for buvar-0.44.20-cp314-cp314-musllinux_1_2_aarch64.whl
buvar-0.44.20-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ ARM64, Linux glibc 2.28+ ARM64 Details for buvar-0.44.20-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
buvar-0.44.20-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64, Linux glibc 2.5+ x86-64 Details for buvar-0.44.20-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
buvar-0.44.20-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for buvar-0.44.20-cp314-cp314-macosx_11_0_arm64.whl

Total release size: 5.1 MB

Release files / buvar-0.44.20.tar.gz

Download URL buvar-0.44.20.tar.gz
Size 34.5 kB
Tags Source
SHA-256 checksum
How to use checksums
abf236986ff25d28a3bb500e914ac55fe85b7d2a005823e3183c4aa8e5c4d996
BLAKE2b-256 checksum
How to use checksums
171e1c845bfc09639d19a22e15c3ecff817948f52f9f8d4124937b6dd5c4784c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / buvar-0.44.20-cp314-cp314t-musllinux_1_2_x86_64.whl

Download URL buvar-0.44.20-cp314-cp314t-musllinux_1_2_x86_64.whl
Size 646.0 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
29e9bc5eab6a2c58cfaa54e3634619943238def1ef8aee756d3ccca60495de2f
BLAKE2b-256 checksum
How to use checksums
f9afb5125b59a795f258a532dc8d189f61940b52ff74741833acf39e13659117
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / buvar-0.44.20-cp314-cp314t-musllinux_1_2_aarch64.whl

Download URL buvar-0.44.20-cp314-cp314t-musllinux_1_2_aarch64.whl
Size 643.3 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ ARM64
SHA-256 checksum
How to use checksums
d99dc4627da4101d86d53e9665728eb7552646076a46e67f59e44f2f2c077e44
BLAKE2b-256 checksum
How to use checksums
662817628e7c5b69a8739e969673660b00c72ed4a47ef3598fca64aa784feeed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / buvar-0.44.20-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL buvar-0.44.20-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 668.2 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
dcb6e050eb88adf0687df94400aae647ea39831927b858df9cf9fa246aa5a20f
BLAKE2b-256 checksum
How to use checksums
78c5fba490a26c7c17c7cd1da9083fbc0cfe9c7b4a09e87cfd40ff66e8d7e512
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / buvar-0.44.20-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL buvar-0.44.20-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 652.3 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
8b3b948c28ae1b9399618a6c1e38b8ac254089c9894281ca5977aee86680df4b
BLAKE2b-256 checksum
How to use checksums
8df8cb4567a7ff40c44cf7140557cdea76b2af67bf170dd5a0151e7ba7d429a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / buvar-0.44.20-cp314-cp314t-macosx_11_0_arm64.whl

Download URL buvar-0.44.20-cp314-cp314t-macosx_11_0_arm64.whl
Size 119.3 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1428c8b9235f2971065b0482d292763cac90db495f4d75444be662320ce36c6a
BLAKE2b-256 checksum
How to use checksums
f914c1fe4016ed662b4c9262657bf2f5b0c1597b4cdf26b0340548eed8cbe08b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / buvar-0.44.20-cp314-cp314-musllinux_1_2_x86_64.whl

Download URL buvar-0.44.20-cp314-cp314-musllinux_1_2_x86_64.whl
Size 562.1 kB
Tags CPython 3.14 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
f154246bb3766dcacac26cf976e2f95b8fe83f1203807e0e2fb9b7a02e4380f2
BLAKE2b-256 checksum
How to use checksums
1472ea3b7a512a2a4ef0972cb3fc3dcb5a359766fe2cad54d2c7dad65ce3b1af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / buvar-0.44.20-cp314-cp314-musllinux_1_2_aarch64.whl

Download URL buvar-0.44.20-cp314-cp314-musllinux_1_2_aarch64.whl
Size 546.8 kB
Tags CPython 3.14 Linux musl 1.2+ ARM64
SHA-256 checksum
How to use checksums
e5f3b27cfa14cd6f470264cbaec97c1532102b8cce1c3109408bc0cf982e0414
BLAKE2b-256 checksum
How to use checksums
4f93689c7c8af1d7dc7c7387ec5e772439bf595af8213fba8d252adbc5b6e0c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / buvar-0.44.20-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL buvar-0.44.20-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 558.0 kB
Tags CPython 3.14 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
9298de0efa7380aab2182e83edf93c772cc80e369f8c0c659087e33d6cb56a48
BLAKE2b-256 checksum
How to use checksums
607d353e7443fc4f5c74dbc3394728f976589e32daeeecec24e490e987e2dac2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / buvar-0.44.20-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL buvar-0.44.20-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 563.2 kB
Tags CPython 3.14 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
bb6850a9fad4ead88f90e02a066676ab2a73458409a5a85f8d63c1a327be8966
BLAKE2b-256 checksum
How to use checksums
faa4d8409a146ff383b7ff078d4d072cf41dc814d54e37a39abb24fbec9f1014
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / buvar-0.44.20-cp314-cp314-macosx_11_0_arm64.whl

Download URL buvar-0.44.20-cp314-cp314-macosx_11_0_arm64.whl
Size 110.0 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5d801ba863b4d230341917413cf8224458791ef8e84395630f441954f4a42aee
BLAKE2b-256 checksum
How to use checksums
61b379acd2c45ffa8a9978de7d91fafb8d5246ee1748338160e8ab04f7a721b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Security for buvar 0.44.20

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 11 files in this release have been uploaded with provenance metadata.

Select from 11 files

Attestation for buvar-0.44.20.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.44.20 This release

11 release files Full provenance

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