Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Commit 41e5c10

Browse files
committed
Add automated linting of dependencies and clean up
1 parent 10b3611 commit 41e5c10

8 files changed

Lines changed: 129 additions & 98 deletions

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.45",
5755
# pinned / updated by ASF update action
5856
"botocore==1.40.45",
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,34 +83,36 @@ runtime = [
8083
# pinned / updated by ASF update action
8184
"awscli==1.42.45",
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
# TODO revert pin once moto upgrade is completed
97100
# "moto-ext[all]>=5.1.12.post22",
98101
"moto-ext[all]==5.1.14.post7",
99102
"opensearch-py>=2.4.1",
103+
"pydantic>=2.11.9",
100104
"pymongo>=4.2.0",
101105
"pyopenssl>=23.0.0",
106+
"responses>=0.25.8",
102107
]
103108

104109
# for running tests and coverage analysis
105110
test = [
106111
# runtime dependencies are required for running the tests
107112
"localstack-core[runtime]",
108113
"coverage[toml]>=5.5",
109-
"deepdiff>=6.4.1",
110114
"httpx[http2]>=0.25",
115+
"json5>=0.12.1",
111116
"pluggy>=1.3.0",
112117
"pytest>=7.4.2",
113118
"pytest-split>=0.8.0",
@@ -124,6 +129,7 @@ dev = [
124129
# test dependencies are required for developing localstack
125130
"localstack-core[test]",
126131
"coveralls>=3.3.1",
132+
"deptry>=0.13.0",
127133
"Cython",
128134
"networkx>=2.8.4",
129135
"openapi-spec-validator>=0.7.1",
@@ -204,6 +210,34 @@ exclude = [
204210
"localstack-core/localstack/utils/**" = "py310" # imported by CLI tests
205211
"localstack-core/localstack/testing/pytest/**" = "py310" # imported by CLI tests
206212

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

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

requirements-base-runtime.txt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ botocore==1.40.45
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

requirements-dev.txt

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ botocore==1.40.45
5757
# localstack-core
5858
# moto-ext
5959
# s3transfer
60-
build==1.3.0
61-
# via
62-
# localstack-core
63-
# localstack-core (pyproject.toml)
6460
cachetools==6.2.1
6561
# via
6662
# airspeed-ext
@@ -86,6 +82,7 @@ charset-normalizer==3.4.4
8682
# via requests
8783
click==8.3.0
8884
# via
85+
# deptry
8986
# localstack-core
9087
# localstack-core (pyproject.toml)
9188
colorama==0.4.6
@@ -114,9 +111,9 @@ cython==3.1.4
114111
decorator==5.2.1
115112
# via jsonpath-rw
116113
deepdiff==8.6.1
117-
# via
118-
# localstack-core
119-
# localstack-snapshot
114+
# via localstack-snapshot
115+
deptry==0.23.1
116+
# via localstack-core (pyproject.toml)
120117
dill==0.3.6
121118
# via
122119
# localstack-core
@@ -186,7 +183,9 @@ iniconfig==2.1.0
186183
isodate==0.7.2
187184
# via openapi-core
188185
jinja2==3.1.6
189-
# via moto-ext
186+
# via
187+
# localstack-core
188+
# moto-ext
190189
jmespath==1.0.1
191190
# via
192191
# boto3
@@ -216,10 +215,13 @@ jsonpath-ng==1.7.0
216215
jsonpath-rw==1.4.0
217216
# via localstack-core
218217
jsonpointer==3.0.0
219-
# via jsonpatch
218+
# via
219+
# jsonpatch
220+
# localstack-core
220221
jsonschema==4.25.1
221222
# via
222223
# aws-sam-translator
224+
# localstack-core
223225
# moto-ext
224226
# openapi-core
225227
# openapi-schema-validator
@@ -284,10 +286,11 @@ orderly-set==5.5.0
284286
packaging==25.0
285287
# via
286288
# apispec
287-
# build
289+
# deptry
288290
# jpype1
289291
# pytest
290292
# pytest-rerunfailures
293+
# requirements-parser
291294
pandoc==2.4
292295
# via localstack-core (pyproject.toml)
293296
parse==1.20.2
@@ -338,7 +341,9 @@ pyasn1==0.6.1
338341
pycparser==2.23
339342
# via cffi
340343
pydantic==2.12.1
341-
# via aws-sam-translator
344+
# via
345+
# aws-sam-translator
346+
# localstack-core
342347
pydantic-core==2.41.3
343348
# via pydantic
344349
pygments==2.19.2
@@ -355,8 +360,6 @@ pypandoc==1.15
355360
# via localstack-core (pyproject.toml)
356361
pyparsing==3.2.5
357362
# via moto-ext
358-
pyproject-hooks==1.2.0
359-
# via build
360363
pytest==8.4.2
361364
# via
362365
# localstack-core
@@ -375,6 +378,7 @@ python-dateutil==2.9.0.post0
375378
# via
376379
# botocore
377380
# jsii
381+
# localstack-core
378382
# moto-ext
379383
# opensearch-py
380384
python-dotenv==1.1.1
@@ -415,8 +419,12 @@ requests==2.32.5
415419
# rolo
416420
requests-aws4auth==1.3.1
417421
# via localstack-core
422+
requirements-parser==0.13.0
423+
# via deptry
418424
responses==0.25.8
419-
# via moto-ext
425+
# via
426+
# localstack-core
427+
# moto-ext
420428
rfc3339-validator==0.1.4
421429
# via openapi-schema-validator
422430
rich==14.2.0
@@ -453,10 +461,6 @@ sniffio==1.3.1
453461
# via anyio
454462
sympy==1.14.0
455463
# via cfn-lint
456-
tailer==0.4.1
457-
# via
458-
# localstack-core
459-
# localstack-core (pyproject.toml)
460464
typeguard==2.13.3
461465
# via
462466
# aws-cdk-asset-awscli-v1
@@ -471,6 +475,7 @@ typing-extensions==4.15.0
471475
# cattrs
472476
# cfn-lint
473477
# jsii
478+
# localstack-core
474479
# localstack-twisted
475480
# mypy
476481
# pydantic

0 commit comments

Comments
 (0)