Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

djpykafka

🚧 This project is WIP and is subject to change at any time

This project is currently in the alpha state, even though it can be used in production with some caution. Make sure to fix the version in your requirements.txt and review changes frequently.

Installation

pip install djpykafka

Examples

Add the KafkaPublishMixin to your model class.

from django.db import models
from djpykafka.models import KafkaPublishMixin


class MyModel(KafkaPublishMixin, models.Model):
    ...

Create a publisher class, e.g. at events/publish/{modelname_plural}.py

from djpykafka.events.publish import EventPublisher, DataChangePublisher
from ... import models
from ...schemas import response
from . import connection


class MyModelPublisher(
    DataChangePublisher,
    EventPublisher,
    orm_model=models.MyModel,
    event_schema=response.MyModel,
    connection=connection,
    topic='bizberry.access.users',
    data_type='access.user',
):
    pass

AsyncAPI Docs

This feature is WIP.

Install djpykafka with the extra docs (pip install djpykafka[docs]) and add the following snippets to your asgi.py:

from starlette.responses import HTMLResponse, JSONResponse
from starlette.routing import Route
from fastapi.encoders import jsonable_encoder
from asyncapi_docgen.docs import get_asyncapi_ui_html

# ! Import after django's get_asgi_application()

from djpykafka.docs.asyncapi import get_asyncapi


def asyncapi_html(request):
    return HTMLResponse(get_asyncapi_ui_html(asyncapi_url='/asyncapi.json'))


def asyncapi_json(request):
    return JSONResponse(jsonable_encoder(get_asyncapi(), by_alias=True, exclude_none=True))


app = FastAPI(
    ...,
    routes=[
        Route('/asyncapi', asyncapi_html),
        Route('/asyncapi.json', asyncapi_json),
    ],
)

Metadata

Release files for djpykafka 0.0.44

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

Source distribution (sdist)

Source distribution for djpykafka 0.0.44
File Size Uploaded Provenance Actions
djpykafka-0.0.44.tar.gz 22.9 kB Without provenance Details for djpykafka-0.0.44.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for djpykafka 0.0.44
File Interpreter ABI Platform Actions
djpykafka-0.0.44-py3-none-any.whl Python 3 none any Details for djpykafka-0.0.44-py3-none-any.whl

Total release size: 48.4 kB

Release files / djpykafka-0.0.44.tar.gz

Download URL djpykafka-0.0.44.tar.gz
Size 22.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bf0e7e38592b0c2fb40716547d2860498bc059a81f01be4ffbe5ca50888446d4
BLAKE2b-256 checksum
How to use checksums
bab4ba3d0ef41b041d75c7c8b866d00dc4c78ee346681cd3cd5a16c128d703e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / djpykafka-0.0.44-py3-none-any.whl

Download URL djpykafka-0.0.44-py3-none-any.whl
Size 25.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11c7b7cc8c400b0eba58ffab9adc5929ae3658ddfdc9ff97e9b59b0bc584ed01
BLAKE2b-256 checksum
How to use checksums
6da11698a1dbcfa1ef73ae1b609bcd747a99bda254fe13edb8e4ca75fdd635fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Security for djpykafka 0.0.44

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
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