From d05d197ebc308e8e2a26aa20c268477792fcbcf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andy=20M=C3=A9ry?= Date: Wed, 27 Nov 2024 17:59:28 +0100 Subject: [PATCH 1/3] chore: bump version and reorder changelog --- CHANGELOG.md | 32 +++++++++++++++++++------------- pyproject.toml | 2 +- tests/test_local/test_event.py | 15 ++++++++------- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f10053..2539a8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,23 +5,17 @@ All notable changes to this project will be documented in this file. -## [0.1.0] - 2023-03-02 +## [0.2.2] - 2024-11-27 -### Added +### Fixed -- Initial project setup -- Local testing utils -- Repository setup +- Fix Internal Server Error when body contained non-ASCII characters [#73](https://github.com/scaleway/serverless-functions-python/issues/73) -## [0.1.1] - 2023-04-14 +## [0.2.1] - 2024-07-15 ### Fixed -- Fix typos in headers injected by Envoy - -### Changed - -- Update README with link to Serverless Functions Node +- Returning a base64 encoded response would not be decoded by the framework ## [0.2.0] - 2023-04-23 @@ -29,8 +23,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added a simple server to test with multiple handlers -## [0.2.1] - 2024-07-15 +## [0.1.1] - 2023-04-14 + +### Changed + +- Update README with link to Serverless Functions Node ### Fixed -- Returning a base64 encoded response would not be decoded by the framework +- Fix typos in headers injected by Envoy + +## [0.1.0] - 2023-03-02 + +### Added + +- Initial project setup +- Local testing utils +- Repository setup diff --git a/pyproject.toml b/pyproject.toml index e0be2b0..ff81938 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "scaleway-functions-python" -version = "0.2.1" +version = "0.2.2" description = "Utilities for testing your Python handlers for Scaleway Serverless Functions." authors = ["Scaleway Serverless Team "] diff --git a/tests/test_local/test_event.py b/tests/test_local/test_event.py index 06137ff..f81af61 100644 --- a/tests/test_local/test_event.py +++ b/tests/test_local/test_event.py @@ -44,21 +44,22 @@ def test_format_http_event(app): assert event["pathParameters"] is None assert not event["stageVariable"] - assert event["isBase64Encoded"] is True + assert event.get("isBase64Encoded") assert event["requestContext"] == expected_request_context assert event["body"] == "" + def test_format_http_event_with_non_unicode_body(): # Create a request with non-unicode body - non_unicode_body = b'\xff\xfe\xfd' # Invalid UTF-8 sequence - builder = EnvironBuilder(method='POST', data=non_unicode_body) - r = Request(builder.get_environ()) + non_unicode_body = b"\xff\xfe\xfd" # Invalid UTF-8 sequence + builder = EnvironBuilder(method="POST", data=non_unicode_body) + req = Request(builder.get_environ()) # Call the function and check the result - event = format_http_event(r) + event = format_http_event(req) assert event is not None - assert 'body' in event - assert event.get('isBase64Encoded', False) is False + assert "body" in event + assert event.get("isBase64Encoded", False) is False From aa0670a8bed8b0dee8a1e19e8c34c83431eafba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andy=20M=C3=A9ry?= Date: Wed, 27 Nov 2024 18:39:03 +0100 Subject: [PATCH 2/3] chore(ci): remove python3.8 form ci as well --- .github/workflows/pytest.yml | 2 +- .pre-commit-config.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 76f7859..96b7f1f 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -14,7 +14,7 @@ jobs: test: strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12"] runs-on: ubuntu-22.04 steps: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b631efa..906aef4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ ci: # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks default_language_version: - python: python3.10 + python: python3.12 repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 From 1ce5990d9f1c0f664093e9b1988730520e7fbf89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andy=20M=C3=A9ry?= Date: Wed, 27 Nov 2024 18:40:09 +0100 Subject: [PATCH 3/3] fix: poetry lock again --- poetry.lock | 53 +++++++++++++++++++++-------------------------------- 1 file changed, 21 insertions(+), 32 deletions(-) diff --git a/poetry.lock b/poetry.lock index dc109a4..4697294 100644 --- a/poetry.lock +++ b/poetry.lock @@ -726,21 +726,6 @@ files = [ {file = "pyyaml-6.0.2.tar.gz", hash = "sha256:d584d9ec91ad65861cc08d42e834324ef890a082e591037abe114850ff7bbc3e"}, ] -[[package]] -name = "setuptools" -version = "70.0.0" -description = "Easily download, build, install, upgrade, and uninstall Python packages" -optional = false -python-versions = ">=3.8" -files = [ - {file = "setuptools-70.0.0-py3-none-any.whl", hash = "sha256:54faa7f2e8d2d11bcd2c07bed282eef1046b5c080d1c32add737d7b5817b1ad4"}, - {file = "setuptools-70.0.0.tar.gz", hash = "sha256:f211a66637b8fa059bb28183da127d4e86396c991a942b028c6650d4319c3fd0"}, -] - -[package.extras] -docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "pyproject-hooks (!=1.1)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] -testing = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "importlib-metadata", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "mypy (==1.9)", "packaging (>=23.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.1)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-home (>=0.5)", "pytest-mypy", "pytest-perf", "pytest-ruff (>=0.2.1)", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] - [[package]] name = "tomli" version = "2.1.0" @@ -779,30 +764,30 @@ name = "virtualenv" version = "20.28.0" description = "Virtual Python Environment builder" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "virtualenv-20.19.0-py3-none-any.whl", hash = "sha256:54eb59e7352b573aa04d53f80fc9736ed0ad5143af445a1e539aada6eb947dd1"}, - {file = "virtualenv-20.19.0.tar.gz", hash = "sha256:37a640ba82ed40b226599c522d411e4be5edb339a0c0de030c0dc7b646d61590"}, + {file = "virtualenv-20.28.0-py3-none-any.whl", hash = "sha256:23eae1b4516ecd610481eda647f3a7c09aea295055337331bb4e6892ecce47b0"}, + {file = "virtualenv-20.28.0.tar.gz", hash = "sha256:2c9c3262bb8e7b87ea801d715fae4495e6032450c71d2309be9550e7364049aa"}, ] [package.dependencies] -distlib = ">=0.3.6,<1" -filelock = ">=3.4.1,<4" -platformdirs = ">=2.4,<4" +distlib = ">=0.3.7,<1" +filelock = ">=3.12.2,<4" +platformdirs = ">=3.9.1,<5" [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] -test = ["covdefaults (>=2.2.2)", "coverage (>=7.1)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23)", "pytest (>=7.2.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"] [[package]] name = "werkzeug" -version = "3.0.6" +version = "3.1.3" description = "The comprehensive WSGI web application library." optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "werkzeug-3.0.6-py3-none-any.whl", hash = "sha256:1bc0c2310d2fbb07b1dd1105eba2f7af72f322e1e455f2f93c993bee8c8a5f17"}, - {file = "werkzeug-3.0.6.tar.gz", hash = "sha256:a8dd59d4de28ca70471a34cba79bed5f7ef2e036a76b3ab0835474246eb41f8d"}, + {file = "werkzeug-3.1.3-py3-none-any.whl", hash = "sha256:54b78bf3716d19a65be4fceccc0d1d7b89e608834989dfae50ea87564639213e"}, + {file = "werkzeug-3.1.3.tar.gz", hash = "sha256:60723ce945c19328679790e3282cc758aa4a6040e4bb330f53d30fa546d44746"}, ] [package.dependencies] @@ -813,18 +798,22 @@ watchdog = ["watchdog (>=2.3)"] [[package]] name = "zipp" -version = "3.19.1" +version = "3.21.0" description = "Backport of pathlib-compatible object wrapper for zip files" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "zipp-3.19.1-py3-none-any.whl", hash = "sha256:2828e64edb5386ea6a52e7ba7cdb17bb30a73a858f5eb6eb93d8d36f5ea26091"}, - {file = "zipp-3.19.1.tar.gz", hash = "sha256:35427f6d5594f4acf82d25541438348c26736fa9b3afa2754bcd63cdb99d8e8f"}, + {file = "zipp-3.21.0-py3-none-any.whl", hash = "sha256:ac1bbe05fd2991f160ebce24ffbac5f6d11d83dc90891255885223d42b3cd931"}, + {file = "zipp-3.21.0.tar.gz", hash = "sha256:2c9958f6430a2040341a52eb608ed6dd93ef4392e02ffe219417c1b28b5dd1f4"}, ] [package.extras] +check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)"] +cover = ["pytest-cov"] doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -test = ["big-O", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-itertools", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy", "pytest-ruff (>=0.2.1)"] +enabler = ["pytest-enabler (>=2.2)"] +test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-itertools", "pytest (>=6,!=8.1.*)", "pytest-ignore-flaky"] +type = ["pytest-mypy"] [metadata] lock-version = "2.0"