Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "sdkdocs/python"]
path = sdkdocs/python
url = https://github.com/dapr/python-sdk.git
[submodule "sdkdocs/php"]
path = sdkdocs/php
url = https://github.com/dapr/php-sdk.git
Expand Down
4 changes: 2 additions & 2 deletions hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,10 @@ module:
target: assets
- source: daprdocs/archetypes
target: archetypes
- source: sdkdocs/python/daprdocs/content/en/python-sdk-docs
- source: sdkdocs/python/content/en/python-sdk-docs
target: content/developing-applications/sdks/python
lang: en
- source: sdkdocs/python/daprdocs/content/en/python-sdk-contributing
- source: sdkdocs/python/content/en/python-sdk-contributing
target: content/contributing/sdk-contrib/
lang: en
- source: sdkdocs/php/daprdocs/content/en/php-sdk-docs
Expand Down
1 change: 0 additions & 1 deletion sdkdocs/python
Submodule python deleted from 5882d5
25 changes: 25 additions & 0 deletions sdkdocs/python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Dapr Python SDK documentation

This page covers how the documentation is structured for the Dapr Python SDK.

## Dapr Docs

All Dapr documentation is hosted at [docs.dapr.io](https://docs.dapr.io), including the docs for the [Python SDK](https://docs.dapr.io/developing-applications/sdks/python/). Head over there if you want to read the docs.

### Python SDK docs source

Although the docs site code and content is in the [docs repo](https://github.com/dapr/docs), the Python SDK content and images are within the `content` and `static` directories, respectively.

This allows separation of roles and expertise between maintainers, and makes it easy to find the docs files you are looking for.

## Writing Python SDK docs

To get up and running to write Python SDK docs, visit the [docs repo](https://github.com/dapr/docs) to initialize your environment. It will clone both the docs repo and this repo, so you can make changes and see it rendered within the site instantly, as well as commit and PR into this repo.

Make sure to read the [docs contributing guide](https://docs.dapr.io/contributing/contributing-docs/) for information on style/semantics/etc.

## Docs architecture

The docs site is built on [Hugo](https://gohugo.io), which lives in the docs repo. This repo is setup as a git submodule so that when the repo is cloned and initialized, the python repo, along with the docs, are cloned as well.

Then, in the Hugo configuration file, the `daprdocs/content` and `daprdocs/static` directories are redirected to the `daprdocs/developing-applications/sdks/python` and `static/python` directories, respectively. Thus, all the content within this repo is folded into the main docs site.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
type: docs
title: "Contributing to the Python SDK"
linkTitle: "Python SDK"
weight: 3000
description: Guidelines for contributing to the Dapr Python SDK
---

When contributing to the [Python SDK](https://github.com/dapr/python-sdk) the following rules and best-practices should be followed.

## Examples

The `examples` directory contains code samples for users to run to try out specific functionality of the various Python SDK packages and extensions. When writing new and updated samples keep in mind:

- All examples should be runnable on Windows, Linux, and MacOS. While Python code is consistent among operating systems, any pre/post example commands should provide options through [tabpane]({{% ref "contributing-docs.md#tabbed-content" %}})
- Contain steps to download/install any required pre-requisites. Someone coming in with a fresh OS install should be able to start on the example and complete it without an error. Links to external download pages are fine.

## Docs

The `daprdocs` directory contains the markdown files that are rendered into the [Dapr Docs](https://docs.dapr.io) website. When the documentation website is built this repo is cloned and configured so that its contents are rendered with the docs content. When writing docs keep in mind:

- All rules in the [docs guide]({{% ref contributing-docs.md %}}) should be followed in addition to these.
- All files and directories should be prefixed with `python-` to ensure all file/directory names are globally unique across all Dapr documentation.

## Github Dapr Bot Commands

Checkout the [daprbot documentation](https://docs.dapr.io/contributing/daprbot/) for Github commands you can run in this repo for common tasks. For example, you can run the `/assign` (as a comment on an issue) to assign issues to a user or group of users.
157 changes: 157 additions & 0 deletions sdkdocs/python/content/en/python-sdk-docs/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
---
type: docs
title: "Dapr Python SDK"
linkTitle: "Python"
weight: 1000
description: Python SDK packages for developing Dapr applications
no_list: true
cascade:
github_repo: https://github.com/dapr/python-sdk
github_subdir: daprdocs/content/en/python-sdk-docs
path_base_for_github_subdir: content/en/developing-applications/sdks/python/
github_branch: master
---

Dapr offers a variety of subpackages to help with the development of Python applications. Using them you can create Python clients, servers, and virtual actors with Dapr.

## Prerequisites

- [Dapr CLI]({{% ref install-dapr-cli.md %}}) installed
- Initialized [Dapr environment]({{% ref install-dapr-selfhost.md %}})
- [Python 3.9+](https://www.python.org/downloads/) installed

## Installation

To get started with the Python SDK, install the main Dapr Python SDK package.

{{< tabpane text=true >}}

{{% tab header="Stable" %}}
<!--stable-->
```bash
pip install dapr
```
{{% /tab %}}

{{% tab header="Development" %}}
<!--dev-->
> **Note:** The development package will contain features and behavior that will be compatible with the pre-release version of the Dapr runtime. Make sure to uninstall any stable versions of the Python SDK before installing the dapr-dev package.

```bash
pip install dapr-dev
```

{{% /tab %}}

{{< /tabpane >}}


## Available subpackages

### SDK imports

Python SDK imports are subpackages included with the main SDK install, but need to be imported when used. The most common imports provided by the Dapr Python SDK are:

<div class="card-deck">
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>Client</b></h5>
<p class="card-text">Write Python applications to interact with a Dapr sidecar and other Dapr applications, including stateful virtual actors in Python</p>
<a href="{{% ref python-client %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>Actors</b></h5>
<p class="card-text">Create and interact with Dapr's Actor framework.</p>
<a href="{{% ref python-actor %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>Conversation</b></h5>
<p class="card-text">Use the Dapr Conversation API (Alpha) for LLM interactions, tools, and multi-turn flows.</p>
<a href="{{% ref conversation %}}" class="stretched-link"></a>
</div>
</div>
</div>

Learn more about _all_ of the [available Dapr Python SDK imports](https://github.com/dapr/python-sdk/tree/master/dapr).

### SDK extensions

SDK extensions mainly work as utilities for receiving pub/sub events, programatically creating pub/sub subscriptions, and handling input binding events. While you can acheive all of these tasks without an extension, using a Python SDK extension proves convenient.

<div class="card-deck">
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>gRPC</b></h5>
<p class="card-text">Create Dapr services with the gRPC server extension.</p>
<a href="{{% ref python-grpc %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>FastAPI</b></h5>
<p class="card-text">Integrate with Dapr Python virtual actors and pub/sub using the Dapr FastAPI extension.</p>
<a href="{{% ref python-fastapi %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>Flask</b></h5>
<p class="card-text">Integrate with Dapr Python virtual actors using the Dapr Flask extension.</p>
<a href="{{% ref python-sdk-extensions %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>Workflow</b></h5>
<p class="card-text">Author workflows that work with other Dapr APIs in Python.</p>
<a href="{{% ref python-workflow %}}" class="stretched-link"></a>
</div>
</div>
</div>

Learn more about [the Dapr Python SDK extensions](https://github.com/dapr/python-sdk/tree/master/ext).

## Try it out

Clone the Python SDK repo.

```bash
git clone https://github.com/dapr/python-sdk.git
```

Walk through the Python quickstarts, tutorials, and examples to see Dapr in action:

| SDK samples | Description |
| ----------- | ----------- |
| [Quickstarts]({{% ref quickstarts %}}) | Experience Dapr's API building blocks in just a few minutes using the Python SDK. |
| [SDK samples](https://github.com/dapr/python-sdk/tree/master/examples) | Clone the SDK repo to try out some examples and get started. |
| [Bindings tutorial](https://github.com/dapr/quickstarts/tree/master/tutorials/bindings) | See how Dapr Python SDK works alongside other Dapr SDKs to enable bindings. |
| [Distributed Calculator tutorial](https://github.com/dapr/quickstarts/tree/master/tutorials/distributed-calculator/python) | Use the Dapr Python SDK to handle method invocation and state persistent capabilities. |
| [Hello World tutorial](https://github.com/dapr/quickstarts/tree/master/tutorials/hello-world) | Learn how to get Dapr up and running locally on your machine with the Python SDK. |
| [Hello Kubernetes tutorial](https://github.com/dapr/quickstarts/tree/master/tutorials/hello-kubernetes) | Get up and running with the Dapr Python SDK in a Kubernetes cluster. |
| [Observability tutorial](https://github.com/dapr/quickstarts/tree/master/tutorials/observability) | Explore Dapr's metric collection, tracing, logging and health check capabilities using the Python SDK. |
| [Pub/sub tutorial](https://github.com/dapr/quickstarts/tree/master/tutorials/pub-sub) | See how Dapr Python SDK works alongside other Dapr SDKs to enable pub/sub applications. |


## More information

<div class="card-deck">
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>Serialization</b></h5>
<p class="card-text">Learn more about serialization in Dapr SDKs.</p>
<a href="{{% ref sdk-serialization %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>PyPI</b></h5>
<p class="card-text">Python Package Index</p>
<a href="https://pypi.org/user/dapr.io/" class="stretched-link"></a>
</div>
</div>
</div>
Loading
Loading