Skip to content

Commit 4179aaf

Browse files
authored
Packaging: drop python 3 8, add 3.13 support (#327)
Since: - Python 3.8 reached its end of life on 2024-10-07 - Python 3.13 has been released on 2024-10-07 See: https://devguide.python.org/versions/ Related to: #304 #286 #288
2 parents 6c9d981 + d8ceb47 commit 4179aaf

File tree

8 files changed

+27
-85
lines changed

8 files changed

+27
-85
lines changed

.github/workflows/lint-and-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
python-version:
25-
- "3.8"
2625
- "3.9"
2726
- "3.10"
2827
- "3.11"
2928
- "3.12"
29+
- "3.13"
3030

3131
# Steps represent a sequence of tasks that will be executed as part of the job
3232
steps:

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ repos:
3535
hooks:
3636
- id: pyupgrade
3737
args:
38-
- "--py38-plus"
38+
- "--py39-plus"
3939

4040
- repo: https://github.com/astral-sh/ruff-pre-commit
4141
rev: "v0.6.9"
4242
hooks:
4343
- id: ruff
4444
args:
4545
- --fix-only
46-
- --target-version=py38
46+
- --target-version=py39
4747

4848
- repo: https://github.com/pycqa/isort
4949
rev: 5.13.2
@@ -59,7 +59,7 @@ repos:
5959
hooks:
6060
- id: black
6161
args:
62-
- --target-version=py38
62+
- --target-version=py39
6363

6464
- repo: https://github.com/pycqa/flake8
6565
rev: 7.1.1

mkdocs_rss_plugin/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from email.utils import formatdate
1212
from pathlib import Path
1313
from re import compile as re_compile
14-
from typing import List, Literal, Optional
14+
from typing import Literal, Optional
1515

1616
# 3rd party
1717
from jinja2 import Environment, FileSystemLoader, select_autoescape
@@ -79,7 +79,7 @@ def on_startup(
7979
# flag used command to disable some actions if serve is used
8080
self.cmd_is_serve = command == "serve"
8181

82-
self.pages_to_filter: List[PageInformation] = []
82+
self.pages_to_filter: list[PageInformation] = []
8383
# prepare output feeds
8484
self.feed_created: dict = {}
8585
self.feed_updated: dict = {}

mkdocs_rss_plugin/timezoner_pre39.py

Lines changed: 0 additions & 56 deletions
This file was deleted.

mkdocs_rss_plugin/util.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66

77
# standard library
88
import logging
9-
import sys
109
from collections.abc import Iterable
1110
from datetime import date, datetime
1211
from email.utils import format_datetime
1312
from functools import lru_cache
1413
from mimetypes import guess_type
1514
from pathlib import Path
16-
from typing import Any, List, Tuple, Union
15+
from typing import Any, Union
1716
from urllib.parse import urlencode, urlparse, urlunparse
1817

1918
# 3rd party
@@ -46,12 +45,7 @@
4645
IntegrationMaterialSocialCards,
4746
)
4847
from mkdocs_rss_plugin.models import PageInformation
49-
50-
# conditional imports
51-
if sys.version_info < (3, 9):
52-
from mkdocs_rss_plugin.timezoner_pre39 import set_datetime_zoneinfo
53-
else:
54-
from mkdocs_rss_plugin.timezoner import set_datetime_zoneinfo
48+
from mkdocs_rss_plugin.timezoner import set_datetime_zoneinfo
5549

5650
# ############################################################################
5751
# ########## Globals #############
@@ -202,7 +196,7 @@ def get_file_dates(
202196
meta_datetime_format: str,
203197
meta_default_time: datetime,
204198
meta_default_timezone: str,
205-
) -> Tuple[datetime, datetime]:
199+
) -> tuple[datetime, datetime]:
206200
"""Extract creation and update dates from page metadata (yaml frontmatter) or
207201
git log for given file.
208202
@@ -358,7 +352,7 @@ def get_file_dates(
358352
get_build_datetime(),
359353
)
360354

361-
def get_authors_from_meta(self, in_page: Page) -> Optional[Tuple[str]]:
355+
def get_authors_from_meta(self, in_page: Page) -> Optional[tuple[str]]:
362356
"""Returns authors from page meta. It handles 'author' and 'authors' for keys, \
363357
str and iterable as values types.
364358
@@ -542,7 +536,7 @@ def get_description_or_abstract(
542536
)
543537
return ""
544538

545-
def get_image(self, in_page: Page, base_url: str) -> Optional[Tuple[str, str, int]]:
539+
def get_image(self, in_page: Page, base_url: str) -> Optional[tuple[str, str, int]]:
546540
"""Get page's image from page meta or social cards and returns properties.
547541
548542
Args:
@@ -782,7 +776,7 @@ def guess_locale(self, mkdocs_config: MkDocsConfig) -> Optional[str]:
782776
return None
783777

784778
@staticmethod
785-
def filter_pages(pages: List[PageInformation], attribute: str, length: int) -> list:
779+
def filter_pages(pages: list[PageInformation], attribute: str, length: int) -> list:
786780
"""Filter and return pages into a friendly RSS structure.
787781
788782
Args:

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# standard library
88
from pathlib import Path
9-
from typing import List, Union
9+
from typing import Union
1010

1111
# 3rd party
1212
from setuptools import find_packages, setup
@@ -26,7 +26,7 @@
2626
# ##################################
2727

2828

29-
def load_requirements(requirements_files: Union[Path, List[Path]]) -> list:
29+
def load_requirements(requirements_files: Union[Path, list[Path]]) -> list:
3030
"""Helper to load requirements list from a path or a list of paths.
3131
3232
Args:
@@ -79,7 +79,7 @@ def load_requirements(requirements_files: Union[Path, List[Path]]) -> list:
7979
# run
8080
entry_points={"mkdocs.plugins": ["rss = mkdocs_rss_plugin.plugin:GitRssPlugin"]},
8181
# dependencies
82-
python_requires=">=3.8, <4",
82+
python_requires=">=3.9, <4",
8383
extras_require={
8484
# tooling
8585
"dev": load_requirements(HERE / "requirements/development.txt"),
@@ -93,11 +93,11 @@ def load_requirements(requirements_files: Union[Path, List[Path]]) -> list:
9393
"Intended Audience :: Developers",
9494
"Intended Audience :: Information Technology",
9595
"Programming Language :: Python :: 3",
96-
"Programming Language :: Python :: 3.8",
9796
"Programming Language :: Python :: 3.9",
9897
"Programming Language :: Python :: 3.10",
9998
"Programming Language :: Python :: 3.11",
10099
"Programming Language :: Python :: 3.12",
100+
"Programming Language :: Python :: 3.13",
101101
"Programming Language :: Python :: Implementation :: CPython",
102102
"Development Status :: 5 - Production/Stable",
103103
"License :: OSI Approved :: MIT License",

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sonar.projectKey=Guts_mkdocs-rss-plugin
66
# only=main
77

88
# Python versions
9-
sonar.python.version=3.8, 3.9, 3.10, 3.11, 3.12
9+
sonar.python.version=3.9, 3.10, 3.11, 3.12, 3.13
1010

1111
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
1212
sonar.sources=mkdocs_rss_plugin

tests/test_build.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -755,16 +755,20 @@ def test_json_feed_validation(self):
755755
self.assertIsNone(cli_result.exception)
756756

757757
# created items
758-
with Path(tmpdirname).joinpath(OUTPUT_JSON_FEED_CREATED).open(
759-
"r", encoding="UTF-8"
760-
) as in_json:
758+
with (
759+
Path(tmpdirname)
760+
.joinpath(OUTPUT_JSON_FEED_CREATED)
761+
.open("r", encoding="UTF-8") as in_json
762+
):
761763
json_feed_created_data = json.load(in_json)
762764
jsonfeed.Feed.parse(json_feed_created_data)
763765

764766
# updated items
765-
with Path(tmpdirname).joinpath(OUTPUT_JSON_FEED_UPDATED).open(
766-
"r", encoding="UTF-8"
767-
) as in_json:
767+
with (
768+
Path(tmpdirname)
769+
.joinpath(OUTPUT_JSON_FEED_UPDATED)
770+
.open("r", encoding="UTF-8") as in_json
771+
):
768772
json_feed_updated_data = json.load(in_json)
769773
jsonfeed.Feed.parse(json_feed_updated_data)
770774

0 commit comments

Comments
 (0)