Support Python 3.13 and modern dependencies - #3
Open
Janekk wants to merge 1 commit into
Open
Conversation
The pinned dependency set (boto3 1.14.47, cryptography 2.9.2, marshmallow
2.19.2) installs on Python 3.13 but fails at import time, so a lambda
packaged from it deploys successfully and then dies on its first cold
start:
File "urllib3/exceptions.py", line 2, in <module>
from .packages.six.moves.http_client import IncompleteRead
ModuleNotFoundError: No module named 'urllib3.packages.six.moves'
Bump the dependencies and port the code to their current APIs:
- marshmallow 2 -> 3: drop `strict=True` and `ValidationError.data`, which
are now the only behaviour; add `**kwargs` to `@post_load` hooks, which
marshmallow 3 calls with `many`/`partial`. Remove the hand-rolled
`check_unknown_fields` validators — marshmallow 3 defaults to
`unknown=RAISE`, so unknown fields are still rejected, and the old
two-argument hook signature raises TypeError under 3.x regardless. Use
the `error=` keyword for `validate.Email`.
- cryptography: drop the removed `backend` positional argument. Replace
the private `ssh._ssh_read_next_string`, which no longer exists, with a
documented `unpack_ssh_string` in bless.ssh.protocol. Load ed25519 keys
via the public `load_ssh_public_key` now that hazmat supports them,
rather than parsing the wire format by hand.
- Constrain marshmallow to <4: version 4 removes `Schema.context` and
`validate.URL(require_tld=...)`, both of which the request schemas use.
- Declare `python_requires=">=3.11"`.
The ed25519 rewrite delegates the header/body key-type consistency check
to load_ssh_public_key instead of doing it inline, so add a test that a
mismatched header is still rejected.
Package inside the AWS Lambda Python base image rather than Amazon Linux 2:
cryptography now ships manylinux_2_34 wheels that will not install there,
and building in the runtime image keeps the bundled wheels matched to the
deployed interpreter and glibc. lambda_compile.sh installs non-editable
into ./aws_lambda_libs, which keeps build-time __editable__ .pth shims out
of the zip, and gains `set -e` so a failed install cannot yield a
silently incomplete bundle.
Verified on python3.13: 161 tests pass, flake8 clean, and both
lambda_handler_user and lambda_handler_host import from a packaged bundle.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make BLESS run on Python 3.13. Pushed (as asked); master untouched at f6f54cf.
Verified: 161 tests pass, flake8 clean, handlers import on 3.13.