Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 36 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,12 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
Expand All @@ -87,12 +90,17 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
npm:
- 8
- 9
- 10
- 11
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
Expand All @@ -118,15 +126,17 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
npm:
- 8
- 9
- 10
- 11
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
Expand All @@ -152,12 +162,12 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
Expand All @@ -170,7 +180,7 @@ jobs:
- run: pytest -vv tests/integration/workflows/go_modules

java-maven-integration:
name: ${{ matrix.os }} / ${{ matrix.python }} / java maven
name: ${{ matrix.os }} / ${{ matrix.python }} / java maven / java ${{ matrix.java }}
if: github.repository_owner == 'aws'
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -180,12 +190,15 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
java:
- "21"
- "25"
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
Expand All @@ -194,12 +207,12 @@ jobs:
- uses: actions/setup-java@v5
with:
distribution: 'corretto'
java-version: '21'
java-version: ${{ matrix.java }}
- run: make init
- run: pytest -vv tests/integration/workflows/java_maven

java-gradle-integration:
name: ${{ matrix.os }} / ${{ matrix.python }} / java gradle
name: ${{ matrix.os }} / ${{ matrix.python }} / java gradle / java ${{ matrix.java }}
if: github.repository_owner == 'aws'
runs-on: ${{ matrix.os }}
env:
Expand All @@ -211,12 +224,15 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
java:
- "21"
- "25"
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
Expand All @@ -225,7 +241,7 @@ jobs:
- uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: '21'
java-version: ${{ matrix.java }}
- run: make init
- run: pytest -vv tests/integration/workflows/java_gradle

Expand All @@ -240,11 +256,12 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
Expand All @@ -264,12 +281,12 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
Expand All @@ -293,12 +310,12 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
Expand All @@ -321,12 +338,12 @@ jobs:
- ubuntu-latest
- windows-latest
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
Expand All @@ -352,7 +369,11 @@ jobs:
- windows-latest
python:
- "3.9"
- "3.8"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
rust:
- stable
steps:
Expand Down
2 changes: 2 additions & 0 deletions aws_lambda_builders/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
"python3.11": [ARM64, X86_64],
"python3.12": [ARM64, X86_64],
"python3.13": [ARM64, X86_64],
"python3.14": [ARM64, X86_64],
"ruby3.2": [ARM64, X86_64],
"ruby3.3": [ARM64, X86_64],
"ruby3.4": [ARM64, X86_64],
"java8": [ARM64, X86_64],
"java11": [ARM64, X86_64],
"java17": [ARM64, X86_64],
"java21": [ARM64, X86_64],
"java25": [ARM64, X86_64],
"go1.x": [ARM64, X86_64],
"dotnet6": [ARM64, X86_64],
"dotnet8": [ARM64, X86_64],
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_builders/workflows/python_pip/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def build_dependencies(artifacts_dir_path,

:type runtime: str
:param runtime: Python version to build dependencies for. This can
either be python3.8, python3.9, python3.10, python3.11, python3.12 or python3.13. These are
either be python3.8, python3.9, python3.10, python3.11, python3.12, python3.13 or python3.14. These are
currently the only supported values.

:type ui: :class:`lambda_builders.actions.python_pip.utils.UI`
Expand Down
57 changes: 53 additions & 4 deletions aws_lambda_builders/workflows/python_pip/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def get_lambda_abi(runtime):
"python3.11": "cp311",
"python3.12": "cp312",
"python3.13": "cp313",
"python3.14": "cp314",
}

if runtime not in supported:
Expand All @@ -102,8 +103,8 @@ def __init__(self, runtime, python_exe, osutils=None, dependency_builder=None, a

:type runtime: str
:param runtime: Python version to build dependencies for. This can
either be python3.8, python3.9, python3.10, python3.11, python3.12 or python3.13. These are currently the
only supported values.
either be python3.8, python3.9, python3.10, python3.11, python3.12, python3.13 or python3.14.
These are currently the only supported values.

:type osutils: :class:`lambda_builders.utils.OSUtils`
:param osutils: A class used for all interactions with the
Expand Down Expand Up @@ -215,6 +216,7 @@ class DependencyBuilder(object):
"cp311": (2, 26),
"cp312": (2, 34),
"cp313": (2, 34),
"cp314": (2, 34),
}
# Fallback version if we're on an unknown python version
# not in _RUNTIME_GLIBC.
Expand Down Expand Up @@ -664,8 +666,22 @@ def _parse_pkg_info_file(self, filepath):

def _get_pkg_info_filepath(self, package_dir):
setup_py = self._osutils.joinpath(package_dir, "setup.py")
script = self._SETUPTOOLS_SHIM % setup_py

# First, try to ensure setuptools is available for the subprocess
# In Python 3.12+, setuptools might not be available by default
try:
# Check if setuptools is available in the current environment
check_cmd = [self.python_exe, "-c", "import setuptools"]
result = subprocess.run(check_cmd, capture_output=True, timeout=10, check=False)
if result.returncode != 0:
LOG.debug(
"setuptools not available in Python environment. "
"PKG-INFO fallback will be used if setup.py fails."
)
except Exception as e:
LOG.debug("Could not check setuptools availability: %s", e)

script = self._SETUPTOOLS_SHIM % setup_py
cmd = [self.python_exe, "-c", script, "--no-user-cfg", "egg_info", "--egg-base", "egg-info"]
egg_info_dir = self._osutils.joinpath(package_dir, "egg-info")
self._osutils.makedirs(egg_info_dir)
Expand All @@ -676,15 +692,48 @@ def _get_pkg_info_filepath(self, package_dir):
info_contents = self._osutils.get_directory_contents(egg_info_dir)
if p.returncode != 0:
LOG.debug("Non zero rc (%s) from the setup.py egg_info command: %s", p.returncode, stderr)
# Check if the error is due to missing setuptools/distutils in Python 3.12+
if b"setuptools" in stderr or b"distutils" in stderr:
LOG.debug(
"Setup.py failed likely due to missing setuptools/distutils in Python 3.12+. "
"Trying fallback PKG-INFO."
)

if info_contents:
pkg_info_path = self._osutils.joinpath(egg_info_dir, info_contents[0], "PKG-INFO")
else:
# This might be a pep 517 package in which case this PKG-INFO file
# should be available right in the top level directory of the sdist
# in the case where the egg_info command fails.
pkg_info_path = self._get_fallback_pkg_info_filepath(package_dir)
LOG.debug("Using fallback PKG-INFO path: %s", pkg_info_path)

if not self._osutils.file_exists(pkg_info_path):
raise UnsupportedPackageError(self._osutils.basename(package_dir))
LOG.debug("PKG-INFO file not found at: %s", pkg_info_path)

# Look for any .egg-info directories that might already exist
try:
package_contents = self._osutils.get_directory_contents(package_dir)
for item in package_contents:
if item.endswith(".egg-info") and self._osutils.directory_exists(
self._osutils.joinpath(package_dir, item)
):
potential_pkg_info = self._osutils.joinpath(package_dir, item, "PKG-INFO")
if self._osutils.file_exists(potential_pkg_info):
LOG.debug("Found PKG-INFO in existing .egg-info directory: %s", potential_pkg_info)
pkg_info_path = potential_pkg_info
break
except Exception as e:
LOG.debug("Error while searching for existing .egg-info directories: %s", e)

if not self._osutils.file_exists(pkg_info_path):
LOG.warning(
"Unable to find PKG-INFO file for package in %s. "
"This may be due to missing setuptools/distutils in Python 3.12+ "
"or an incomplete sdist package.",
package_dir,
)
raise UnsupportedPackageError(self._osutils.basename(package_dir))
return pkg_info_path

def _get_fallback_pkg_info_filepath(self, package_dir: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ select = [
"PL", # pylint
"I", # isort
]
ignore = ["PLR0913"]
ignore = ["PLR0913", "PLC0415"]

[tool.ruff.lint.pylint]
max-branches = 13
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def read_version():
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Internet",
"Topic :: Software Development :: Build Tools",
"Topic :: Utilities",
Expand Down
Loading
Loading