Skip to content
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

build: Update Python requirement to 3.10 #445

Merged
merged 1 commit into from
Apr 17, 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
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8-bullseye
FROM python:3.10-bullseye

ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest"]
python-version: ["3.8"]
python-version: ["3.10"]

runs-on: ${{ matrix.os }}
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
build:
strategy:
matrix:
python-version: ["3.8"]
python-version: ["3.10"]

runs-on: ubuntu-latest
steps:
Expand All @@ -44,7 +44,7 @@ jobs:
needs: [build]
runs-on: ubuntu-latest
env:
PYTHON_VERSION: "3.8"
PYTHON_VERSION: "3.10"
steps:
- uses: actions/download-artifact@v3.0.2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
concurrency: bump-version
runs-on: ubuntu-latest
env:
PYTHON_VERSION: "3.8"
PYTHON_VERSION: "3.10"
outputs:
bumped: ${{ steps.cz-bump.outputs.bumped }}
revision: ${{ steps.cz-bump.outputs.revision }}
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
python: python3.8
python: python3.10

default_install_hook_types: [pre-commit, commit-msg]
default_stages: [commit]
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ python:
- requirements: requirements.txt

build:
os: ubuntu-20.04
os: ubuntu-22.04
tools:
python: "3.8"
python: "3.10"
apt_packages:
- "doxygen"
- "graphviz" # For dot graphs in doxygen
11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ classifiers = [
]
dependencies = [
"GitPython>=3.1.30",
'importlib_resources>=5.10.2;python_version<"3.9"',
"PyGithub>=1.58.1",
"sphinx>=5.3.0",
"breathe>=4.34.0",
Expand All @@ -34,7 +33,7 @@ dependencies = [
"pyyaml>=6.0",
"fastjsonschema>=2.16"
]
requires-python = ">=3.8"
requires-python = ">=3.10"

[project.urls]
repository="https://github.com/RadeonOpenCompute/rocm-docs-core"
Expand Down Expand Up @@ -65,7 +64,7 @@ where=["src"]
rocm_docs = ["data/**/*", "rocm_docs_theme/**/*", "py.typed"]

[tool.black]
target-version = ["py38"]
target-version = ["py310"]
line-length = 80
color = true

Expand All @@ -79,7 +78,7 @@ major_version_zero = true

[tool.isort]
# https://github.com/timothycrosley/isort/
py_version = 38
py_version = "310"
line_length = 100

known_typing = ["typing", "types", "typing_extensions", "mypy", "mypy_extensions"]
Expand All @@ -98,7 +97,7 @@ disallow_any_generics = true
disallow_incomplete_defs = true
implicit_reexport = false
pretty = true
python_version = 3.8
python_version = 3.10
show_column_numbers = true
show_error_codes = true
show_error_context = true
Expand All @@ -115,5 +114,5 @@ warn_unused_ignores = true
[tool.ruff]
select = ["ARG", "F", "E", "W", "N", "D", "UP", "RET"]
ignore = ["E501", "D203", "D213", "D4"]
target-version = "py38"
target-version = "py310"
line-length = 80
51 changes: 27 additions & 24 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --all-extras pyproject.toml
Expand Down Expand Up @@ -47,7 +47,7 @@ click-log==0.4.0
# via doxysphinx
colorama==0.4.6
# via commitizen
commitizen==3.9.0
commitizen==3.10.1
# via rocm-docs-core (pyproject.toml)
cryptography==41.0.4
# via pyjwt
Expand All @@ -63,7 +63,7 @@ docutils==0.19
# myst-parser
# pydata-sphinx-theme
# sphinx
doxysphinx==3.3.4
doxysphinx==3.3.6
# via rocm-docs-core (pyproject.toml)
fastjsonschema==2.18.1
# via rocm-docs-core (pyproject.toml)
Expand All @@ -80,11 +80,7 @@ idna==3.4
imagesize==1.4.1
# via sphinx
importlib-metadata==6.8.0
# via
# commitizen
# sphinx
importlib-resources==5.12.0 ; python_version < "3.9"
# via rocm-docs-core (pyproject.toml)
# via commitizen
isort==5.12.0
# via rocm-docs-core (pyproject.toml)
jinja2==3.1.2
Expand All @@ -108,7 +104,7 @@ mdurl==0.1.2
# via markdown-it-py
mpire==2.8.0
# via doxysphinx
mypy==1.5.1
mypy==1.6.0
# via rocm-docs-core (pyproject.toml)
mypy-extensions==1.0.0
# via
Expand All @@ -133,9 +129,9 @@ platformdirs==3.11.0
# via
# black
# virtualenv
pre-commit==3.4.0
pre-commit==3.5.0
# via rocm-docs-core (pyproject.toml)
prompt-toolkit==3.0.39
prompt-toolkit==3.0.36
# via questionary
pycparser==2.21
# via cffi
Expand All @@ -161,23 +157,25 @@ pyparsing==3.1.1
# via doxysphinx
pyproject-hooks==1.0.0
# via build
pytz==2023.3.post1
# via babel
python-dateutil==2.8.2
# via pygithub
pyyaml==6.0.1
# via
# commitizen
# myst-parser
# pre-commit
# rocm-docs-core (pyproject.toml)
# sphinx-external-toc
questionary==1.10.0
questionary==2.0.1
# via commitizen
requests==2.31.0
# via
# pygithub
# sphinx
ruff==0.0.292
# via rocm-docs-core (pyproject.toml)
six==1.16.0
# via python-dateutil
smmap==5.0.1
# via gitdb
snowballstemmer==2.2.0
Expand All @@ -195,6 +193,11 @@ sphinx==5.3.0
# sphinx-design
# sphinx-external-toc
# sphinx-notfound-page
# sphinxcontrib-applehelp
# sphinxcontrib-devhelp
# sphinxcontrib-htmlhelp
# sphinxcontrib-qthelp
# sphinxcontrib-serializinghtml
sphinx-book-theme==1.0.1
# via rocm-docs-core (pyproject.toml)
sphinx-copybutton==0.5.2
Expand All @@ -205,17 +208,17 @@ sphinx-external-toc==0.3.1
# via rocm-docs-core (pyproject.toml)
sphinx-notfound-page==1.0.0
# via rocm-docs-core (pyproject.toml)
sphinxcontrib-applehelp==1.0.4
sphinxcontrib-applehelp==1.0.7
# via sphinx
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-devhelp==1.0.5
# via sphinx
sphinxcontrib-htmlhelp==2.0.1
sphinxcontrib-htmlhelp==2.0.4
# via sphinx
sphinxcontrib-jsmath==1.0.1
# via sphinx
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-qthelp==1.0.6
# via sphinx
sphinxcontrib-serializinghtml==1.1.5
sphinxcontrib-serializinghtml==1.1.9
# via sphinx
termcolor==2.3.0
# via commitizen
Expand All @@ -233,11 +236,13 @@ tqdm==4.66.1
typing-extensions==4.8.0
# via
# black
# filelock
# mypy
# pydata-sphinx-theme
# pygithub
urllib3==2.0.6
# via requests
# via
# pygithub
# requests
virtualenv==20.24.5
# via pre-commit
wcwidth==0.2.8
Expand All @@ -247,9 +252,7 @@ wheel==0.41.2
wrapt==1.15.0
# via deprecated
zipp==3.17.0
# via
# importlib-metadata
# importlib-resources
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
14 changes: 7 additions & 7 deletions src/rocm_docs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
that are using Read the Docs.
"""

from typing import Dict, List, Optional, Union
from typing import TypeAlias

import os

from rocm_docs.core import setup

MaybePath = Union[str, os.PathLike, None]
MaybePath: TypeAlias = str | os.PathLike | None


# Intentionally disabling the too-many-instance-attributes check in pylint
Expand All @@ -33,17 +33,17 @@ class ROCmDocs:
def __init__(
self,
project_name: str,
_: Optional[str] = None,
_: str | None = None,
__: MaybePath = None,
) -> None:
"""Intialize ROCmDocs."""
self._project_name: str = project_name
self.extensions: List[str] = []
self.extensions: list[str] = []
self.html_title: str
self.html_theme: str
self.html_theme_options: Dict[str, Union[str, bool, List[str]]] = {}
self.html_theme_options: dict[str, str | (bool | list[str])] = {}
self.doxygen_root: MaybePath = None
self.doxygen_project: Dict[str, Union[Optional[str], MaybePath]] = {
self.doxygen_project: dict[str, str | None | MaybePath] = {
"name": None,
"path": None,
}
Expand All @@ -59,7 +59,7 @@ def run_doxygen(
self,
doxygen_root: MaybePath = None,
doxygen_path: MaybePath = None,
doxygen_file: Optional[str] = None,
doxygen_file: str | None = None,
) -> None:
"""Run doxygen as part of Sphinx by adding rocm_docs.doxygen."""
if "rocm_docs.doxygen" not in self.extensions:
Expand Down
20 changes: 7 additions & 13 deletions src/rocm_docs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,23 @@

from __future__ import annotations

from typing import Any, Dict, Generic, List, Set, TypeVar, cast
from typing import Any, Generic, TypeVar, cast

import importlib.resources
import inspect
import os
import sys
import urllib.parse
from abc import ABC, abstractmethod
from pathlib import Path

import bs4
import git.repo
from pydata_sphinx_theme.utils import config_provided_by_user # type: ignore[import]
from pydata_sphinx_theme.utils import config_provided_by_user # type: ignore[import-untyped]
from sphinx.application import Sphinx
from sphinx.config import Config

T = TypeVar("T")

# based on doxygen.py
if sys.version_info < (3, 9):
import importlib_resources
else:
import importlib.resources as importlib_resources


class _ConfigUpdater(Generic[T], ABC):
def __init__(self, default: T) -> None:
Expand All @@ -41,7 +35,7 @@ def __call__(self, key: str, app: Sphinx) -> None:
pass


class _ConfigExtend(_ConfigUpdater[List[T]]):
class _ConfigExtend(_ConfigUpdater[list[T]]):
def __call__(self, key: str, app: Sphinx) -> None:
getattr(app.config, key).extend(self.default)

Expand All @@ -52,12 +46,12 @@ def __call__(self, key: str, app: Sphinx) -> None:
setattr(app.config, key, self.default)


class _ConfigUnion(_ConfigUpdater[Set[T]]):
class _ConfigUnion(_ConfigUpdater[set[T]]):
def __call__(self, key: str, app: Sphinx) -> None:
getattr(app.config, key).update(self.default)


class _ConfigMerge(_ConfigUpdater[Dict[str, Any]]):
class _ConfigMerge(_ConfigUpdater[dict[str, Any]]):
def __call__(self, key: str, app: Sphinx) -> None:
current_setting: dict[str, Any] = getattr(app.config, key)
for item in self.default.items():
Expand Down Expand Up @@ -120,7 +114,7 @@ def _set_article_info(app: Sphinx, _: Config) -> None:
return

article_info = (
importlib_resources.files("rocm_docs")
importlib.resources.files("rocm_docs")
.joinpath("rocm_docs_theme/components/article-info.html")
.read_text(encoding="utf-8")
)
Expand Down
Loading