Skip to main content

Team plugin for Belgie

Project description

Belgie Team: Team Management on Top of Organizations

[!WARNING] belgie-team requires the organization plugin to be registered first, and both plugins must share a team-capable adapter. The package does not ship built-in HTTP routes.

Belgie Team adds request-scoped team workflows to Belgie without taking over your route design. You register the plugin, inject TeamClient into your own FastAPI endpoints, and keep control of team creation, membership, and administrative actions inside app-owned routes.

The package is built for apps that already use Belgie Organization and want organization-scoped teams with explicit adapter wiring and predictable permissions.

Installation

uv add belgie-team belgie-organization

[!NOTE] In the umbrella package, the equivalent install is uv add belgie[team,organization]. In most real applications you will also want belgie[alchemy] or another concrete adapter implementation.

What It Provides

  • Team settings for team-specific configuration.
  • TeamPlugin for FastAPI dependency injection.
  • TeamClient for app-owned team workflows.
  • TeamView and TeamMemberView response models.

Quick Start

from typing import Annotated

from fastapi import Depends, FastAPI

from belgie import Belgie, BelgieSettings
from belgie_organization import Organization as OrganizationSettings
from belgie_team import Team as TeamSettings, TeamClient

settings = BelgieSettings(secret="your-secret-key", base_url="http://localhost:8000")

auth = Belgie(settings=settings, adapter=core_adapter, database=...)

organization_plugin = auth.add_plugin(
    OrganizationSettings(adapter=team_adapter),
)
team_plugin = auth.add_plugin(
    TeamSettings(adapter=team_adapter),
)

app = FastAPI()
app.include_router(auth.router)


@app.post("/teams")
async def create_team(
    team: Annotated[TeamClient, Depends(team_plugin)],
) -> dict[str, str]:
    created = await team.create(
        name="platform",
        organization_id=organization_id,
    )
    return {"team_id": str(created.id)}


@app.get("/teams")
async def list_my_teams(
    team: Annotated[TeamClient, Depends(team_plugin)],
) -> dict[str, int]:
    teams = await team.for_individual()
    return {"count": len(teams)}

Register the organization plugin first. During router initialization, TeamPlugin verifies that the organization plugin exists and that its adapter implements the team-aware protocol.

Core API

TeamClient exposes the main team workflows:

  • create, teams, update, and delete
  • for_individual
  • members, add_member, and remove_member

Behavior

  • Creating a team automatically adds the current user as a member if they are not already on the team.
  • Team creation and membership management require organization admin or owner permissions.
  • Listing members requires both organization membership and team membership.
  • Team-scoped operations resolve the owning organization internally from the team record.

Configuration

Team is a Pydantic settings model with the BELGIE_TEAM_ prefix.

  • adapter is required.
  • maximum_teams_per_organization optionally limits team creation.
  • maximum_members_per_team optionally limits team membership.

Example

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

belgie_team-0.14.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

belgie_team-0.14.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file belgie_team-0.14.0.tar.gz.

File metadata

  • Download URL: belgie_team-0.14.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","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}

File hashes

Hashes for belgie_team-0.14.0.tar.gz
Algorithm Hash digest
SHA256 43096877b3248676e60480682e4421c6236ad8fa00dfca482f5c8fa7ca23d8df
MD5 6db428efb8377be1802aa3507a96e165
BLAKE2b-256 57f94793a67c2713c644057fa9ecfb56ce2c4be90befb575570f984fd123c8bb

See more details on using hashes here.

File details

Details for the file belgie_team-0.14.0-py3-none-any.whl.

File metadata

  • Download URL: belgie_team-0.14.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","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}

File hashes

Hashes for belgie_team-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 97a3fd09fd26151929a8475a6967c5dc72af86c319092772e8c16b9c6cd540ee
MD5 f7b2bcee9647189a961498ccf8b8fb10
BLAKE2b-256 be86893e5e6733b167302057159cde0f3140f0a4cb8bbd06247733ef644da37a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page