Skip to content

Commit dbaa95e

Browse files
authored
Fix tox (#925)
* Fix tox Signed-off-by: Albert Callarisa <albert@diagrid.io> * Remove validation steps that install dapr Signed-off-by: Albert Callarisa <albert@diagrid.io> * Fix ext dependencies on dapr to point to dev if necessary Signed-off-by: Albert Callarisa <albert@diagrid.io> * lint Signed-off-by: Albert Callarisa <albert@diagrid.io> * Revert w3c example Signed-off-by: Albert Callarisa <albert@diagrid.io> --------- Signed-off-by: Albert Callarisa <albert@diagrid.io>
1 parent 4e0e38c commit dbaa95e

8 files changed

Lines changed: 117 additions & 37 deletions

File tree

examples/invoke-http/README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ This example utilizes a receiver and a caller for the `invoke_method` functional
1212
### Install requirements
1313

1414
You can install dapr SDK package using pip command:
15+
```sh
16+
pip3 install dapr
17+
```
1518

16-
<!-- STEP
19+
<!-- STEP
1720
name: Install requirements
1821
-->
1922

23+
Also install Flask package:
2024
```sh
21-
pip3 install dapr Flask
25+
pip3 install Flask
2226
```
2327

2428
<!-- END_STEP -->
@@ -55,7 +59,7 @@ expected_stdout_lines:
5559
- '== APP == 503'
5660
- '== APP == Internal Server Error'
5761
background: true
58-
sleep: 5
62+
sleep: 5
5963
-->
6064

6165
```bash
@@ -66,7 +70,7 @@ dapr run --app-id=invoke-caller -- python3 invoke-caller.py
6670
## Cleanup
6771

6872
<!-- STEP
69-
expected_stdout_lines:
73+
expected_stdout_lines:
7074
- '✅ app stopped successfully: invoke-receiver'
7175
name: Shutdown dapr
7276
-->
@@ -75,4 +79,4 @@ name: Shutdown dapr
7579
dapr stop --app-id invoke-receiver
7680
```
7781

78-
<!-- END_STEP -->
82+
<!-- END_STEP -->

ext/dapr-ext-fastapi/setup.py

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

16+
import configparser
1617
import os
1718

1819
from setuptools import setup
@@ -47,11 +48,22 @@ def is_release():
4748
# Get build number from GITHUB_RUN_NUMBER environment variable
4849
build_number = os.environ.get('GITHUB_RUN_NUMBER', '0')
4950

51+
cfg = configparser.ConfigParser()
52+
cfg.read('setup.cfg')
53+
install_requires = [
54+
r.strip()
55+
for r in cfg.get('options', 'install_requires', fallback='').strip().splitlines()
56+
if r.strip()
57+
]
58+
5059
if not is_release():
5160
name += '-dev'
5261
version = f'{__version__}{build_number}'
5362
description = 'The developmental release for Dapr FastAPI extension.'
5463
long_description = 'This is the developmental release for Dapr FastAPI extension.'
64+
install_requires = [
65+
'dapr-dev' + r[4:] if r.startswith('dapr ') else r for r in install_requires
66+
]
5567

5668
print(f'package name: {name}, version: {version}', flush=True)
5769

@@ -61,4 +73,5 @@ def is_release():
6173
version=version,
6274
description=description,
6375
long_description=long_description,
76+
install_requires=install_requires,
6477
)

ext/dapr-ext-grpc/setup.py

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

16+
import configparser
1617
import os
1718

1819
from setuptools import setup
@@ -47,11 +48,22 @@ def is_release():
4748
# Get build number from GITHUB_RUN_NUMBER environment variable
4849
build_number = os.environ.get('GITHUB_RUN_NUMBER', '0')
4950

51+
cfg = configparser.ConfigParser()
52+
cfg.read('setup.cfg')
53+
install_requires = [
54+
r.strip()
55+
for r in cfg.get('options', 'install_requires', fallback='').strip().splitlines()
56+
if r.strip()
57+
]
58+
5059
if not is_release():
5160
name += '-dev'
5261
version = f'{__version__}{build_number}'
5362
description = 'The developmental release for Dapr gRPC AppCallback.'
5463
long_description = 'This is the developmental release for Dapr gRPC AppCallback.'
64+
install_requires = [
65+
'dapr-dev' + r[4:] if r.startswith('dapr ') else r for r in install_requires
66+
]
5567

5668
print(f'package name: {name}, version: {version}', flush=True)
5769

@@ -61,4 +73,5 @@ def is_release():
6173
version=version,
6274
description=description,
6375
long_description=long_description,
76+
install_requires=install_requires,
6477
)

ext/dapr-ext-langgraph/setup.py

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

16+
import configparser
1617
import os
1718

1819
from setuptools import setup
@@ -47,13 +48,24 @@ def is_release():
4748
# Get build number from GITHUB_RUN_NUMBER environment variable
4849
build_number = os.environ.get('GITHUB_RUN_NUMBER', '0')
4950

51+
cfg = configparser.ConfigParser()
52+
cfg.read('setup.cfg')
53+
install_requires = [
54+
r.strip()
55+
for r in cfg.get('options', 'install_requires', fallback='').strip().splitlines()
56+
if r.strip()
57+
]
58+
5059
if not is_release():
5160
name += '-dev'
5261
version = f'{__version__}{build_number}'
5362
description = 'The developmental release for the Dapr Checkpointer extension for LangGraph'
5463
long_description = (
5564
'This is the developmental release for the Dapr Checkpointer extension for LangGraph'
5665
)
66+
install_requires = [
67+
'dapr-dev' + r[4:] if r.startswith('dapr ') else r for r in install_requires
68+
]
5769

5870
print(f'package name: {name}, version: {version}', flush=True)
5971

@@ -63,4 +75,5 @@ def is_release():
6375
version=version,
6476
description=description,
6577
long_description=long_description,
78+
install_requires=install_requires,
6679
)

ext/dapr-ext-strands/setup.py

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

16+
import configparser
1617
import os
1718

1819
from setuptools import setup
@@ -47,13 +48,24 @@ def is_release():
4748
# Get build number from GITHUB_RUN_NUMBER environment variable
4849
build_number = os.environ.get('GITHUB_RUN_NUMBER', '0')
4950

51+
cfg = configparser.ConfigParser()
52+
cfg.read('setup.cfg')
53+
install_requires = [
54+
r.strip()
55+
for r in cfg.get('options', 'install_requires', fallback='').strip().splitlines()
56+
if r.strip()
57+
]
58+
5059
if not is_release():
5160
name += '-dev'
5261
version = f'{__version__}{build_number}'
5362
description = (
5463
'The developmental release for the Dapr Session Manager extension for Strands Agents'
5564
)
5665
long_description = 'This is the developmental release for the Dapr Session Manager extension for Strands Agents'
66+
install_requires = [
67+
'dapr-dev' + r[4:] if r.startswith('dapr ') else r for r in install_requires
68+
]
5769

5870
print(f'package name: {name}, version: {version}', flush=True)
5971

@@ -63,4 +75,5 @@ def is_release():
6375
version=version,
6476
description=description,
6577
long_description=long_description,
78+
install_requires=install_requires,
6679
)

ext/dapr-ext-workflow/setup.py

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

16+
import configparser
1617
import os
1718

1819
from setuptools import setup
@@ -47,11 +48,22 @@ def is_release():
4748
# Get build number from GITHUB_RUN_NUMBER environment variable
4849
build_number = os.environ.get('GITHUB_RUN_NUMBER', '0')
4950

51+
cfg = configparser.ConfigParser()
52+
cfg.read('setup.cfg')
53+
install_requires = [
54+
r.strip()
55+
for r in cfg.get('options', 'install_requires', fallback='').strip().splitlines()
56+
if r.strip()
57+
]
58+
5059
if not is_release():
5160
name += '-dev'
5261
version = f'{__version__}{build_number}'
5362
description = 'The developmental release for Dapr Workflow Authoring.'
5463
long_description = 'This is the developmental release for Dapr Workflow Authoring.'
64+
install_requires = [
65+
'dapr-dev' + r[4:] if r.startswith('dapr ') else r for r in install_requires
66+
]
5567

5668
print(f'package name: {name}, version: {version}', flush=True)
5769

@@ -61,4 +73,5 @@ def is_release():
6173
version=version,
6274
description=description,
6375
long_description=long_description,
76+
install_requires=install_requires,
6477
)

ext/flask_dapr/setup.py

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

16+
import configparser
1617
import os
1718

1819
from setuptools import setup
@@ -47,11 +48,22 @@ def is_release():
4748
# Get build number from GITHUB_RUN_NUMBER environment variable
4849
build_number = os.environ.get('GITHUB_RUN_NUMBER', '0')
4950

51+
cfg = configparser.ConfigParser()
52+
cfg.read('setup.cfg')
53+
install_requires = [
54+
r.strip()
55+
for r in cfg.get('options', 'install_requires', fallback='').strip().splitlines()
56+
if r.strip()
57+
]
58+
5059
if not is_release():
5160
name += '-dev'
5261
version = f'{__version__}{build_number}'
5362
description = 'The developmental release for Dapr Python SDK Flask.'
5463
long_description = 'This is the developmental release for Dapr Python SDK Flask.'
64+
install_requires = [
65+
'dapr-dev' + r[4:] if r.startswith('dapr ') else r for r in install_requires
66+
]
5567

5668
print(f'package name: {name}, version: {version}', flush=True)
5769

@@ -61,4 +73,5 @@ def is_release():
6173
version=version,
6274
description=description,
6375
long_description=long_description,
76+
install_requires=install_requires,
6477
)

tox.ini

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@ envlist =
99
[testenv]
1010
setenv =
1111
PYTHONDONTWRITEBYTECODE=1
12-
deps =
13-
-rdev-requirements.txt
14-
-e {toxinidir}/ext/dapr-ext-workflow/
15-
-e {toxinidir}/ext/dapr-ext-grpc/
16-
-e {toxinidir}/ext/dapr-ext-fastapi/
17-
-e {toxinidir}/ext/dapr-ext-langgraph/
18-
-e {toxinidir}/ext/dapr-ext-strands/
19-
-e {toxinidir}/ext/flask_dapr/
20-
-e {toxinidir}/
2112
commands =
2213
coverage run -m unittest discover -v ./tests
2314
coverage run -a -m unittest discover -v ./ext/dapr-ext-workflow/tests
@@ -30,6 +21,14 @@ commands =
3021

3122
commands_pre =
3223
pip uninstall -y dapr dapr-ext-grpc dapr-ext-fastapi dapr-ext-langgraph dapr-ext-strands dapr-ext-flask dapr-ext-langgraph dapr-ext-strands
24+
pip install -r dev-requirements.txt \
25+
-e {toxinidir}/ \
26+
-e {toxinidir}/ext/dapr-ext-workflow/ \
27+
-e {toxinidir}/ext/dapr-ext-grpc/ \
28+
-e {toxinidir}/ext/dapr-ext-fastapi/ \
29+
-e {toxinidir}/ext/dapr-ext-langgraph/ \
30+
-e {toxinidir}/ext/dapr-ext-strands/ \
31+
-e {toxinidir}/ext/flask_dapr/
3332

3433
[testenv:ruff]
3534
basepython = python3
@@ -44,13 +43,6 @@ basepython = python3
4443
changedir = ./examples/
4544
deps =
4645
mechanical-markdown
47-
-e {toxinidir}/ext/dapr-ext-workflow/
48-
-e {toxinidir}/ext/dapr-ext-grpc/
49-
-e {toxinidir}/ext/dapr-ext-fastapi/
50-
-e {toxinidir}/ext/dapr-ext-langgraph/
51-
-e {toxinidir}/ext/dapr-ext-strands/
52-
-e {toxinidir}/ext/flask_dapr/
53-
-e {toxinidir}/
5446

5547
commands =
5648
./validate.sh conversation
@@ -80,6 +72,13 @@ allowlist_externals=*
8072

8173
commands_pre =
8274
pip uninstall -y dapr dapr-ext-grpc dapr-ext-fastapi dapr-ext-langgraph dapr-ext-strands dapr-ext-flask dapr-ext-langgraph dapr-ext-strands
75+
pip install -e {toxinidir}/ \
76+
-e {toxinidir}/ext/dapr-ext-workflow/ \
77+
-e {toxinidir}/ext/dapr-ext-grpc/ \
78+
-e {toxinidir}/ext/dapr-ext-fastapi/ \
79+
-e {toxinidir}/ext/dapr-ext-langgraph/ \
80+
-e {toxinidir}/ext/dapr-ext-strands/ \
81+
-e {toxinidir}/ext/flask_dapr/
8382

8483
[testenv:example-component]
8584
; This environment is used to validate a specific example component.
@@ -90,37 +89,36 @@ basepython = python3
9089
changedir = ./examples/
9190
deps =
9291
mechanical-markdown
93-
-e {toxinidir}/ext/dapr-ext-workflow/
94-
-e {toxinidir}/ext/dapr-ext-grpc/
95-
-e {toxinidir}/ext/dapr-ext-fastapi/
96-
-e {toxinidir}/ext/dapr-ext-langgraph/
97-
-e {toxinidir}/ext/dapr-ext-strands/
98-
-e {toxinidir}/ext/flask_dapr/
99-
-e {toxinidir}/
10092
commands =
10193
./validate.sh {posargs}
10294

10395
allowlist_externals=*
10496

10597
commands_pre =
10698
pip uninstall -y dapr dapr-ext-grpc dapr-ext-fastapi dapr-ext-langgraph dapr-ext-strands dapr-ext-flask dapr-ext-langgraph dapr-ext-strands
99+
pip install -e {toxinidir}/ \
100+
-e {toxinidir}/ext/dapr-ext-workflow/ \
101+
-e {toxinidir}/ext/dapr-ext-grpc/ \
102+
-e {toxinidir}/ext/dapr-ext-fastapi/ \
103+
-e {toxinidir}/ext/dapr-ext-langgraph/ \
104+
-e {toxinidir}/ext/dapr-ext-strands/ \
105+
-e {toxinidir}/ext/flask_dapr/
107106

108107
[testenv:type]
109108
basepython = python3
110109
usedevelop = False
111-
deps =
112-
-rdev-requirements.txt
113-
-e {toxinidir}/ext/dapr-ext-workflow/
114-
-e {toxinidir}/ext/dapr-ext-grpc/
115-
-e {toxinidir}/ext/dapr-ext-fastapi/
116-
-e {toxinidir}/ext/dapr-ext-langgraph/
117-
-e {toxinidir}/ext/dapr-ext-strands/
118-
-e {toxinidir}/ext/flask_dapr/
119-
-e {toxinidir}/
120110
commands =
121111
mypy --config-file mypy.ini
122112
commands_pre =
123113
pip uninstall -y dapr dapr-ext-grpc dapr-ext-fastapi dapr-ext-langgraph dapr-ext-strands dapr-ext-flask dapr-ext-langgraph dapr-ext-strands
114+
pip install -r dev-requirements.txt \
115+
-e {toxinidir}/ \
116+
-e {toxinidir}/ext/dapr-ext-workflow/ \
117+
-e {toxinidir}/ext/dapr-ext-grpc/ \
118+
-e {toxinidir}/ext/dapr-ext-fastapi/ \
119+
-e {toxinidir}/ext/dapr-ext-langgraph/ \
120+
-e {toxinidir}/ext/dapr-ext-strands/ \
121+
-e {toxinidir}/ext/flask_dapr/
124122

125123
[testenv:doc]
126124
basepython = python3

0 commit comments

Comments
 (0)