From e7059e18068604138fd5f4a5c066c6603e7729b7 Mon Sep 17 00:00:00 2001 From: Quinn Sinclair Date: Thu, 27 Jun 2024 08:47:10 +0000 Subject: [PATCH 1/4] Migrate to pyproject.toml --- Makefile | 9 +++---- awslambdaric/__init__.py | 4 ++- pyproject.toml | 55 ++++++++++++++++++++++++++++++++++++++++ requirements/base.txt | 1 - requirements/dev.txt | 12 --------- setup.py | 33 ------------------------ 6 files changed, 62 insertions(+), 52 deletions(-) create mode 100644 pyproject.toml delete mode 100644 requirements/base.txt delete mode 100644 requirements/dev.txt diff --git a/Makefile b/Makefile index ff99587..5d7055c 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,7 @@ target: .PHONY: init init: - pip3 install -r requirements/base.txt -r requirements/dev.txt - + pip3 install -e . .PHONY: test test: check-format pytest --cov awslambdaric --cov-report term-missing --cov-fail-under 90 tests @@ -28,11 +27,11 @@ check-security: bandit -r awslambdaric .PHONY: format -format: +format: init black setup.py awslambdaric/ tests/ .PHONY: check-format -check-format: +check-format: init black --check setup.py awslambdaric/ tests/ # Command to run everytime you make changes to verify everything works @@ -52,7 +51,7 @@ clean: .PHONY: build build: clean - BUILD=true python3 setup.py sdist + BUILD=true python3 -m build --sdist --wheel define HELP_MESSAGE diff --git a/awslambdaric/__init__.py b/awslambdaric/__init__.py index c0d8290..21bc685 100644 --- a/awslambdaric/__init__.py +++ b/awslambdaric/__init__.py @@ -2,4 +2,6 @@ Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. """ -__version__ = "2.0.12" +import importlib.metadata + +__version__ = importlib.metadata.version("awslambdaric") diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..0bf2bb4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,55 @@ +[project] +name = "awslambdaric" +version = "2.0.12" +description = "AWS Lambda Runtime Interface Client for Python" +authors = [ + { name = "Amazon Web Services" } +] +dependencies = [ + "simplejson>=3.18.4" +] +readme = "README.md" +requires-python = ">= 3.8" + +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", +] + +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.dynamic] +version = {attr = "awslambdaric.VERSION"} + +[project.optional-dependencies] +dev = [ + "coverage>=4.4.0", + "flake8>=3.3.0", + "tox>=2.2.1", + "pytest-cov>=2.4.0", + "pylint>=1.7.2", + "black>=20.8b0", + "bandit>=1.6.2", + + # Test requirements + "pytest>=3.0.7", + "mock>=2.0.0", + "parameterized>=0.9.0", +] + +[project.urls] +Repository = "https://github.com/aws/aws-lambda-python-runtime-interface-client" +Issues = "https://github.com/aws/aws-lambda-python-runtime-interface-client/issues" diff --git a/requirements/base.txt b/requirements/base.txt deleted file mode 100644 index 819c723..0000000 --- a/requirements/base.txt +++ /dev/null @@ -1 +0,0 @@ -simplejson>=3.18.4 diff --git a/requirements/dev.txt b/requirements/dev.txt deleted file mode 100644 index 68377ce..0000000 --- a/requirements/dev.txt +++ /dev/null @@ -1,12 +0,0 @@ -coverage>=4.4.0 -flake8>=3.3.0 -tox>=2.2.1 -pytest-cov>=2.4.0 -pylint>=1.7.2 -black>=20.8b0 -bandit>=1.6.2 - -# Test requirements -pytest>=3.0.7 -mock>=2.0.0 -parameterized>=0.9.0 \ No newline at end of file diff --git a/setup.py b/setup.py index 2544b21..7423da0 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,6 @@ import platform from subprocess import check_call, check_output from setuptools import Extension, find_packages, setup -from awslambdaric import __version__ def get_curl_extra_linker_flags(): @@ -59,42 +58,10 @@ def read(*filenames, **kwargs): buf.append(f.read()) return sep.join(buf) - -def read_requirements(req="base.txt"): - content = read(os.path.join("requirements", req)) - return [ - line for line in content.split(os.linesep) if not line.strip().startswith("#") - ] - - setup( - name="awslambdaric", - version=__version__, - author="Amazon Web Services", - description="AWS Lambda Runtime Interface Client for Python", - long_description=read("README.md"), - long_description_content_type="text/markdown", - url="https://github.com/aws/aws-lambda-python-runtime-interface-client", packages=find_packages( exclude=("tests", "tests.*", "docs", "examples", "versions") ), - install_requires=read_requirements("base.txt"), - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Natural Language :: English", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "License :: OSI Approved :: Apache Software License", - "Operating System :: OS Independent", - ], - python_requires=">=3.6", ext_modules=get_runtime_client_extension(), test_suite="tests", ) From 9d49d5f0eb06d53457b0b262e5bcadab7682fcf1 Mon Sep 17 00:00:00 2001 From: Quinn Sinclair Date: Thu, 27 Jun 2024 11:43:24 +0000 Subject: [PATCH 2/4] Try fix 'Unknown' target for GH build --- Makefile | 1 + pyproject.toml | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 5d7055c..6e0552c 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ target: .PHONY: init init: + pip3 install --upgrade pip pip3 install -e . .PHONY: test test: check-format diff --git a/pyproject.toml b/pyproject.toml index 0bf2bb4..d300441 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,9 +31,6 @@ classifiers = [ requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" -[tool.setuptools.dynamic] -version = {attr = "awslambdaric.VERSION"} - [project.optional-dependencies] dev = [ "coverage>=4.4.0", From 0bdf39b4b2cb3ad6d8c7cd9b8d73616414b2eaf0 Mon Sep 17 00:00:00 2001 From: Quinn Sinclair Date: Thu, 27 Jun 2024 11:47:00 +0000 Subject: [PATCH 3/4] do a user install --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6e0552c..d2bffe5 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,7 @@ target: .PHONY: init init: - pip3 install --upgrade pip - pip3 install -e . + pip3 install --user -e . .PHONY: test test: check-format pytest --cov awslambdaric --cov-report term-missing --cov-fail-under 90 tests From 5fd88f085784c52df0082d929aaeaa99afbf59c0 Mon Sep 17 00:00:00 2001 From: Quinn Sinclair Date: Thu, 27 Jun 2024 12:07:38 +0000 Subject: [PATCH 4/4] try with pip instead of pip3 --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d2bffe5..2bbd62c 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ target: .PHONY: init init: - pip3 install --user -e . + pip install --user -e . .PHONY: test test: check-format pytest --cov awslambdaric --cov-report term-missing --cov-fail-under 90 tests @@ -51,7 +51,7 @@ clean: .PHONY: build build: clean - BUILD=true python3 -m build --sdist --wheel + BUILD=true python -m build --sdist --wheel define HELP_MESSAGE