Skip to content

Commit deece29

Browse files
committed
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]>
1 parent f959cd5 commit deece29

File tree

8 files changed

+29
-62
lines changed

8 files changed

+29
-62
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-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

dev-requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
mypy>=1.2.0
22
mypy-extensions>=0.4.3
33
mypy-protobuf>=2.9
4-
flake8>=3.7.9
54
tox>=4.3.0
65
coverage>=5.3
76
wheel
@@ -13,7 +12,7 @@ pyOpenSSL>=23.2.0
1312
# needed for type checking
1413
Flask>=1.1
1514
# needed for auto fix
16-
ruff===0.2.2
15+
ruff===0.14.1
1716
# needed for dapr-ext-workflow
1817
durabletask-dapr >= 0.2.0a7
1918
# needed for .env file loading in examples

pyproject.toml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
[tool.ruff]
2-
target-version = "py38"
2+
target-version = "py310"
33
line-length = 100
44
fix = true
55
extend-exclude = [".github", "dapr/proto"]
6+
67
[tool.ruff.lint]
78
select = [
8-
"E", # pycodestyle errors
9+
"I", # isort
910
"W", # pycodestyle warnings
1011
"F", # pyflakes
11-
"I", # isort
12-
"C", # flake8-comprehensions
13-
"B", # flake8-bugbear
14-
"UP", # pyupgrade
15-
]
16-
ignore = [
17-
# Undefined name {name}
18-
"F821",
12+
"E", # pycodestyle errors
13+
14+
# TODO: Add those back progressively as we fix the issues
15+
# "C", # flake8-comprehensions
16+
# "B", # flake8-bugbear
17+
# "UP", # pyupgrade
1918
]
19+
20+
# TODO: Add those back progressively as we fix the issues
21+
ignore = ["E501","E203", "E712", "E722", "E713"]
22+
2023
[tool.ruff.format]
2124
quote-style = 'single'

setup.cfg

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,3 @@ dapr.proto =
5252
py.typed
5353
dapr.serializers =
5454
py.typed
55-
56-
[flake8]
57-
exclude =
58-
.venv,
59-
venv,
60-
.env,
61-
build,
62-
dist,
63-
.git,
64-
.tox,
65-
dapr/proto,
66-
examples
67-
ignore = F821, E501, W503, E203
68-
max-line-length = 100

tox.ini

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ skipsdist = True
33
minversion = 3.9.0
44
envlist =
55
py{39,310,311,312,313}
6-
flake8,
76
ruff,
87
mypy,
98

@@ -25,18 +24,11 @@ commands_pre =
2524
pip3 install -e {toxinidir}/ext/dapr-ext-fastapi/
2625
pip3 install -e {toxinidir}/ext/flask_dapr/
2726

28-
[testenv:flake8]
29-
basepython = python3
30-
usedevelop = False
31-
deps = flake8
32-
commands =
33-
flake8 .
34-
3527
[testenv:ruff]
3628
basepython = python3
3729
usedevelop = False
38-
deps = ruff==0.2.2
3930
commands =
31+
ruff check --fix
4032
ruff format
4133

4234
[testenv:examples]

0 commit comments

Comments
 (0)