Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

bazaar-contrib-server

The Bazaar Compute server itself. The server entry draws the shell around every module — the sidebar and the settings page — and offers SERVER, where modules register their pages, API, sidebar links and panels, update topics and permission points, and THEME, where theme contribs register the looks the pages can wear. The server-theme-night and server-theme-day entries are the theme plugins it comes with: the night market and the morning market.

[[contribs]]
package = "bazaar-contrib-server~=0.3.0rc1"
[[contribs.enabled]]
entry = "server"
[[contribs.enabled]]
entry = "server-theme-night"
[[contribs.enabled]]
entry = "server-theme-day"

A module registers what it serves inside its lifespan; each registration holds while its context is open:

import asyncio
from contextlib import asynccontextmanager

from bazaar_contrib_server import SERVER, PermissionItem, SidebarItem
from bazaar_core import Context, Contrib
from importlib.resources import files
from pathlib import Path
from starlette.routing import Route


@asynccontextmanager
async def lifespan(ctx: Context):
    server = ctx.accept(SERVER)
    pages = await server.pages("notes", __package__)

    async def home(request):
        return await pages.render(request, "notes.html")

    resources = Path(str(files(__package__))) / "resources"
    icon = await asyncio.to_thread((resources / "notes.svg").read_text)
    async with (
        server.module(
            "notes",
            ui=pages.application([Route("/", home)]),
            static=resources / "static",
            locales=resources / "locales",
        ),
        server.permission(
            PermissionItem(point="notes.view", description="notes.view.description")
        ),
        server.sidebar(
            SidebarItem(
                text="notes.title",
                icon=icon,
                path="/notes",
                group="server.sidebar.workbench",
                permission="notes.view",
            )
        ),
    ):
        yield


notes = Contrib(accepts=[SERVER], lifespan=lifespan)

The icon is an SVG drawn as the design's are, with class i and a 24×24 view box. The module's interface is served at /ui/notes inside the shell at /notes, its API at /api/notes and its files at /static/notes. Its templates live in resources/templates of its package and extend server/base.html, which brings the theme stylesheet and the embedding script; pages of any other framework include /static/server/theme.css and /static/server/embed.js themselves. Everything behind the shell needs a login module, which registers itself with server.login; until one does, those pages and APIs answer 503.

The login module describes each request's account with Account: the name pages show, the address of its picture if it has one, its language, its theme mode and its day and night themes. It answers with Admitted, which also carries headers the response should get, such as the cookie of a session it renewed on the way. The settings page's appearance part, open to every account, lets the account choose the language, the theme mode and the day and night themes, and passes the choice to the login module's dress; the whole window is then drawn again in the new look. A day or night theme that is not registered falls back to the morning or the night market.

A page draws its own top bar from server/base.html: its title, a way back on a narrow screen (the back block), crumbs on a wide one (crumbs) and its actions (actions); a part of the settings page empties the top block. Sidebar links sit under their group's heading; links of different modules naming one group share it. A link may name an update topic as its badge, whose state is a text and a kind (count, unread or soon). server.panel adds a module's own section to the sidebar, its page loaded in an iframe under a group or at the top, and on a narrow screen in the strip above the bottom bar; the page draws itself for either layout. The overview is a module of its own, server-overview.

What changes while a page is open reaches it through the update bus, as 0.2's /poll did. A module registers a Topic with server.topic: its name, the scope fields it takes, its permission point and how to fetch its state for an account. An element naming data-topic (with data-scope and data-seen as JSON) is followed once its page loads, and hears bazaar:change when the state changes; scripts follow topics with window.top.bazaarBus.follow, which answers with the way to stop; a subscription given its element stops once the element leaves its page. The outermost window asks the server about everything its frames follow in one request a round.

Below 960 pixels the shell becomes one column with the sidebar as a bar along the bottom. Pages in its frames lay out as the shell does, not by their frame's width: embed.js marks their root data-layout="narrow" or "wide", and their narrow-screen rules select on that.

Metadata

Release files for bazaar-contrib-server 0.3.0rc3

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

Source distribution (sdist)

Source distribution for bazaar-contrib-server 0.3.0rc3
File Size Uploaded Provenance Actions
bazaar_contrib_server-0.3.0rc3.tar.gz 482.5 kB Without provenance Details for bazaar_contrib_server-0.3.0rc3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bazaar-contrib-server 0.3.0rc3
File Interpreter ABI Platform Actions
bazaar_contrib_server-0.3.0rc3-py3-none-any.whl Python 3 none any Details for bazaar_contrib_server-0.3.0rc3-py3-none-any.whl

Total release size: 977.0 kB

Release files / bazaar_contrib_server-0.3.0rc3.tar.gz

Download URL bazaar_contrib_server-0.3.0rc3.tar.gz
Size 482.5 kB
Tags Source
SHA-256 checksum
How to use checksums
bfa3b98bc3e1d8c967fd5424825b214ed683dd8f87b679cfbaa454c3052ff3c0
BLAKE2b-256 checksum
How to use checksums
886468e5a5a8b6ae9dcb625bda0f13e26b8b087bc61d2d6bd78ef9b96e20cae8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bazaar_contrib_server-0.3.0rc3-py3-none-any.whl

Download URL bazaar_contrib_server-0.3.0rc3-py3-none-any.whl
Size 494.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57036eae3667dc7ae518bd60cfb0dada72271b227b8bd9fe6e61efa24cbb951a
BLAKE2b-256 checksum
How to use checksums
f8a2b1ade57de57066ea1fa02380157eab8eb91ba6595867304568ca21bd2edf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for bazaar-contrib-server 0.3.0rc3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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