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.
- 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.10.0.tar.gz
(17.4 kB
view hashes)
Built Distribution
Close
Hashes for microservice-utils-0.10.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e90d828623e000b427583f8d412db02dc84b2d01819479ab0c71b4aba6f8e0be |
|
MD5 | b476817e7f473f1293c909b93bb4b71e |
|
BLAKE2b-256 | 33901f34a1f226e59e6490fdb5369eae269e4ea7ae1c80db4162c377b2a4dd64 |
Close
Hashes for microservice_utils-0.10.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e788f8152ee8f7129c81b8b7b3434c3d231b7436d18d4c2c51d0243ba8542706 |
|
MD5 | 9a0c2d8756aa7c727b32cf53377b2b7d |
|
BLAKE2b-256 | e25da54181d2f223d19f880a1225e85a32e4ce4c6d6312be96c12c7a905ccace |