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.3

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.3
File Size Uploaded
omnixys_commons-3.0.3.tar.gz 73.8 kB Details

Built distribution (wheel)

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

Total release size: 118.8 kB

Release files / omnixys_commons-3.0.3.tar.gz

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

Download URL omnixys_commons-3.0.3-py3-none-any.whl
Size 45.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
904bc647c7c40d06886dc94c5623e8cdc0ebe13b3760795f4f571de6097e249f
BLAKE2b-256 checksum
How to use checksums
364a08400cb75f323cf42f6d737e82681eb5deb35980b35e2552defde1cdef21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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

This release

3.0.3 This release

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