Shared protocol interfaces for Belgie
Project description
Belgie Proto: Shared Protocol Interfaces for Belgie Packages
[!WARNING]
belgie-protois intentionally low-level. It defines the contracts that other Belgie packages depend on, so changes here can ripple across adapters, plugins, and app code that implements these protocols directly.
belgie-proto is the contract layer for the Belgie workspace. It defines the runtime-checkable protocols for
accounts, individuals, OAuth accounts, sessions, OAuth state, adapters, organizations, invitations, teams, and database
connections so the rest of the stack can stay typed without hard-coding a particular ORM or persistence model.
Use it when you are implementing your own adapter, building custom integrations on top of belgie-core, or depending
on shared interfaces across multiple Belgie packages. If you want a working SQLAlchemy implementation, start with
belgie-alchemy.
Installation
uv add belgie-proto
[!NOTE] Most applications do not need to install
belgie-protodirectly. It is already pulled in by higher-level Belgie packages such asbelgie-coreandbelgie-alchemy.
What It Defines
- Core protocols for
Account,Individual,OAuthAccount,Session, andOAuthState. DBConnectionfor the async database/session object passed through Belgie.AdapterProtocolfor core auth persistence operations.OrganizationAdapterProtocolandOrganizationTeamAdapterProtocolfor org-aware adapters.TeamAdapterProtocolfor team-aware adapters.- Shared organization and team model protocols plus error types such as
PendingInvitationConflictError.
Quick Start
Here is a minimal adapter surface using the core protocols:
from belgie_proto.core import AdapterProtocol, DBConnection, IndividualProtocol
class MyIndividual(IndividualProtocol):
...
class MyAdapter(AdapterProtocol):
async def get_individual_by_email(self, session: DBConnection, email: str) -> MyIndividual | None:
...
async def create_individual(
self,
session: DBConnection,
email: str,
name: str | None = None,
image: str | None = None,
*,
email_verified_at=None,
) -> MyIndividual:
...
# implement the rest of AdapterProtocol
The important constraint is not inheritance from a base class. It is satisfying the protocol shape that Belgie expects. That keeps the integration flexible while preserving type checking across packages.
Namespaces
- Import core auth contracts from
belgie_proto.core. - Import organization contracts from
belgie_proto.organization. - Import team contracts from
belgie_proto.team.
When To Reach For It
- You are writing a custom adapter instead of using
belgie-alchemy. - You want package boundaries enforced by protocols instead of concrete ORM models.
- You are extending Belgie with org or team support and need the shared adapter contracts.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file belgie_proto-0.15.0.tar.gz.
File metadata
- Download URL: belgie_proto-0.15.0.tar.gz
- Upload date:
- Size: 7.5 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d530729471acf70dc82dc609b06115cfa9afaa6a5a5ca7adcc5cb1b411c7f3a
|
|
| MD5 |
dc1b8c63d1fa8e6a891ceb913d46308a
|
|
| BLAKE2b-256 |
a64bbb75db92ec7aea1add5b7978dd697bc845a0f89a63b91cb0a0101d6041e8
|
File details
Details for the file belgie_proto-0.15.0-py3-none-any.whl.
File metadata
- Download URL: belgie_proto-0.15.0-py3-none-any.whl
- Upload date:
- Size: 22.0 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5d7c1d350ffcf70c0496275724eb69ee01b2033e9c1588416ad92ee997e14c1
|
|
| MD5 |
3830ef4c01f6e65fea56425f3f2d407e
|
|
| BLAKE2b-256 |
ea74e20caef63c418d52d73d937a8f165f6b1a4dfcadc42a83eed10bb1783526
|