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

Commit 67bf369

Browse files
committed
Move steps for updating ASF modules to Makefile
Hidden in the GitHub workflow, it's hard to find the command to run to fix the unused imports in the generated file. Here we move this logic to a new Makefile rule, for convenient manual and automated use.
1 parent 37b23d0 commit 67bf369

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

.github/workflows/asf-updates.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,7 @@ jobs:
4444
4545
- name: Update ASF APIs
4646
run: |
47-
source .venv/bin/activate
48-
python3 -m localstack.aws.scaffold upgrade
49-
50-
- name: Format code
51-
run: |
52-
source .venv/bin/activate
53-
# explicitly perform an unsafe fix to remove unused imports in the generated ASF APIs
54-
ruff check --select F401 --unsafe-fixes --fix localstack-core/localstack/aws/api/ --config "lint.preview = true"
55-
make format-modified
47+
make asf-regenerate
5648
5749
- name: Check for changes
5850
id: check-for-changes

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ format-modified: ## Run ruff to format only modified code
140140
python -m ruff check --output-format=full --fix `git diff --diff-filter=d --name-only HEAD | grep '\.py$$' | xargs`; \
141141
python -m ruff format `git diff --diff-filter=d --name-only HEAD | grep '\.py$$' | xargs`)
142142

143+
asf-regenerate: ## Regenerate ASF APIs
144+
$(VENV_RUN); python -m localstack.aws.scaffold upgrade
145+
@echo 'Removing unused imports from generated modules'
146+
$(VENV_RUN); python -m ruff check --select F401 --unsafe-fixes --fix localstack-core/localstack/aws/api/ --config "lint.preview = true"
147+
$(VENV_RUN); python -m ruff format localstack-core/localstack/aws/api/
148+
143149
init-precommit: ## install te pre-commit hook into your local git repository
144150
($(VENV_RUN); pre-commit install)
145151

@@ -158,4 +164,4 @@ clean-dist: ## Clean up python distribution directories
158164
rm -rf dist/ build/
159165
rm -rf localstack-core/*.egg-info
160166

161-
.PHONY: usage freeze install-basic install-runtime install-test install-dev install entrypoints dist publish coveralls start docker-run-tests docker-cp-coverage test test-coverage lint lint-modified format format-modified init-precommit clean clean-dist upgrade-pinned-dependencies
167+
.PHONY: usage freeze install-basic install-runtime install-test install-dev install entrypoints dist publish coveralls start docker-run-tests docker-cp-coverage test test-coverage lint lint-modified format format-modified asf-regenerate init-precommit clean clean-dist upgrade-pinned-dependencies

0 commit comments

Comments
 (0)