Skip to content

Commit

Permalink
configure project to work with src layout
Browse files Browse the repository at this point in the history
  • Loading branch information
thrau committed May 9, 2024
1 parent b603ed7 commit 3747957
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ ADD Makefile pyproject.toml VERSION ./
ADD bin/localstack bin/localstack.bat bin/localstack-supervisor bin/

# add the code as late as possible
ADD localstack/ localstack/
ADD localstack-core/ localstack/

# Generate the plugin entrypoints
RUN make entrypoints
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ install: install-dev entrypoints ## Install full dependencies into venv
entrypoints: ## Run plux to build entry points
$(VENV_RUN); python -m plux entrypoints
@# make sure that the entrypoints were correctly created and are non-empty
@test -s localstack_core.egg-info/entry_points.txt || (echo "Entrypoints were not correctly created! Aborting!" && exit 1)
@test -s localstack-core/localstack_core.egg-info/entry_points.txt || (echo "Entrypoints were not correctly created! Aborting!" && exit 1)

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

publish: clean-dist dist ## Publish the library to the central PyPi repository
# make sure the dist archive contains a non-empty entry_points.txt file before uploading
tar --wildcards --to-stdout -xf dist/localstack?core*.tar.gz "localstack?core*/localstack_core.egg-info/entry_points.txt" | grep . > /dev/null 2>&1 || (echo "Refusing upload, localstack-core dist does not contain entrypoints." && exit 1)
tar --wildcards --to-stdout -xf dist/localstack?core*.tar.gz "localstack?core*/localstack-core/localstack_core.egg-info/entry_points.txt" | grep . > /dev/null 2>&1 || (echo "Refusing upload, localstack-core dist does not contain entrypoints." && exit 1)
$(VENV_RUN); twine upload dist/*

coveralls: ## Publish coveralls metrics
Expand Down Expand Up @@ -258,11 +258,11 @@ clean: ## Clean up (npm dependencies, downloaded infrastructure
rm -rf .filesystem
rm -rf build/
rm -rf dist/
rm -rf *.egg-info
rm -rf localstack-core/*.egg-info
rm -rf $(VENV_DIR)

clean-dist: ## Clean up python distribution directories
rm -rf dist/ build/
rm -rf *.egg-info
rm -rf localstack-core/*.egg-info

.PHONY: usage freeze install-basic install-runtime install-test install-dev install entrypoints dist publish coveralls start docker-save-image docker-build docker-build-multiarch docker-push-master docker-create-push-manifests docker-run-tests docker-run docker-mount-run docker-cp-coverage test test-coverage test-docker test-docker-mount test-docker-mount-code lint lint-modified format format-modified init-precommit clean clean-dist upgrade-pinned-dependencies
14 changes: 9 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,14 @@ script-files = [
"bin/localstack.bat",
"bin/localstack-supervisor",
]
package-dir = { "" = "localstack-core"}

[tool.setuptools.dynamic]
readme = { file = ["README.md"], content-type = "text/markdown"}
version = { file = "VERSION" }

[tool.setuptools.packages.find]
where = ["localstack-core/"]
include = ["localstack*"]
exclude = ["tests*"]

Expand All @@ -171,16 +173,18 @@ exclude = ["tests*"]
# Always generate Python 3.8-compatible code.
target-version = "py38"
line-length = 100
src = ["localstack-core", "tests"]
exclude = [
".venv*",
"venv*",
"dist",
"build",
"target",
"*.egg-info",
"localstack-core/*.egg-info",
".filesystem",
".git",
"localstack/services/stepfunctions/asl/antlr/runtime"
"localstack-core/localstack/services/stepfunctions/asl/antlr/runtime"
]

[tool.ruff.lint]
Expand All @@ -207,12 +211,12 @@ select = ["B", "C", "E", "F", "I", "W", "T", "B9"]
[tool.coverage.run]
relative_files = true
source = [
"localstack/"
"localstack-core/"
]
omit = [
"localstack/aws/api/*",
"localstack/extensions/api/*",
"localstack/services/stepfunctions/asl/antlr/runtime/*"
"localstack-core/localstack/aws/api/*",
"localstack-core/localstack/extensions/api/*",
"localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/*"
]
dynamic_context = "test_function"

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def get_version():
# Set the version in the localstack/version.py file
def set_version_constant(version: str):
with open(
os.path.join(os.path.dirname(__file__), "localstack", "version.py"), "w"
os.path.join(os.path.dirname(__file__), "localstack-core", "localstack", "version.py"), "w"
) as version_file:
version_file.write(f'__version__ = "{version}"\n')

Expand Down

0 comments on commit 3747957

Please sign in to comment.