Skip to content

drop support for Python 3.8 in the LocalStack CLI #11875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 19, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/tests-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ env:
# report to tinybird if executed on master
TINYBIRD_PYTEST_ARGS: "${{ github.ref == 'refs/heads/master' && '--report-to-tinybird ' || '' }}"

permissions:
permissions:
contents: read # checkout the repository

jobs:
Expand All @@ -79,7 +79,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
timeout-minutes: 10
env:
# Set job-specific environment variables for pytest-tinybird
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
if: always() && github.ref == 'refs/heads/master' && github.repository == 'localstack/localstack'
runs-on: ubuntu-latest
needs: cli-tests
permissions:
permissions:
actions: read
steps:
- name: Push to Tinybird
Expand Down
1 change: 0 additions & 1 deletion localstack-core/localstack/services/s3/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from datetime import datetime
from secrets import token_urlsafe
from typing import Literal, NamedTuple, Optional, Union

from zoneinfo import ZoneInfo

from localstack.aws.api import CommonServiceException
Expand Down
7 changes: 4 additions & 3 deletions localstack-core/localstack/services/s3/storage/ephemeral.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,10 @@ def copy_from_object(
:param range_data: the range data from which the S3Part will copy its data.
:return: the EphemeralS3StoredObject representing the stored part
"""
with self._s3_store.open(
src_bucket, src_s3_object, mode="r"
) as src_stored_object, self.open(s3_part, mode="w") as stored_part:
with (
self._s3_store.open(src_bucket, src_s3_object, mode="r") as src_stored_object,
self.open(s3_part, mode="w") as stored_part,
):
Comment on lines +337 to +340
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was super curious about this, so here it is for history:
https://www.blog.pythonlibrary.org/2021/09/08/python-3-10-parenthesized-context-managers/

Super neat! 👌

if not range_data:
stored_part.write(src_stored_object)
return
Expand Down
2 changes: 1 addition & 1 deletion localstack-core/localstack/services/s3/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
from secrets import token_bytes
from typing import IO, Any, Dict, Literal, NamedTuple, Optional, Protocol, Tuple, Union
from urllib import parse as urlparser
from zoneinfo import ZoneInfo

import xmltodict
from botocore.exceptions import ClientError
from botocore.utils import InvalidArnException
from zoneinfo import ZoneInfo

from localstack import config, constants
from localstack.aws.api import CommonServiceException, RequestContext
Expand Down
2 changes: 1 addition & 1 deletion localstack-core/localstack/services/s3/validation.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import base64
import datetime
import hashlib
from zoneinfo import ZoneInfo

from botocore.utils import InvalidArnException
from zoneinfo import ZoneInfo

from localstack.aws.api import CommonServiceException
from localstack.aws.api.s3 import (
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ authors = [
{ name = "LocalStack Contributors", email = "info@localstack.cloud" }
]
description = "The core library and runtime of LocalStack"
requires-python = ">=3.8"
requires-python = ">=3.9"
dependencies = [
"build",
"click>=7.1",
Expand Down Expand Up @@ -175,8 +175,8 @@ exclude = ["tests*"]
]

[tool.ruff]
# Always generate Python 3.8-compatible code.
target-version = "py38"
# Always generate Python 3.9-compatible code.
target-version = "py39"
line-length = 100
src = ["localstack-core", "tests"]
exclude = [
Expand Down
7 changes: 4 additions & 3 deletions tests/aws/services/events/test_events_patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,10 @@ def test_event_pattern_with_multi_key(self, aws_client):
https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns-content-based-filtering.html#eb-filtering-complex-example
"""

with open(COMPLEX_MULTI_KEY_EVENT, "r") as event_file, open(
COMPLEX_MULTI_KEY_EVENT_PATTERN, "r"
) as event_pattern_file:
with (
open(COMPLEX_MULTI_KEY_EVENT, "r") as event_file,
open(COMPLEX_MULTI_KEY_EVENT_PATTERN, "r") as event_pattern_file,
):
event = event_file.read()
event_pattern = event_pattern_file.read()

Expand Down
2 changes: 1 addition & 1 deletion tests/aws/services/s3/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from operator import itemgetter
from typing import TYPE_CHECKING
from urllib.parse import SplitResult, parse_qs, quote, urlencode, urlparse, urlunsplit
from zoneinfo import ZoneInfo

import boto3 as boto3
import pytest
Expand All @@ -26,7 +27,6 @@
from botocore.client import Config
from botocore.exceptions import ClientError
from localstack_snapshot.snapshots.transformer import RegexTransformer
from zoneinfo import ZoneInfo

import localstack.config
from localstack import config
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import time
import zipfile
from datetime import date, datetime, timezone
from zoneinfo import ZoneInfo

import pytest
import yaml
from zoneinfo import ZoneInfo

from localstack import config
from localstack.utils import common
Expand Down
28 changes: 16 additions & 12 deletions tests/unit/test_docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

class TestDockerUtils:
def test_host_path_for_path_in_docker_windows(self):
with mock.patch(
"localstack.utils.docker_utils.get_default_volume_dir_mount"
) as get_volume, mock.patch("localstack.config.is_in_docker", True):
with (
mock.patch("localstack.utils.docker_utils.get_default_volume_dir_mount") as get_volume,
mock.patch("localstack.config.is_in_docker", True),
):
get_volume.return_value = VolumeInfo(
type="bind",
source=r"C:\Users\localstack\volume\mount",
Expand All @@ -23,9 +24,10 @@ def test_host_path_for_path_in_docker_windows(self):
assert result == r"C:\Users\localstack\volume\mount/some/test/file"

def test_host_path_for_path_in_docker_linux(self):
with mock.patch(
"localstack.utils.docker_utils.get_default_volume_dir_mount"
) as get_volume, mock.patch("localstack.config.is_in_docker", True):
with (
mock.patch("localstack.utils.docker_utils.get_default_volume_dir_mount") as get_volume,
mock.patch("localstack.config.is_in_docker", True),
):
get_volume.return_value = VolumeInfo(
type="bind",
source="/home/some-user/.cache/localstack/volume",
Expand All @@ -39,9 +41,10 @@ def test_host_path_for_path_in_docker_linux(self):
assert result == "/home/some-user/.cache/localstack/volume/some/test/file"

def test_host_path_for_path_in_docker_linux_volume_dir(self):
with mock.patch(
"localstack.utils.docker_utils.get_default_volume_dir_mount"
) as get_volume, mock.patch("localstack.config.is_in_docker", True):
with (
mock.patch("localstack.utils.docker_utils.get_default_volume_dir_mount") as get_volume,
mock.patch("localstack.config.is_in_docker", True),
):
get_volume.return_value = VolumeInfo(
type="bind",
source="/home/some-user/.cache/localstack/volume",
Expand All @@ -55,9 +58,10 @@ def test_host_path_for_path_in_docker_linux_volume_dir(self):
assert result == "/home/some-user/.cache/localstack/volume"

def test_host_path_for_path_in_docker_linux_wrong_path(self):
with mock.patch(
"localstack.utils.docker_utils.get_default_volume_dir_mount"
) as get_volume, mock.patch("localstack.config.is_in_docker", True):
with (
mock.patch("localstack.utils.docker_utils.get_default_volume_dir_mount") as get_volume,
mock.patch("localstack.config.is_in_docker", True),
):
get_volume.return_value = VolumeInfo(
type="bind",
source="/home/some-user/.cache/localstack/volume",
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_s3.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import datetime
import os
import re
import zoneinfo
from io import BytesIO
from urllib.parse import urlparse

import pytest
import zoneinfo

from localstack.aws.api import RequestContext
from localstack.aws.api.s3 import InvalidArgument
Expand Down
Loading