Skip to content

Commit c44c28d

Browse files
authored
Lint update (#854)
* Linting and tooling updates - Update ruff and set it to fix imports - Remove flake8 and replace it with ruff Signed-off-by: Albert Callarisa <[email protected]> * run `tox -e ruff` Signed-off-by: Albert Callarisa <[email protected]> --------- Signed-off-by: Albert Callarisa <[email protected]>
1 parent 331f580 commit c44c28d

File tree

157 files changed

+651
-738
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+651
-738
lines changed

.devcontainer/devcontainer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"terminal.integrated.shell.linux": "/bin/bash",
1010
"python.pythonPath": "/usr/local/bin/python",
1111
"python.linting.enabled": true,
12-
"python.linting.flake8Enabled": true,
1312
"python.linting.mypyEnabled": true,
1413
},
1514

.github/workflows/build-push-to-main.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ jobs:
3030
echo "Source files are not formatted correctly. Run 'tox -e ruff' to autoformat."
3131
exit 1
3232
fi
33-
- name: Run Linter
34-
run: |
35-
tox -e flake8
3633
3734
build:
3835
needs: lint

.github/workflows/build-tag.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ jobs:
3434
echo "Source files are not formatted correctly. Run 'tox -e ruff' to autoformat."
3535
exit 1
3636
fi
37-
- name: Run Linter
38-
run: |
39-
tox -e flake8
4037
4138
build:
4239
needs: lint

.github/workflows/build.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ jobs:
3636
echo "Source files are not formatted correctly. Run 'tox -e ruff' to autoformat."
3737
exit 1
3838
fi
39-
- name: Run Linter
40-
run: |
41-
tox -e flake8
4239
4340
build:
4441
needs: lint
@@ -64,4 +61,4 @@ jobs:
6461
run: |
6562
tox -e py`echo "${{ matrix.python_ver }}" | sed 's/\.//g'`
6663
- name: Upload test coverage
67-
uses: codecov/codecov-action@v5
64+
uses: codecov/codecov-action@v5

README.md

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Dapr SDK for Python
22

3-
[![PyPI - Version](https://img.shields.io/pypi/v/dapr?style=flat&logo=pypi&logoColor=white&label=Latest%20version)](https://pypi.org/project/dapr/)
4-
[![PyPI - Downloads](https://img.shields.io/pypi/dm/dapr?style=flat&logo=pypi&logoColor=white&label=Downloads)](https://pypi.org/project/dapr/)
5-
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/dapr/python-sdk/.github%2Fworkflows%2Fbuild.yaml?branch=main&label=Build&logo=github)](https://github.com/dapr/python-sdk/actions/workflows/build.yaml)
6-
[![codecov](https://codecov.io/gh/dapr/python-sdk/branch/main/graph/badge.svg)](https://codecov.io/gh/dapr/python-sdk)
7-
[![GitHub License](https://img.shields.io/github/license/dapr/python-sdk?style=flat&label=License&logo=github)](https://github.com/dapr/python-sdk/blob/main/LICENSE)
8-
[![GitHub issue custom search in repo](https://img.shields.io/github/issues-search/dapr/python-sdk?query=type%3Aissue%20is%3Aopen%20label%3A%22good%20first%20issue%22&label=Good%20first%20issues&style=flat&logo=github)](https://github.com/dapr/python-sdk/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
9-
[![Discord](https://img.shields.io/discord/778680217417809931?label=Discord&style=flat&logo=discord)](http://bit.ly/dapr-discord)
10-
[![YouTube Channel Views](https://img.shields.io/youtube/channel/views/UCtpSQ9BLB_3EXdWAUQYwnRA?style=flat&label=YouTube%20views&logo=youtube)](https://youtube.com/@daprdev)
3+
[![PyPI - Version](https://img.shields.io/pypi/v/dapr?style=flat&logo=pypi&logoColor=white&label=Latest%20version)](https://pypi.org/project/dapr/)
4+
[![PyPI - Downloads](https://img.shields.io/pypi/dm/dapr?style=flat&logo=pypi&logoColor=white&label=Downloads)](https://pypi.org/project/dapr/)
5+
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/dapr/python-sdk/.github%2Fworkflows%2Fbuild.yaml?branch=main&label=Build&logo=github)](https://github.com/dapr/python-sdk/actions/workflows/build.yaml)
6+
[![codecov](https://codecov.io/gh/dapr/python-sdk/branch/main/graph/badge.svg)](https://codecov.io/gh/dapr/python-sdk)
7+
[![GitHub License](https://img.shields.io/github/license/dapr/python-sdk?style=flat&label=License&logo=github)](https://github.com/dapr/python-sdk/blob/main/LICENSE)
8+
[![GitHub issue custom search in repo](https://img.shields.io/github/issues-search/dapr/python-sdk?query=type%3Aissue%20is%3Aopen%20label%3A%22good%20first%20issue%22&label=Good%20first%20issues&style=flat&logo=github)](https://github.com/dapr/python-sdk/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
9+
[![Discord](https://img.shields.io/discord/778680217417809931?label=Discord&style=flat&logo=discord)](http://bit.ly/dapr-discord)
10+
[![YouTube Channel Views](https://img.shields.io/youtube/channel/views/UCtpSQ9BLB_3EXdWAUQYwnRA?style=flat&label=YouTube%20views&logo=youtube)](https://youtube.com/@daprdev)
1111
<!-- IGNORE_LINKS -->
1212
[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/daprdev?logo=x&style=flat)](https://twitter.com/daprdev)
1313
<!-- END_IGNORE -->
@@ -94,31 +94,25 @@ pip3 install -e ./ext/dapr-ext-workflow/
9494
pip3 install -r dev-requirements.txt
9595
```
9696

97-
4. Run linter
98-
99-
```bash
100-
tox -e flake8
101-
```
102-
103-
5. Run autofix
97+
4. Run linter and autofix
10498

10599
```bash
106100
tox -e ruff
107101
```
108102

109-
6. Run unit-test
103+
5. Run unit-test
110104

111105
```bash
112106
tox -e py311
113107
```
114108

115-
7. Run type check
109+
6. Run type check
116110

117111
```bash
118112
tox -e type
119113
```
120114

121-
8. Run examples
115+
7. Run examples
122116

123117
```bash
124118
tox -e examples
@@ -153,7 +147,7 @@ export DAPR_BRANCH=release-1.16 # Optional, defaults to master
153147
./tools/regen_grpcclient.sh
154148
```
155149

156-
> Note: The `grpcio-tools` version we're using doesn't support Python 3.13.
150+
> Note: The `grpcio-tools` version we're using doesn't support Python 3.13.
157151
158152
## Help & Feedback
159153

dapr/actor/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from dapr.actor.runtime.remindable import Remindable
2121
from dapr.actor.runtime.runtime import ActorRuntime
2222

23-
2423
__all__ = [
2524
'ActorInterface',
2625
'ActorProxy',

dapr/actor/client/proxy.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
from dapr.actor.runtime._type_utils import get_dispatchable_attrs_from_interface
2222
from dapr.clients import DaprActorClientBase, DaprActorHttpClient
2323
from dapr.clients.retry import RetryPolicy
24-
from dapr.serializers import Serializer, DefaultJSONSerializer
2524
from dapr.conf import settings
25+
from dapr.serializers import DefaultJSONSerializer, Serializer
2626

2727
# Actor factory Callable type hint.
2828
ACTOR_FACTORY_CALLBACK = Callable[[ActorInterface, str, str], 'ActorProxy']
@@ -35,8 +35,7 @@ def create(
3535
actor_type: str,
3636
actor_id: ActorId,
3737
actor_interface: Optional[Type[ActorInterface]] = None,
38-
) -> 'ActorProxy':
39-
...
38+
) -> 'ActorProxy': ...
4039

4140

4241
class ActorProxyFactory(ActorFactoryBase):

dapr/actor/runtime/_reminder_data.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"""
1515

1616
import base64
17-
1817
from datetime import timedelta
1918
from typing import Any, Dict, Optional
2019

dapr/actor/runtime/_state_provider.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414
"""
1515

1616
import io
17+
from typing import Any, List, Tuple, Type
1718

18-
from typing import Any, List, Type, Tuple
19-
from dapr.actor.runtime.state_change import StateChangeKind, ActorStateChange
19+
from dapr.actor.runtime.state_change import ActorStateChange, StateChangeKind
2020
from dapr.clients.base import DaprActorClientBase
21-
from dapr.serializers import Serializer, DefaultJSONSerializer
22-
21+
from dapr.serializers import DefaultJSONSerializer, Serializer
2322

2423
# Mapping StateChangeKind to Dapr State Operation
2524
_MAP_CHANGE_KIND_TO_OPERATION = {

dapr/actor/runtime/_type_information.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
limitations under the License.
1414
"""
1515

16-
from dapr.actor.runtime.remindable import Remindable
17-
from dapr.actor.runtime._type_utils import is_dapr_actor, get_actor_interfaces
16+
from typing import TYPE_CHECKING, List, Type
1817

19-
from typing import List, Type, TYPE_CHECKING
18+
from dapr.actor.runtime._type_utils import get_actor_interfaces, is_dapr_actor
19+
from dapr.actor.runtime.remindable import Remindable
2020

2121
if TYPE_CHECKING:
2222
from dapr.actor.actor_interface import ActorInterface # noqa: F401

0 commit comments

Comments
 (0)