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.
  • 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.9.0.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

microservice_utils-0.9.0-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file microservice-utils-0.9.0.tar.gz.

File metadata

  • Download URL: microservice-utils-0.9.0.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for microservice-utils-0.9.0.tar.gz
Algorithm Hash digest
SHA256 5167a70d684e3c43eebe1a9f423707770d17324d175d54143843c2e5a1f5f651
MD5 cd711c20871ae299b95148cd6dcfb30a
BLAKE2b-256 3437fc4a169db9a13fe5d41ee69b967a00ed91391f40cfceb74c231761012775

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for microservice_utils-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 880af105794beaee3c69282ca17344f24461bf68e101e3d04a78f73c52c6232f
MD5 7b2a3db5a872a3f771ec71db10c7497c
BLAKE2b-256 f335320576d658f344db0d6a9936496b9013d39353d30a69e6cd1db2e8a8b7ce

See more details on using hashes here.

Supported by

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