Skip to content

Commit

Permalink
Removes support for python 3.8/3.9 (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysyngsun authored Feb 26, 2025
1 parent 5ed96d5 commit f669077
Show file tree
Hide file tree
Showing 54 changed files with 726 additions and 466 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ on: [push, workflow_dispatch]

jobs:
tests:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
# - "3.12"
- "3.12"

# Service containers to run
services:
Expand Down Expand Up @@ -65,7 +63,7 @@ jobs:

release:
needs: tests
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"filename": ".github/workflows/ci.yml",
"hashed_secret": "afc848c316af1a89d49826c5ae9d00ed769415f3",
"is_verified": false,
"line_number": 22
"line_number": 20
}
],
"docker-compose.yml": [
Expand Down Expand Up @@ -319,5 +319,5 @@
}
]
},
"generated_at": "2025-02-19T14:11:34Z"
"generated_at": "2025-02-25T16:15:37Z"
}
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies = [
"mitol-django-transcoding",
]
readme = "README.md"
requires-python = ">= 3.8"
requires-python = ">= 3.10"

[build-system]
requires = ["hatchling"]
Expand All @@ -42,7 +42,7 @@ dev-dependencies = [
"django-stubs[compatible-mypy]",
"factory-boy~=3.2",
"faker>=4.17.1",
"freezegun==1.0.0",
"freezegun>=1.5.1",
"ipdb",
"mypy",
"mypy-extensions",
Expand All @@ -66,6 +66,9 @@ allow-direct-references = true
[tool.uv.workspace]
members = ["src/*"]

[tool.uv.pip]
no-binary = ["lxml", "xmlsec"]

[tool.uv.sources]
mitol-django-common = { workspace = true }
mitol-django-mail = { workspace = true }
Expand Down Expand Up @@ -125,7 +128,7 @@ module = [


[tool.ruff]
target-version = "py38"
target-version = "py310"
line-length = 88
lint.select = [
"A", # flake8-builtins
Expand Down
9 changes: 5 additions & 4 deletions scripts/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from contextlib import contextmanager
from functools import cached_property
from pathlib import Path
from typing import List

import toml

Expand All @@ -20,16 +19,18 @@ def get_app_dir(path: str) -> Path:
return get_source_dir() / path


def list_apps() -> List[Path]: # noqa: FA100
def list_apps() -> list[Path]:
"""List the apps in the repo"""
return sorted(
dir_path
for dir_path in get_source_dir().iterdir()
if dir_path.is_dir() and (dir_path / "pyproject.toml").exists()
if dir_path.is_dir()
and (dir_path / "pyproject.toml").exists()
and dir_path.stem != "uvtestapp"
)


def list_app_names() -> List[str]: # noqa: FA100
def list_app_names() -> list[str]:
"""List the app names"""
return [name.stem for name in list_apps()]

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!--
a new scriv changelog fragment.
uncomment the section that is right (remove the html comment wrapper).
-->

### removed

- support for python 3.8 and 3.9.

### added



<!--
### changed
- a bullet item for the changed category.
-->
<!--
### deprecated
- a bullet item for the deprecated category.
-->
<!--
### fixed
- a bullet item for the fixed category.
-->
<!--
### security
- a bullet item for the security category.
-->
2 changes: 1 addition & 1 deletion src/authentication/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies = [
]
readme = "README.md"
license = "BSD-3-Clause"
requires-python = ">=3.8"
requires-python = ">=3.10"

[tool.bumpver]
current_version = "2025.2.12"
Expand Down
38 changes: 38 additions & 0 deletions src/common/changelog.d/20250224_175200_nlevesq_drop_py38_py39.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!--
a new scriv changelog fragment.
uncomment the section that is right (remove the html comment wrapper).
-->

### removed

- support for python 3.8 and 3.9.

### added



<!--
### changed
- a bullet item for the changed category.
-->
<!--
### deprecated
- a bullet item for the deprecated category.
-->
<!--
### fixed
- a bullet item for the fixed category.
-->
<!--
### security
- a bullet item for the security category.
-->
3 changes: 1 addition & 2 deletions src/common/mitol/common/apps.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Common app AppConfigs"""

import os
from typing import List

from django.apps import AppConfig
from django.conf import settings
Expand All @@ -11,7 +10,7 @@
class BaseApp(AppConfig):
"""Base application class"""

required_settings: List[str] = [] # noqa: FA100
required_settings: list[str] = []

def validate_required_settings(self):
"""
Expand Down
9 changes: 5 additions & 4 deletions src/common/mitol/common/decorators.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import functools
import random
from collections.abc import Callable
from functools import wraps
from typing import Callable, Optional
from typing import Optional

from django.utils.cache import get_max_age, patch_cache_control
from django_redis import get_redis_connection
Expand Down Expand Up @@ -37,9 +38,9 @@ def _cache_controlled(request, *args, **kw):

def single_task(
timeout: int,
raise_block: Optional[bool] = True, # noqa: FBT002, FA100
key: Optional[str or Callable[[str, P.args, P.kwargs], str]] = None, # noqa: FA100
cache_name: Optional[str] = "redis", # noqa: FA100
raise_block: Optional[bool] = True, # noqa: FBT002
key: Optional[str or Callable[[str, P.args, P.kwargs], str]] = None,
cache_name: Optional[str] = "redis",
) -> Callable:
"""
Only allow one instance of a celery task to run concurrently
Expand Down
19 changes: 10 additions & 9 deletions src/common/mitol/common/envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
import json
import os
from ast import literal_eval
from collections.abc import Callable
from functools import wraps
from typing import Any, Callable, Dict, List, NamedTuple, Union
from typing import Any, NamedTuple, Union

from django.core.exceptions import ImproperlyConfigured

Expand Down Expand Up @@ -165,9 +166,9 @@ def parse_str(name: str, value: str, default: str): # noqa: ARG001

def parse_list_literal(
name: str,
value: Union[str, List[Any]], # noqa: FA100
default: List[Any], # noqa: FA100, ARG001
) -> List[str]: # noqa: FA100
value: Union[str, list[Any]],
default: list[Any], # noqa: ARG001
) -> list[str]:
"""
Parses a comma separated string into a list
Expand Down Expand Up @@ -267,9 +268,9 @@ def parse_crontab_kwargs(name, value, default): # noqa: ARG001
class EnvParser:
"""Stateful tracker for environment variable parsing"""

_env: Dict[str, str] # noqa: FA100
_configured_vars: Dict[str, EnvVariable] # noqa: FA100
_imported_modules: List[str] # noqa: FA100
_env: dict[str, str]
_configured_vars: dict[str, EnvVariable]
_imported_modules: list[str]

def __init__(self):
self.reset()
Expand Down Expand Up @@ -314,7 +315,7 @@ def validate(self):
)
)

def list_environment_vars(self) -> List[EnvVariable]: # noqa: FA100
def list_environment_vars(self) -> list[EnvVariable]:
"""
Get the list of EnvVariables
Expand All @@ -324,7 +325,7 @@ def list_environment_vars(self) -> List[EnvVariable]: # noqa: FA100
"""
return self._configured_vars.values()

def get_features(self, prefix: str = "FEATURE_") -> Dict[str, bool]: # noqa: FA100
def get_features(self, prefix: str = "FEATURE_") -> dict[str, bool]:
"""
Get the list of features enabled for this app
Expand Down
9 changes: 5 additions & 4 deletions src/common/mitol/common/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"""

import copy
from typing import Dict, Iterable, List, Type, TypeVar, Union
from collections.abc import Iterable
from typing import TypeVar, Union

from django.conf import settings
from django.core.exceptions import ValidationError
Expand Down Expand Up @@ -161,7 +162,7 @@ class Meta:
def _items_for_class(
content_type_field: str,
items: Iterable[_ModelClass],
model_cls: Type[_ModelClass], # noqa: FA100
model_cls: type[_ModelClass],
) -> Iterable[_ModelClass]:
"""Returns a list of items that matches a class by content_type""" # noqa: D401
return [
Expand All @@ -182,8 +183,8 @@ def __init__(self, *args, **kwargs):
def prefetch_generic_related(
self,
content_type_field: str,
model_lookups: Dict[ # noqa: FA100
Union[List[Type[_ModelClass]], Type[_ModelClass]], List[str] # noqa: FA100
model_lookups: dict[
Union[list[type[_ModelClass]], type[_ModelClass]], list[str]
],
) -> _PrefetchGenericQuerySet:
"""
Expand Down
2 changes: 1 addition & 1 deletion src/common/mitol/common/pytest_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MockResponse:
def __init__(
self, content, status_code=200, content_type="application/json", url=None
):
if isinstance(content, (dict, list)):
if isinstance(content, dict | list):
self.content = json.dumps(content)
else:
self.content = str(content)
Expand Down
5 changes: 3 additions & 2 deletions src/common/mitol/common/templatetags/render_bundle.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Templatetags for rendering webpack bundle script tags""" # noqa: INP001

from collections.abc import Iterator
from os import path
from typing import Any, Dict, Iterator
from typing import Any

from django import template
from django.conf import settings
Expand Down Expand Up @@ -35,7 +36,7 @@ def _get_bundle(request: HttpRequest, bundle_name: str) -> Iterator[dict]:

@register.simple_tag(takes_context=True)
def render_bundle(
context: Dict[str, Any], # noqa: FA100
context: dict[str, Any],
bundle_name: str,
added_attrs: str = "",
) -> SafeText:
Expand Down
4 changes: 1 addition & 3 deletions src/common/mitol/common/utils/config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from typing import List

from django.conf import settings


def get_missing_settings(required_settings: List[str]) -> List[str]: # noqa: FA100
def get_missing_settings(required_settings: list[str]) -> list[str]:
"""Return a list of settings that are missing"""
return [
variable
Expand Down
2 changes: 1 addition & 1 deletion src/common/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies = [
]
readme = "README.md"
license = "BSD-3-Clause"
requires-python = ">=3.8"
requires-python = ">=3.10"

[tool.bumpver]
current_version = "2023.12.19"
Expand Down
Loading

0 comments on commit f669077

Please sign in to comment.