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
111 changes: 111 additions & 0 deletions .github/workflows/build-push-to-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: dapr-python-dev

on:
push:
branches:
- main
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel tox
- name: Run Autoformatter
run: |
tox -e ruff
statusResult=$(git status -u --porcelain)
if [ -z $statusResult ]
then
exit 0
else
echo "Source files are not formatted correctly. Run 'tox -e ruff' to autoformat."
exit 1
fi
- name: Run Linter
run: |
tox -e flake8

build:
needs: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python_ver: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python_ver }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_ver }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel tox
- name: Check Typing
run: |
tox -e type
- name: Run unit-tests
run: |
tox -e py`echo "${{ matrix.python_ver }}" | sed 's/\.//g'`
- name: Upload test coverage
uses: codecov/codecov-action@v4
publish:
needs: build
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
env:
TWINE_USERNAME: "__token__"
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine tox
- name: Build and publish Dapr Python SDK
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Build and publish dapr-ext-workflow
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
cd ext/dapr-ext-workflow
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Build and publish Dapr Flask Extension
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
cd ext/flask_dapr
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Build and publish dapr-ext-grpc
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
cd ext/dapr-ext-grpc
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Build and publish dapr-ext-fastapi
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
cd ext/dapr-ext-fastapi
python setup.py sdist bdist_wheel
twine upload dist/*
119 changes: 119 additions & 0 deletions .github/workflows/build-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: dapr-python-release

on:
push:
tags:
- v*
- workflow-v*
- grpc-v*
- flask-v*
- fastapi-v*

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel tox
- name: Run Autoformatter
run: |
tox -e ruff
statusResult=$(git status -u --porcelain)
if [ -z $statusResult ]
then
exit 0
else
echo "Source files are not formatted correctly. Run 'tox -e ruff' to autoformat."
exit 1
fi
- name: Run Linter
run: |
tox -e flake8

build:
needs: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python_ver: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python_ver }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_ver }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel tox
- name: Check Typing
run: |
tox -e type
- name: Run unit-tests
run: |
tox -e py`echo "${{ matrix.python_ver }}" | sed 's/\.//g'`
- name: Upload test coverage
uses: codecov/codecov-action@v4
publish:
needs: build
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
env:
TWINE_USERNAME: "__token__"
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine tox
- name: Build and publish Dapr Python SDK
if: startsWith(github.ref_name, 'v')
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Build and publish dapr-ext-workflow
if: startsWith(github.ref_name, 'workflow-v')
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
cd ext/dapr-ext-workflow
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Build and publish Dapr Flask Extension
if: startsWith(github.ref_name, 'flask-v')
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
cd ext/flask_dapr
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Build and publish dapr-ext-grpc
if: startsWith(github.ref_name, 'grpc-v')
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
cd ext/dapr-ext-grpc
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Build and publish dapr-ext-fastapi
if: startsWith(github.ref_name, 'fastapi-v')
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
cd ext/dapr-ext-fastapi
python setup.py sdist bdist_wheel
twine upload dist/*
66 changes: 2 additions & 64 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@ name: dapr-python
on:
push:
branches:
- main
- feature/*
tags:
- v*
- workflow-v*
- grpc-v*
- flask-v*
- fastapi-v*
pull_request:
branches:
- main
Expand Down Expand Up @@ -53,7 +46,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python_ver: [3.8, 3.9, "3.10", "3.11", "3.12"]
python_ver: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python_ver }}
Expand All @@ -71,59 +64,4 @@ jobs:
run: |
tox -e py`echo "${{ matrix.python_ver }}" | sed 's/\.//g'`
- name: Upload test coverage
uses: codecov/codecov-action@v4
publish:
needs: build
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
env:
TWINE_USERNAME: "__token__"
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine tox
- name: Build and publish Dapr Python SDK
if: startsWith(github.ref_name, 'v')
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Build and publish dapr-ext-workflow
if: startsWith(github.ref_name, 'workflow-v')
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
cd ext/dapr-ext-workflow
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Build and publish Dapr Flask Extension
if: startsWith(github.ref_name, 'flask-v')
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
cd ext/flask_dapr
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Build and publish dapr-ext-grpc
if: startsWith(github.ref_name, 'grpc-v')
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
cd ext/dapr-ext-grpc
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Build and publish dapr-ext-fastapi
if: startsWith(github.ref_name, 'fastapi-v')
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
cd ext/dapr-ext-fastapi
python setup.py sdist bdist_wheel
twine upload dist/*
uses: codecov/codecov-action@v4
12 changes: 7 additions & 5 deletions dapr/aio/clients/grpc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def __init__(
UnaryStreamClientInterceptor or
StreamUnaryClientInterceptor or
StreamStreamClientInterceptor, optional): gRPC interceptors.
max_grpc_messsage_length (int, optional): The maximum grpc send and receive
max_grpc_message_length (int, optional): The maximum grpc send and receive
message length in bytes.
"""
DaprHealth.wait_until_ready()
Expand Down Expand Up @@ -198,7 +198,8 @@ def __init__(

self._stub = api_service_v1.DaprStub(self._channel)

def get_credentials(self):
@staticmethod
def get_credentials():
return grpc.ssl_channel_credentials()

async def close(self):
Expand All @@ -212,8 +213,9 @@ async def __aenter__(self) -> Self: # type: ignore
async def __aexit__(self, exc_type, exc_value, traceback) -> None:
await self.close()

@staticmethod
def _get_http_extension(
self, http_verb: str, http_querystring: Optional[MetadataTuple] = None
http_verb: str, http_querystring: Optional[MetadataTuple] = None
) -> common_v1.HTTPExtension: # type: ignore
verb = common_v1.HTTPExtension.Verb.Value(http_verb) # type: ignore
http_ext = common_v1.HTTPExtension(verb=verb)
Expand Down Expand Up @@ -554,7 +556,7 @@ async def get_bulk_state(

Args:
store_name (str): the state store name to get from
key (Sequence[str]): the keys to be retrieved
keys (Sequence[str]): the keys to be retrieved
parallelism (int): number of items to be retrieved in parallel
states_metadata (Dict[str, str], optional): Dapr metadata for state request
metadata (tuple, optional, DEPRECATED): gRPC custom metadata
Expand Down Expand Up @@ -1083,7 +1085,7 @@ async def get_configuration(
store_name=store_name, keys=keys, metadata=config_metadata
)
call = self._stub.GetConfiguration(req)
response = await call
response: api_v1.GetConfigurationResponse = await call
return ConfigurationResponse(items=response.items, headers=await call.initial_metadata())

async def subscribe_configuration(
Expand Down
Loading