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

Commit 0073e19

Browse files
authored
switch to commit-time plux entrypoint detection (#13643)
1 parent 37780be commit 0073e19

10 files changed

Lines changed: 251 additions & 38 deletions

File tree

.github/workflows/aws-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ jobs:
225225
- name: Linting
226226
run: make lint
227227

228+
- name: Verify Plux Entrypoints
229+
run: make entrypoints && git diff --exit-code plux.ini
230+
228231
- name: Check AWS compatibility markers
229232
run: make check-aws-markers
230233

.github/workflows/tests-pro-integration.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -280,21 +280,6 @@ jobs:
280280
source .venv/bin/activate
281281
pip install -e ../localstack[runtime,test]
282282
283-
- name: Create Community Entrypoints
284-
working-directory: localstack
285-
# Entrypoints need to be generated _after_ the community edition has been linked into the venv
286-
run: |
287-
VENV_DIR="../localstack-pro/.venv" make entrypoints
288-
../localstack-pro/.venv/bin/python -m plux show
289-
290-
- name: Create Pro Entrypoints
291-
working-directory: localstack-pro
292-
# Entrypoints need to be generated _after_ the community edition has been linked into the venv
293-
run: |
294-
make entrypoints
295-
cd localstack-pro-core
296-
../.venv/bin/python -m plux show
297-
298283
- name: Test Pro Startup
299284
env:
300285
DEBUG: 1

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
3+
# TODO add pre-commit hook for plux entrypoints reconciliation on changed files
34
repos:
45
- repo: https://github.com/astral-sh/ruff-pre-commit
56
# Ruff version.
@@ -22,6 +23,7 @@ repos:
2223
hooks:
2324
- id: no-commit-to-branch
2425
- id: end-of-file-fixer
26+
exclude: "plux.ini"
2527
- id: trailing-whitespace
2628
- id: check-json
2729
files: .*\.(snapshot|validation)\.json

Dockerfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ COPY --from=builder /opt/code/localstack/.venv /opt/code/localstack/.venv
129129
ARG LOCALSTACK_BUILD_VERSION
130130

131131
# add project files necessary to install all dependencies
132-
ADD Makefile pyproject.toml ./
132+
ADD Makefile pyproject.toml plux.ini ./
133133
# add the localstack start scripts (necessary for the installation of the runtime dependencies, i.e. `pip install -e .`)
134134
ADD bin/localstack bin/localstack.bat bin/localstack-supervisor bin/
135135

@@ -142,10 +142,6 @@ RUN --mount=type=cache,target=/root/.cache \
142142
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_LOCALSTACK_CORE=${LOCALSTACK_BUILD_VERSION} \
143143
pip install -e .[runtime]
144144

145-
# Generate the plugin entrypoints
146-
RUN SETUPTOOLS_SCM_PRETEND_VERSION_FOR_LOCALSTACK_CORE=${LOCALSTACK_BUILD_VERSION} \
147-
make entrypoints
148-
149145
# Generate service catalog cache in static libs dir
150146
RUN . .venv/bin/activate && python3 -m localstack.aws.spec
151147

Dockerfile.s3

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ COPY --from=builder /opt/code/localstack/.venv /opt/code/localstack/.venv
7676
ARG LOCALSTACK_BUILD_VERSION
7777

7878
# add project files necessary to install all dependencies
79-
ADD Makefile pyproject.toml requirements-base-runtime.txt ./
79+
ADD Makefile pyproject.toml plux.ini requirements-base-runtime.txt ./
8080
# add the localstack start scripts (necessary for the installation of the runtime dependencies, i.e. `pip install -e .`)
8181
ADD bin/localstack bin/localstack.bat bin/localstack-supervisor bin/
8282

@@ -89,10 +89,6 @@ RUN --mount=type=cache,target=/root/.cache \
8989
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_LOCALSTACK_CORE=${LOCALSTACK_BUILD_VERSION} \
9090
pip install -e .[base-runtime]
9191

92-
# Generate the plugin entrypoints
93-
RUN SETUPTOOLS_SCM_PRETEND_VERSION_FOR_LOCALSTACK_CORE=${LOCALSTACK_BUILD_VERSION} \
94-
make entrypoints
95-
9692
# Generate service catalog cache in static libs dir
9793
RUN . .venv/bin/activate && python3 -m localstack.aws.spec
9894

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ usage: ## Show this help
2727

2828
$(VENV_ACTIVATE): pyproject.toml
2929
test -d $(VENV_DIR) || $(VENV_BIN) $(VENV_DIR)
30-
$(VENV_RUN); $(PIP_CMD) install --upgrade pip setuptools wheel plux
30+
$(VENV_RUN); $(PIP_CMD) install --upgrade pip setuptools wheel
3131
touch $(VENV_ACTIVATE)
3232

3333
venv: $(VENV_ACTIVATE) ## Create a new (empty) virtual environment
@@ -69,14 +69,14 @@ install-s3: venv ## Install dependencies for the localstack runtime for s3-o
6969
$(VENV_RUN); $(PIP_CMD) install -r requirements-base-runtime.txt
7070
$(VENV_RUN); $(PIP_CMD) install $(PIP_OPTS) -e ".[base-runtime]"
7171

72-
install: install-dev entrypoints ## Install full dependencies into venv
72+
install: install-dev ## Install full dependencies into venv
7373

74-
entrypoints: ## Run plux to build entry points
75-
$(VENV_RUN); python3 -c "from setuptools import setup; setup()" plugins egg_info
76-
@# make sure that the entrypoints were correctly created and are non-empty
77-
@test -s localstack-core/localstack_core.egg-info/entry_points.txt || (echo "Entrypoints were not correctly created! Aborting!" && exit 1)
74+
entrypoints: install-dev
75+
$(VENV_RUN); python -m plux entrypoints
76+
@# make sure that the plux.ini file with the entrypoints has correctly been created
77+
@test -s plux.ini || (echo "Entrypoints were not correctly created! Aborting!" && exit 1)
7878

79-
dist: entrypoints ## Build source and built (wheel) distributions of the current version
79+
dist: ## Build source and built (wheel) distributions of the current version
8080
$(VENV_RUN); pip install --upgrade build twine; python -m build
8181

8282
publish: clean-dist dist ## Publish the library to the central PyPi repository

docs/localstack-concepts/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ Plugins provided by [https://github.com/localstack/plux](https://github.com/loca
143143
- Hooks
144144
- Extensions
145145
146-
Key points to understand are that plugins use [Python entry points, which are part of the PyPA specification](https://packaging.python.org/en/latest/specifications/entry-points/). Entry points are discovered from the code during a build step rather than defined manually (this is the main differentiator of Plux to other code loading tools). In LocalStack, the `make entrypoints` make target does that, which is also part of `make install`.
146+
Key points to understand are that plugins use [Python entry points, which are part of the PyPA specification](https://packaging.python.org/en/latest/specifications/entry-points/). Entry points are discovered from the code and maintained in the `plux.ini` file, which is version-controlled. This file is used at build time to generate the entry points for the Python package.
147147
148-
When you add new hooks or service providers, or any other plugin, make sure to run `make entrypoints`.
148+
When you add new hooks or service providers, or any other plugin, make sure to run `make entrypoints` to update the `plux.ini` file, and commit the changes to version control.
149149
150150
When writing plugins, it is important to understand that any code that sits in the same module as the plugin, will be imported when the plugin is _resolved_. That is, _before_ it is loaded. Resolving a plugin simply means discovering the entry points and loading the code the underlying entry point points to. This is why many times you will see imports deferred to the actual loading of the plugin.
151151

localstack-core/localstack/services/cloudformation/scaffolding/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ def generate(
922922
)
923923
console.print("\nWondering where to get started?")
924924
console.print(
925-
"First run `make entrypoints` to make sure your resource provider plugin is actually registered."
925+
"First run `make entrypoints` to update the plux.ini file with your new resource provider plugin."
926926
)
927927
console.print(
928928
'Then start off by finalizing the generated minimal ("basic") template and get it to deploy against AWS.'

0 commit comments

Comments
 (0)