Skip to main content

omnixys-commons

Omnixys shared platform contracts — transport-neutral DTOs, enums, errors, models, and schemas shared by all Omnixys services.

Installation

pip install omnixys-commons

Features

  • DTOs: transport Data Transfer Objects for API communication (commons.dtos)
  • Enums: shared enumerations across services, including the full event permission model (commons.enums)
  • Errors: standardized error handling with a stable wire vocabulary — ErrorCode (~130 codes), OmnixysException, and domain exceptions (commons.errors)
  • Models: Pydantic domain models for API responses, pagination, envelopes, and identity (commons.models)
  • Schemas: versioned contract schemas with a ContractSchemaRegistry for MAJOR.MINOR-versioned parsing (commons.schemas)
  • Utils: locale mapping, phone-number extraction, username generation, event-role permissions, and null↔undefined helpers (commons.utils)

Usage

Errors

from commons.errors import ErrorCode, OmnixysException, is_error_code, with_metadata

raise OmnixysException(ErrorCode.EVENT_CLOSED, "Event is closed", metadata={"eventId": "..."})
assert is_error_code("EVENT_NOT_FOUND") is True

Domain exceptions carry their wire code:

from commons.errors import EventNotFoundException

try:
    ...
except EventNotFoundException as exc:
    exc.code          # "EVENT_NOT_FOUND"
    exc.request_id    # from ExceptionContext
    exc.metadata

Contract schema registry

from pydantic import BaseModel
from commons.schemas import ContractSchemaRegistry

class UserContract(BaseModel):
    name: str

registry = ContractSchemaRegistry()
registry.register("user", "1.0", UserContract)
user = registry.parse("user", "1.0", {"name": "Ada"})

Pagination

from commons.models import PaginationResponse

resp = PaginationResponse(items=[1, 2, 3], total=25, page=0, size=10)
resp.total_pages   # 3
resp.has_next      # True

Utilities

from commons.utils import get_primary_phone_number, unique_event_permissions

primary = get_primary_phone_number(phone_numbers)   # "+49..." or None
perms = unique_event_permissions(["event.view", "event.view"])

License

GPL-3.0-or-later

Metadata

Release files for omnixys-commons 4.0.0

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

Source distribution (sdist)

Source distribution for omnixys-commons 4.0.0
File Size Uploaded
omnixys_commons-4.0.0.tar.gz 57.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for omnixys-commons 4.0.0
File Interpreter ABI Platform
omnixys_commons-4.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 102.5 kB

Release files / omnixys_commons-4.0.0.tar.gz

Download URL omnixys_commons-4.0.0.tar.gz
Size 57.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f21b7e060b4dffe64f5384fb1b750342c56786f33bdf2d258a8c78c260f4a5a8
BLAKE2b-256 checksum
How to use checksums
09f8afce8f2e31b937c99df8488fc4c0015304821a01de305e8f0ee74adb6bce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / omnixys_commons-4.0.0-py3-none-any.whl

Download URL omnixys_commons-4.0.0-py3-none-any.whl
Size 45.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1819be23cb09a5e4e44529e417e087f223172b4de357bcdf79e7efb41de8a926
BLAKE2b-256 checksum
How to use checksums
a64486316d2f649cdd5a80a9320e6a6524c1fe1a76f90e9baf8eb201efa29787
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

4.0.0 This release

2 release files

3.0.3

2 release files

3.0.2

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