Skip to content

Commit d6aeff4

Browse files
committed
Add automated linting of dependencies and clean up
1 parent 34a6119 commit d6aeff4

File tree

8 files changed

+160
-129
lines changed

8 files changed

+160
-129
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ lint: ## Run code linter to check code style, check if formatte
123123
$(VENV_RUN); pre-commit run check-pinned-deps-for-needed-upgrade --files pyproject.toml # run pre-commit hook manually here to ensure that this check runs in CI as well
124124
$(VENV_RUN); openapi-spec-validator localstack-core/localstack/openapi.yaml
125125
$(VENV_RUN); cd localstack-core && mypy --install-types --non-interactive
126+
$(VENV_RUN); deptry .
126127

127128
lint-modified: ## Run code linter to check code style, check if formatter would make changes on modified files, and check if dependency pins need to be updated because of modified files
128129
($(VENV_RUN); python -m ruff check --output-format=full `git diff --diff-filter=d --name-only HEAD | grep '\.py$$' | xargs` && python -m ruff format --check `git diff --diff-filter=d --name-only HEAD | grep '\.py$$' | xargs`)

pyproject.toml

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ description = "The core library and runtime of LocalStack"
1212
license = "Apache-2.0"
1313
requires-python = ">=3.10"
1414
dependencies = [
15-
"build",
1615
"click>=7.1",
1716
"cachetools>=5.0",
1817
"cryptography",
@@ -26,7 +25,6 @@ dependencies = [
2625
"rich>=12.3.0",
2726
"requests>=2.20.0",
2827
"semver>=2.10",
29-
"tailer>=0.4.1",
3028
]
3129
dynamic = ["version"]
3230
classifiers = [
@@ -56,17 +54,22 @@ base-runtime = [
5654
"boto3==1.40.51",
5755
# pinned / updated by ASF update action
5856
"botocore==1.40.51",
57+
# transitive dependency of botocore, added to avoid specific version
5958
"awscrt>=0.13.14,!=0.27.1",
6059
"cbor2>=5.5.0",
6160
"dnspython>=1.16.0",
6261
"docker>=6.1.1",
6362
"jsonpatch>=1.24",
63+
"jsonpointer>=3.0.0",
64+
"jsonschema>=4.25.1",
6465
"hypercorn>=0.14.4",
6566
"localstack-twisted>=23.0",
6667
"openapi-core>=0.19.2",
6768
"pyopenssl>=23.0.0",
69+
"python-dateutil>=2.9.0",
6870
"readerwriterlock>=1.0.7",
6971
"requests-aws4auth>=1.0",
72+
"typing-extensions>=4.15.0",
7073
# explicitly set urllib3 to force its usage / ensure compatibility
7174
"urllib3>=2.0.7",
7275
"Werkzeug>=3.1.3",
@@ -80,32 +83,34 @@ runtime = [
8083
# pinned / updated by ASF update action
8184
"awscli==1.42.51",
8285
"airspeed-ext>=0.6.3",
83-
# version that has a built wheel
84-
"kclpy-ext>=3.0.0",
8586
# antlr4-python3-runtime: exact pin because antlr4 runtime is tightly coupled to the generated parser code
8687
"antlr4-python3-runtime==4.13.2",
8788
"apispec>=5.1.1",
8889
"aws-sam-translator>=1.15.1",
8990
"crontab>=0.22.6",
9091
"cryptography>=41.0.5",
92+
"jinja2>=3.1.6",
9193
# allow Python programs full access to Java class libraries. Used for stepfunctions jsonata support
9294
"jpype1>=1.6.0",
93-
"json5>=0.9.11",
9495
"jsonpath-ng>=1.6.1",
9596
"jsonpath-rw>=1.4.0",
97+
# version that has a built wheel
98+
"kclpy-ext>=3.0.0",
9699
"moto-ext[all]>=5.1.12.post22",
97100
"opensearch-py>=2.4.1",
101+
"pydantic>=2.11.9",
98102
"pymongo>=4.2.0",
99103
"pyopenssl>=23.0.0",
104+
"responses>=0.25.8",
100105
]
101106

102107
# for running tests and coverage analysis
103108
test = [
104109
# runtime dependencies are required for running the tests
105110
"localstack-core[runtime]",
106111
"coverage[toml]>=5.5",
107-
"deepdiff>=6.4.1",
108112
"httpx[http2]>=0.25",
113+
"json5>=0.12.1",
109114
"pluggy>=1.3.0",
110115
"pytest>=7.4.2",
111116
"pytest-split>=0.8.0",
@@ -122,6 +127,7 @@ dev = [
122127
# test dependencies are required for developing localstack
123128
"localstack-core[test]",
124129
"coveralls>=3.3.1",
130+
"deptry>=0.13.0",
125131
"Cython",
126132
"networkx>=2.8.4",
127133
"openapi-spec-validator>=0.7.1",
@@ -202,6 +208,34 @@ exclude = [
202208
"localstack-core/localstack/utils/**" = "py310" # imported by CLI tests
203209
"localstack-core/localstack/testing/pytest/**" = "py310" # imported by CLI tests
204210

211+
[tool.deptry]
212+
known_first_party = [
213+
"vosk", # managed by localstack package manager
214+
"debugpy", # managed by localstack package manager
215+
]
216+
extend_exclude = [
217+
"scripts/**", # dependencies not handled by pyproject.toml
218+
"localstack-core/localstack/testing/**", # utilities for testing
219+
"localstack-core/localstack/aws/mocking.py", # not used at runtime
220+
"localstack-core/localstack/aws/scaffold.py", # not used at runtime
221+
"localstack-core/localstack/dev/**", # internal dev tooling
222+
"localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/**" # generated code
223+
]
224+
pep621_dev_dependency_groups = ["dev", "typehint", "test"]
225+
226+
[tool.deptry.package_module_name_map]
227+
"localstack-core" = ["localstack"]
228+
229+
[tool.deptry.per_rule_ignores]
230+
DEP001 = [
231+
"com", # This appears in jpype code and imports actual java packages like com.fasterxml.jackson.databind
232+
"stevedore", # used for CLI plugin debugging - TODO move this debugging CLI into plux
233+
]
234+
DEP002 = [
235+
"awscli", # necessary for python init scripts - TODO deprecate python init scripts and remove this
236+
"awscrt", # defined to ignore a specific version - TODO evaluate and clean up
237+
]
238+
205239
[tool.ruff.lint]
206240
ignore = [
207241
"B007", # TODO Loop control variable x not used within loop body
@@ -219,8 +253,8 @@ ignore = [
219253
]
220254
select = ["B", "C", "E", "F", "I", "W", "T", "B9", "G", "UP"]
221255
extend-safe-fixes = [
222-
"UP006", # unsafe-fix for py39
223-
"UP035", # unsafe-fix for py39
256+
"UP006", # unsafe-fix for py39
257+
"UP035", # unsafe-fix for py39
224258
]
225259

226260
# The rules below fill fix the code in a way that leaves multiple unused imports.

requirements-base-runtime.txt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ attrs==25.4.0
99
# jsonschema
1010
# localstack-twisted
1111
# referencing
12-
awscrt==0.28.1
12+
awscrt==0.28.2
1313
# via localstack-core (pyproject.toml)
1414
boto3==1.40.51
1515
# via localstack-core (pyproject.toml)
@@ -18,8 +18,6 @@ botocore==1.40.51
1818
# boto3
1919
# localstack-core (pyproject.toml)
2020
# s3transfer
21-
build==1.3.0
22-
# via localstack-core (pyproject.toml)
2321
cachetools==6.2.1
2422
# via localstack-core (pyproject.toml)
2523
cbor2==5.7.0
@@ -78,9 +76,12 @@ jmespath==1.0.1
7876
jsonpatch==1.33
7977
# via localstack-core (pyproject.toml)
8078
jsonpointer==3.0.0
81-
# via jsonpatch
79+
# via
80+
# jsonpatch
81+
# localstack-core (pyproject.toml)
8282
jsonschema==4.25.1
8383
# via
84+
# localstack-core (pyproject.toml)
8485
# openapi-core
8586
# openapi-schema-validator
8687
# openapi-spec-validator
@@ -112,8 +113,6 @@ openapi-schema-validator==0.6.3
112113
# openapi-spec-validator
113114
openapi-spec-validator==0.7.2
114115
# via openapi-core
115-
packaging==25.0
116-
# via build
117116
parse==1.20.2
118117
# via openapi-core
119118
pathable==0.4.4
@@ -134,10 +133,10 @@ pyopenssl==25.3.0
134133
# via
135134
# localstack-core (pyproject.toml)
136135
# localstack-twisted
137-
pyproject-hooks==1.2.0
138-
# via build
139136
python-dateutil==2.9.0.post0
140-
# via botocore
137+
# via
138+
# botocore
139+
# localstack-core (pyproject.toml)
141140
python-dotenv==1.1.1
142141
# via localstack-core (pyproject.toml)
143142
pyyaml==6.0.3
@@ -178,10 +177,9 @@ six==1.17.0
178177
# via
179178
# python-dateutil
180179
# rfc3339-validator
181-
tailer==0.4.1
182-
# via localstack-core (pyproject.toml)
183180
typing-extensions==4.15.0
184181
# via
182+
# localstack-core (pyproject.toml)
185183
# localstack-twisted
186184
# readerwriterlock
187185
urllib3==2.5.0

requirements-basic.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
#
55
# pip-compile --cert=None --client-cert=None --index-url=None --output-file=requirements-basic.txt --pip-args=None --strip-extras --unsafe-package=distribute --unsafe-package=localstack-core --unsafe-package=pip --unsafe-package=setuptools pyproject.toml
66
#
7-
build==1.3.0
8-
# via localstack-core (pyproject.toml)
97
cachetools==6.2.1
108
# via localstack-core (pyproject.toml)
119
certifi==2025.10.5
@@ -30,8 +28,6 @@ markdown-it-py==4.0.0
3028
# via rich
3129
mdurl==0.1.2
3230
# via markdown-it-py
33-
packaging==25.0
34-
# via build
3531
plux==1.13.0
3632
# via localstack-core (pyproject.toml)
3733
psutil==7.1.0
@@ -40,8 +36,6 @@ pycparser==2.23
4036
# via cffi
4137
pygments==2.19.2
4238
# via rich
43-
pyproject-hooks==1.2.0
44-
# via build
4539
python-dotenv==1.1.1
4640
# via localstack-core (pyproject.toml)
4741
pyyaml==6.0.3
@@ -52,7 +46,5 @@ rich==14.2.0
5246
# via localstack-core (pyproject.toml)
5347
semver==3.0.4
5448
# via localstack-core (pyproject.toml)
55-
tailer==0.4.1
56-
# via localstack-core (pyproject.toml)
5749
urllib3==2.5.0
5850
# via requests

0 commit comments

Comments
 (0)