Giter Site home page Giter Site logo

python-sdk's Introduction

Any language, any framework, anywhere

Go Report OpenSSF Docker Pulls Build Status Test Status Code Coverage License: Apache 2.0 FOSSA Status TODOs Good First Issues discord YouTube X/Twitter

Dapr is a portable, serverless, event-driven runtime that makes it easy for developers to build resilient, stateless and stateful microservices that run on the cloud and edge and embraces the diversity of languages and developer frameworks.

Dapr codifies the best practices for building microservice applications into open, independent, building blocks that enable you to build portable applications with the language and framework of your choice. Each building block is independent and you can use one, some, or all of them in your application.

Dapr overview

We are a Cloud Native Computing Foundation (CNCF) incubation project.

Goals

  • Enable developers using any language or framework to write distributed applications
  • Solve the hard problems developers face building microservice applications by providing best practice building blocks
  • Be community driven, open and vendor neutral
  • Gain new contributors
  • Provide consistency and portability through open APIs
  • Be platform agnostic across cloud and edge
  • Embrace extensibility and provide pluggable components without vendor lock-in
  • Enable IoT and edge scenarios by being highly performant and lightweight
  • Be incrementally adoptable from existing code, with no runtime dependency

How it works

Dapr injects a side-car (container or process) to each compute unit. The side-car interacts with event triggers and communicates with the compute unit via standard HTTP or gRPC protocols. This enables Dapr to support all existing and future programming languages without requiring you to import frameworks or libraries.

Dapr offers built-in state management, reliable messaging (at least once delivery), triggers and bindings through standard HTTP verbs or gRPC interfaces. This allows you to write stateless, stateful and actor-like services following the same programming paradigm. You can freely choose consistency model, threading model and message delivery patterns.

Dapr runs natively on Kubernetes, as a self hosted binary on your machine, on an IoT device, or as a container that can be injected into any system, in the cloud or on-premises.

Dapr uses pluggable component state stores and message buses such as Redis as well as gRPC to offer a wide range of communication methods, including direct dapr-to-dapr using gRPC and async Pub-Sub with guaranteed delivery and at-least-once semantics.

Why Dapr?

Writing highly performant, scalable and reliable distributed application is hard. Dapr brings proven patterns and practices to you. It unifies event-driven and actors semantics into a simple, consistent programming model. It supports all programming languages without framework lock-in. You are not exposed to low-level primitives such as threading, concurrency control, partitioning and scaling. Instead, you can write your code by implementing a simple web server using familiar web frameworks of your choice.

Dapr is flexible in threading and state consistency models. You can leverage multi-threading if you choose to, and you can choose among different consistency models. This flexibility enables you to implement advanced scenarios without artificial constraints. Dapr is unique because you can transition seamlessly between platforms and underlying implementations without rewriting your code.

Features

  • Event-driven Pub-Sub system with pluggable providers and at-least-once semantics
  • Input and output bindings with pluggable providers
  • State management with pluggable data stores
  • Consistent service-to-service discovery and invocation
  • Opt-in stateful models: Strong/Eventual consistency, First-write/Last-write wins
  • Cross platform virtual actors
  • Secret management to retrieve secrets from secure key vaults
  • Rate limiting
  • Built-in Observability support
  • Runs natively on Kubernetes using a dedicated Operator and CRDs
  • Supports all programming languages via HTTP and gRPC
  • Multi-Cloud, open components (bindings, pub-sub, state) from Azure, AWS, GCP
  • Runs anywhere, as a process or containerized
  • Lightweight (58MB binary, 4MB physical memory)
  • Runs as a sidecar - removes the need for special SDKs or libraries
  • Dedicated CLI - developer friendly experience with easy debugging
  • Clients for Java, .NET Core, Go, Javascript, Python, Rust and C++

Get Started using Dapr

See our Getting Started guide over in our docs.

Quickstarts and Samples

Community

We want your contributions and suggestions! One of the easiest ways to contribute is to participate in discussions on the mailing list, chat on IM or the bi-weekly community calls. For more information on the community engagement, developer and contributing guidelines and more, head over to the Dapr community repo.

Contact Us

Reach out with any questions you may have and we'll make sure to answer them as soon as possible!

Platform Link
๐Ÿ’ฌ Instant Message Chat (preferred) Discord Banner
๐Ÿ“ง Mailing List https://groups.google.com/forum/#!forum/dapr-dev
๐Ÿค Twitter @daprdev

Community Call

Every two weeks we host a community call to showcase new features, review upcoming milestones, and engage in a Q&A. All are welcome!

๐Ÿ“ž Visit https://aka.ms/dapr-community-call for upcoming dates and the meeting link.

Videos and Podcasts

We have a variety of keynotes, podcasts, and presentations available to reference and learn from.

๐Ÿ“บ Visit https://docs.dapr.io/contributing/presentations/ for previous talks and slide decks.

Contributing to Dapr

See the Development Guide to get started with building and developing.

Repositories

Repo Description
Dapr The main repository that you are currently in. Contains the Dapr runtime code and overview documentation.
CLI The Dapr CLI allows you to setup Dapr on your local dev machine or on a Kubernetes cluster, provides debugging support, launches and manages Dapr instances.
Docs The documentation for Dapr.
Quickstarts This repository contains a series of simple code samples that highlight the main Dapr capabilities.
Samples This repository holds community maintained samples for various Dapr use cases.
Components-contrib The purpose of components contrib is to provide open, community driven reusable components for building distributed applications.
Dashboard General purpose dashboard for Dapr
Go-sdk Dapr SDK for Go
Java-sdk Dapr SDK for Java
JS-sdk Dapr SDK for JavaScript
Python-sdk Dapr SDK for Python
Dotnet-sdk Dapr SDK for .NET
Rust-sdk Dapr SDK for Rust
Cpp-sdk Dapr SDK for C++
PHP-sdk Dapr SDK for PHP

Code of Conduct

Please refer to our Dapr Community Code of Conduct

python-sdk's People

Contributors

aaroncrawfis avatar amanbha avatar amulyavarote avatar artursouza avatar berndverst avatar brendandburns avatar cgillum avatar chinzhiweiblank avatar dasanind avatar deepanshua avatar dependabot[bot] avatar elena-kolevska avatar hhunter-ms avatar hunter007 avatar italypaleale avatar kenthsu avatar letmerecall avatar marcduiker avatar mukundansundar avatar paulyuk avatar pkedy avatar pruthvidhodda avatar ryanlettieri avatar ryou90 avatar shivamkm07 avatar tmacam avatar wcs1only avatar wmeints avatar xaviergeerinck avatar yaron2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-sdk's Issues

Release dapr-python v0.5.0a0

Describe the proposal

This is the release plan to ship dapr-python v0.5.0b.

  • Package name: dapr
    • python-sdk includes actor sdk implemenation with the generated proto client so that it makes sense to rename from dapr-clients to dapr
  • Package version: 0.5.0b
  • Release work items.
    • Merge features/actor to master
    • Set up CI/CD
    • Improve README.md
    • validate with dotnet-sdk
    • Release dapr-python 0.5.0a

Unable to subscriber to a topic in pubsub-simple example

Expected Behavior

Service should spinn up with hitting dapr run --app-id python-subscriber --protocol grpc --app-port 50051 python subscriber.py

Actual Behavior

It throws following error when we try to spin up subscriber.py

== APP == Exception calling application: Protocol message ListTopicSubscriptionsResponse has no "topics" field.

== APP == Traceback (most recent call last):

== APP ==   File "/home/girish/Documents/dapr/dapr-samples/python-sdk/examples/pubsub-simple/venv/lib/python3.8/site-packages/grpc/_server.py", line 435, in _call_behavior

== APP ==     response_or_iterator = behavior(argument, context)

== APP ==   File "subscriber.py", line 21, in ListTopicSubscriptions

== APP ==     return appcallback_v1.ListTopicSubscriptionsResponse(topics=['TOPIC_A'])

== APP == ValueError: Protocol message ListTopicSubscriptionsResponse has no "topics" field.

Complete logs
dapr_logs.txt

Steps to Reproduce the Problem

Run dapr run --app-id python-subscriber --protocol grpc --app-port 50051 python subscriber.py from examples/pubsub-simple

Settings & configurations

  • using standalone dapr
  • tried with both dapr & dapr-dev
  • CLI version: 0.8.0
  • Runtime version: 0.8.0

Support default json serializer in DaprClient and add .json helper

Describe the proposal

In the convenient layer spec, DaprClient doesn't have the default json serializer, but let users to handle JSON serialization. Like the other python pkgs, such as flask, requests, etc, DaprClient can have default json serializer to serialize and deserialize python dict type or primitive objects and provide .json() helper to DaprResponse and DataContent in AppCallback Layer. It will improve development experience instead of serializing and deserializing data object.

Example - Invoke/OnInvoke Method

Describe the proposal

Adding an example on how to utilize the OnInvoke method from the proto bindings. This example helps users on how to create a gRPC server that can listen on direct method invocations.

Please mark Dapr-dev Python >= 3.7 instead of 3.8

Describe the proposal

I would like to see Python >= 3.7 supported instead of 3.8 (which is cutting edge), seeing that a lot of libraries are still depending on 3.7 at the moment.

Note: Currently I manually clone and install it locally and it's working on Python 3.7 for me

[Proposal] Using Dapr and Python-sdk for ML/DL model deployment

Describe the proposal

The ultimate goal of ML and DL model development is to integrate with the production services. Typically, ML and DL engineers focus on model development rather than how they will integrate model with their services.

Many articles and tutorials introduces how to serve the model with Flask. Once they have Flask service with their model to their production, the backend and frontend services need to implement client code to talk to model server.

Dapr and Python-sdk will be able to resolve this problem easier. So ML engineer creates micro service and deploy it to production cluster without the knowledge of http restful api server and microservice deployment. Backend engineer can use service invocation api to use the model without model server client implementation.

Add Secret api to convenient layer

Describe the proposal

Add Secrets apis to convenient layer.

Parent epic : #67

  • Implementation
  • Unit-tests
  • Documentation in code
  • update or add examples

Allow to pass W3C trace headers to Dapr Api calls

Allow to pass W3C trace header(traceparent) or grpc-trace-bin to Dapr Api call.

0.8.0 supports traceparent and grpc-trace-bin. Python-sdk needs the way to pass traceparent for http or grpc-trace-bin metadata for grpc.

RELEASE NOTE: ADD W3C trace headers to Dapr API calls.

Sphinx Auto-generation of Documentation

Describe the proposal

Sphinx can be used to generate documentation automatically with the autodoc extension. Napoleon extension can be used to process the Google comment style.

Update pubsub example as per new proto apis

Describe the proposal

Current Pub/Sub example doesn't use update proto APIs. I propose to update the example and adapt it to the changes.

(A PR will follow shortly ๐Ÿ˜ƒ )

Add a Pubsub Example

Proposal

Add an example (similar to invoke-simple ) showing pubsub pattern.

Why to add?

Pubsub is a very essential feature and it's hard to find a template to make a subscriber.

Cannot import module "daprclient" in `daprclient_pb2_grpc.py`

When trying to import daprclient_pb2_grpc.py to access the OnInvoke method, an error is thrown. Without this, a correct example utilizing the OnInvoke method can not be created, disallowing the E2E communication of 2 RPC microservices (client and server).

It seems that on the source repo the following proto files are found:

It might be that there is some wrong packaging behavior happening?

Expected Behavior

This should work to allow the creation of the OnInvoke method.

Actual Behavior

== APP == Traceback (most recent call last):
== APP ==   File "server.py", line 7, in <module>
== APP ==     from dapr import daprclient_pb2_grpc as servicesClient
== APP ==   File "C:\Python37\lib\site-packages\dapr\daprclient_pb2_grpc.py", line 4, in <module>
== APP ==     from daprclient import daprclient_pb2 as daprclient_dot_daprclient__pb2
== APP == ModuleNotFoundError: No module named 'daprclient'

Steps to Reproduce the Problem

  1. Create a new Python file (e.g. server.py)
  2. Add line from dapr import daprclient_pb2_grpc as services
  3. Run the application (e.g. dapr run --app-id python-grpc --port 3500 --protocol grpc --grpc-port 50001 python server.py)

Actor Implementation

I currently do not see a way to implement actor methods, is this already supported in the Python SDK? ๐Ÿ˜Š

Add support for async gRPC in Dapr SDK

Describe the proposal

grpc_asyncio is still WIP. We may need to support it later when grpc_asyncio is stable.
https://grpc.github.io/grpc/python/grpc_asyncio.html

Update: grpc_asyncio is now available, however we should publish an asynchronous Dapr Python SDK as a separate SDK, or at least sub package - like dapr.aio (from dapr.aio.clients import DaprClient)

There were concerns from several users about the performance overhead of calling asynchronous methods and running them in a synchronous context, so simply switching over to grpc.aio is not an option unfortunately.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.