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 3.0.2

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 3.0.2
File Size Uploaded
omnixys_commons-3.0.2.tar.gz 73.7 kB Details

Built distribution (wheel)

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

Total release size: 118.8 kB

Release files / omnixys_commons-3.0.2.tar.gz

Download URL omnixys_commons-3.0.2.tar.gz
Size 73.7 kB
Tags Source
SHA-256 checksum
How to use checksums
78bafc29977def90ddcb670941d8aa06ab6758cbb686cc0ca0980ab7330126c9
BLAKE2b-256 checksum
How to use checksums
fbf06bfe094df7a104a1d8b225a99910a9161e2e7a5922adb632d96c3543ad84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","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 / omnixys_commons-3.0.2-py3-none-any.whl

Download URL omnixys_commons-3.0.2-py3-none-any.whl
Size 45.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
118497c6401b7b83d36fd33c2220e1b76a3a3a0a2d93e64ed3b88b2b2b2af2c4
BLAKE2b-256 checksum
How to use checksums
edd8ac8123571a422f56ceb4ef6d1eaa4ae3aeeb939b1d14aca7b468b130f8b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","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 history Release notifications | RSS feed

4.0.0

2 release files

3.0.3

2 release files

This release

3.0.2 This release

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