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
Release history Release notifications | RSS feed
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.12.1.tar.gz
(20.0 kB
view details)
Built Distribution
File details
Details for the file microservice-utils-0.12.1.tar.gz
.
File metadata
- Download URL: microservice-utils-0.12.1.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | db03a4a4185e44d7b0f712906507d3cb523305f02bf323f37a846b7bb26fa655 |
|
MD5 | 40ff66bcb4d6a3c0ac9699bd5eb71d21 |
|
BLAKE2b-256 | eb96f475a1102037460ec863197c6ff8695947441e676010e926fc4482f1f8c8 |
File details
Details for the file microservice_utils-0.12.1-py3-none-any.whl
.
File metadata
- Download URL: microservice_utils-0.12.1-py3-none-any.whl
- Upload date:
- Size: 25.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e27286f3d0db9d8b9c46b9c2b5c346f7f5fa5466c31cebd73ce82ccaf4bbac7b |
|
MD5 | e96a3fda5697adcbd9e6af31f545c5b0 |
|
BLAKE2b-256 | 78a8b9a19502cfd07ca11137e7b92e3ca267228a6e74bfdc02e4321b53673fd6 |