From a31057b96d0392a6da581c607e40e534df9ce9d0 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Fri, 5 Jan 2024 13:40:06 -0500 Subject: [PATCH] Fix the fromutctimestamp warning on 3.12. Drop old versions, as generally we build docs using a recent version. --- noxfile.py | 2 +- pyproject.toml | 5 +---- sphinx_json_schema_spec/__init__.py | 10 +++------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/noxfile.py b/noxfile.py index b8faca4..a7961d1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -21,7 +21,7 @@ def _session(fn): return _session -@session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3"]) +@session(python=["3.11", "3.12"]) def tests(session): session.install("pytest", ROOT) session.run("pytest", *session.posargs, PACKAGE) diff --git a/pyproject.toml b/pyproject.toml index 24ee867..de820b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ name = "sphinx_json_schema_spec" description = "Sphinx support for the JSON Schema specifications" readme = "README.rst" license = {text = "MIT"} -requires-python = ">=3.8" +requires-python = ">=3.11" keywords = ["json schema", "jsonschema", "data validation", "sphinx", "json"] authors = [ {email = "Julian+sphinx-json-schema-spec@GrayVines.com"}, @@ -22,9 +22,6 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", diff --git a/sphinx_json_schema_spec/__init__.py b/sphinx_json_schema_spec/__init__.py index fa7acf7..fe4bcd9 100644 --- a/sphinx_json_schema_spec/__init__.py +++ b/sphinx_json_schema_spec/__init__.py @@ -2,17 +2,13 @@ Sphinx support for interlinking to the JSON Schema specifications. """ from contextlib import suppress -from datetime import datetime +from datetime import UTC, datetime +from importlib import metadata from pathlib import Path from urllib.parse import urljoin import ssl import urllib.request -try: - from importlib import metadata -except ImportError: - import importlib_metadata as metadata # type: ignore - from docutils import nodes from lxml import html @@ -76,7 +72,7 @@ def fetch_or_load(cache_path, url): headers = {"User-Agent": f"sphinx-json-schema-spec v{version}"} with suppress(FileNotFoundError): - modified = datetime.utcfromtimestamp(cache_path.stat().st_mtime) + modified = datetime.fromtimestamp(cache_path.stat().st_mtime, UTC) date = modified.strftime("%a, %d %b %Y %I:%M:%S UTC") headers["If-Modified-Since"] = date