Skip to main content

No project description provided

Project description

microservice-utils

Utilities and adapters for speeding up microservice development.

Optional Dependencies (Extras)

The package offers optional functionality through extras. Extras can be installed with the package using the following syntax:

pip install microservice-utils[gcp_pubsub]

Available extras:

  • events: Support for event-driven architectures using pydantic for data validation and parsing.
  • gcp_cloud_run: Support for Google Cloud Run with the google-cloud-run client library.
  • gcp_cloud_tasks: Support for Google Cloud Tasks with the google-cloud-tasks client library.
  • gcp_pubsub: Support for Google Cloud Pub/Sub using the google-cloud-pubsub client library and tenacity for retries.
  • gcp_storage: Use GCP Cloud Storage with the async gcloud-aio-storage library.
  • novu: Support for the open-source novu notification center.
  • openai: Support for completions with the OpenAI API.
  • pinecone: Support for semantic search with Pinecone.

To install multiple extras, separate them with commas:

pip install microservice-utils[events,gcp_cloud_run,gcp_cloud_tasks,gcp_pubsub,openai,pinecone]

GCP Pub/Sub

You can subscribe to multiple subscriptions by subsequently calling subscribe(). wait_for_shutdown will block IO for all the subscriptions and wait for the app to be signaled to shut down.

from microservice_utils.google_cloud.adapters.pubsub import Subscriber

subscriber = Subscriber("your-gcp-project-id", prepend_value="staging")

with subscriber:
    subscriber.subscribe(
        "accounts__users", sample_handler
    )

    try:
        subscriber.wait_for_shutdown()
    except KeyboardInterrupt:
        # Gracefully shut down in response to Ctrl+C (or other events)
        subscriber.shutdown()

Releasing a new version

  • Update the package version using semver rules (microservice-utils/__init__.py)
  • Commit and push change
  • Create a new tag with the version (e.g. git tag -a vx.x.x -m '')
  • git push --tags to push the new tag and start the release workflow

Todos

  • Events
  • GCP Pub/Sub
  • GCP Cloud Tasks
  • JWT validation utils
  • Logging

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

microservice_utils-0.13.18.tar.gz (27.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

microservice_utils-0.13.18-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

Details for the file microservice_utils-0.13.18.tar.gz.

File metadata

  • Download URL: microservice_utils-0.13.18.tar.gz
  • Upload date:
  • Size: 27.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for microservice_utils-0.13.18.tar.gz
Algorithm Hash digest
SHA256 9aad40426875978594ec3b67c315a62468911838c658890f45e5d1fd9fdcc220
MD5 4f3f0e1056971e320092364d822e9aed
BLAKE2b-256 db055a150309ef998e5ba652e45e154e5609e367fad9762a8b4f17a581237304

See more details on using hashes here.

File details

Details for the file microservice_utils-0.13.18-py3-none-any.whl.

File metadata

File hashes

Hashes for microservice_utils-0.13.18-py3-none-any.whl
Algorithm Hash digest
SHA256 983cd5677480d9339486ce53da93bba49d686b8e59326f72dda7a8044c99d60e
MD5 b47c11b101c4947f0159cf55b91224fe
BLAKE2b-256 2b68831c89a94fe4dbc90882ed48cfc0e26e79fcee50ec4c2e229e2d1dbe7b3d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page