diff --git a/Makefile b/Makefile index 3e8d7874..efce5011 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ lambda-layers/DependenciesLayer: mkdir -p $@ lambda-layers/DependenciesLayer/requirements.txt: pyproject.toml uv.lock lambda-layers/DependenciesLayer lambda-layers/DependenciesLayer ## Update the requirements.txt file used to build this Lambda function's DependenciesLayer - uv export --no-hashes --no-editable --no-dev | sed "s/ @ /@/" > lambda-layers/DependenciesLayer/requirements.txt + uv export --no-hashes --no-editable --no-dev > lambda-layers/DependenciesLayer/requirements.txt thumbs/requirements.txt: thumbs/pyproject.toml uv.lock ## Update the requirements.txt file used to build this Lambda function's DependenciesLayer uv export --no-hashes --project thumbs > thumbs/requirements.txt diff --git a/lambda-layers/DependenciesLayer/Makefile b/lambda-layers/DependenciesLayer/Makefile new file mode 100644 index 00000000..c61905d3 --- /dev/null +++ b/lambda-layers/DependenciesLayer/Makefile @@ -0,0 +1,4 @@ + +build-DependenciesLayer: + pip install --break-system-packages setuptools + pip install --upgrade -r requirements.txt --target "$(ARTIFACTS_DIR)/python/" diff --git a/pyproject.toml b/pyproject.toml index 618fdccb..a2ced21a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,6 @@ description = " 📮 A Django port of the original PHP code from electionleaflet readme = "README.md" requires-python = ">=3.12" dependencies = [ - "aws-sam-cli==1.131.0", "dc-design-system", "dc-django-utils", "dj-pagination==2.4.0", @@ -29,6 +28,7 @@ dependencies = [ "psycopg2-binary==2.9.10", "sorl-thumbnail===12.11.0", "setuptools>=75.6.0", + "aws-wsgi", ] [tool.uv.workspace] @@ -38,7 +38,7 @@ members = ["thumbs"] django-uk-political-parties = { git = "https://github.com/DemocracyClub/django-uk-political-parties.git", rev = "86ffa51f8306858c379c9de5be2f4bdb24b3a910" } dc-design-system = { git = "https://github.com/DemocracyClub/design-system.git", rev = "c5c5de6b792b4b57997b65370fdcdfa4f099cdf4" } dc-django-utils = { git = "https://github.com/DemocracyClub/dc_django_utils.git", rev = "7.0.1" } -aws-wsgi = { git = "https://github.com/DemocracyClub/awsgi.git", rev = "master" } +aws-wsgi = { git = "https://github.com/DemocracyClub/awsgi.git" } [tool.pytest.ini_options] DJANGO_SETTINGS_MODULE = "electionleaflets.settings.testing" @@ -59,6 +59,7 @@ lint.extend-select = [ [dependency-groups] dev = [ + "aws-sam-cli==1.131.0", "pytest==8.3.3", "pytest-cov==6.0.0", "pytest-django==4.9.0", diff --git a/template.yaml b/template.yaml index 6c20d7be..572f3772 100644 --- a/template.yaml +++ b/template.yaml @@ -86,7 +86,7 @@ Resources: CompatibleRuntimes: - python3.12 Metadata: - BuildMethod: python3.12 + BuildMethod: makefile ElectionLeafletsFunction: diff --git a/uv.lock b/uv.lock index 61d2c75b..3e73184a 100644 --- a/uv.lock +++ b/uv.lock @@ -143,6 +143,11 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/4a/84/f3ce5384246c86f3806ca7b8b009edb9ea58271fd222c0bd69e31191b75c/aws_sam_translator-1.94.0-py3-none-any.whl", hash = "sha256:100e33eeffcfa81f7c45cadeb0ee29596ce829f6b4d2745140f04fa19a41f539", size = 384395 }, ] +[[package]] +name = "aws-wsgi" +version = "0.2.7" +source = { git = "https://github.com/DemocracyClub/awsgi.git#b286f129c5580547577f942c75be74cdca707386" } + [[package]] name = "binaryornot" version = "0.4.4" @@ -734,7 +739,7 @@ name = "electionleaflets" version = "0.1.0" source = { virtual = "." } dependencies = [ - { name = "aws-sam-cli" }, + { name = "aws-wsgi" }, { name = "dc-design-system" }, { name = "dc-django-utils" }, { name = "dj-pagination" }, @@ -767,6 +772,7 @@ deploy = [ ] dev = [ { name = "aloe-django" }, + { name = "aws-sam-cli" }, { name = "django-debug-toolbar" }, { name = "moto" }, { name = "pytest" }, @@ -778,7 +784,7 @@ dev = [ [package.metadata] requires-dist = [ - { name = "aws-sam-cli", specifier = "==1.131.0" }, + { name = "aws-wsgi", git = "https://github.com/DemocracyClub/awsgi.git" }, { name = "dc-design-system", git = "https://github.com/DemocracyClub/design-system.git?rev=c5c5de6b792b4b57997b65370fdcdfa4f099cdf4" }, { name = "dc-django-utils", git = "https://github.com/DemocracyClub/dc_django_utils.git?rev=7.0.1" }, { name = "dj-pagination", specifier = "==2.4.0" }, @@ -811,6 +817,7 @@ deploy = [ ] dev = [ { name = "aloe-django", specifier = "==0.2.0" }, + { name = "aws-sam-cli", specifier = "==1.131.0" }, { name = "django-debug-toolbar", specifier = "==5.0.0a0" }, { name = "moto", specifier = "==5.0.21" }, { name = "pytest", specifier = "==8.3.3" },