Skip to content

Commit

Permalink
⬆️ Drop Python 3.8 and Sphinx 6
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Nov 28, 2024
1 parent 3f92911 commit c5acec6
Show file tree
Hide file tree
Showing 41 changed files with 125 additions and 95 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.9'
- uses: pre-commit/[email protected]

tests-core:
Expand All @@ -23,17 +23,18 @@ jobs:
fail-fast: false # Set on "false" to get the results of ALL builds
matrix:
os: ["ubuntu-latest"]
# 3.9.8 seems to be broken with type_ast
# https://www.mail-archive.com/[email protected]/msg1829077.html
python-version: ["3.8", "3.11"]
sphinx-version: ["6.0", "7.0"]
python-version: ["3.10", "3.12"]
sphinx-version: ["7.0", "8.0"]
include:
- os: "ubuntu-latest"
python-version: "3.10"
sphinx-version: "8.0"
python-version: "3.9"
sphinx-version: "7.0"
- os: "windows-latest"
python-version: "3.9"
sphinx-version: "7.0"
- os: "windows-latest"
python-version: "3.8"
sphinx-version: "6.0"
python-version: "3.12"
sphinx-version: "8.0"
steps:
- uses: actions/checkout@v4
- name: Install graphviz (linux)
Expand Down Expand Up @@ -73,10 +74,10 @@ jobs:
matrix:
include:
- os: "ubuntu-latest"
python-version: "3.8"
sphinx-version: "6.0"
python-version: "3.9"
sphinx-version: "7.0"
- os: "ubuntu-latest"
python-version: "3.11"
python-version: "3.12"
sphinx-version: "8.0"
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ mem_out.*

pyinstrument*
*.prof

uv.lock
14 changes: 10 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,31 @@ repos:
- id: taplo-format

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.0
rev: v0.8.0
hooks:
- id: ruff
args: [--fix]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.12.1
rev: v1.13.0
hooks:
- id: mypy
files: sphinx_needs/.*
args: []
additional_dependencies:
- sphinx==6.2.1
- docutils==0.19
- sphinx==7.4.7
- docutils==0.20
- types-docutils==0.20.0.20240201
- types-jsonschema
- types-requests

# TODO this does not work on pre-commit.ci
# - repo: https://github.com/astral-sh/uv-pre-commit
# rev: 0.5.5
# hooks:
# - id: uv-lock # Update the uv lockfile

- repo: local
hooks:
- id: check-readme
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import datetime
import os
from pathlib import Path
from typing import Any, Dict
from typing import Any

from sphinx_needs import __version__

Expand Down Expand Up @@ -222,7 +222,7 @@
"manual",
),
]
latex_elements: Dict[str, Any] = {
latex_elements: dict[str, Any] = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ classifiers = [
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'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',
'Topic :: Documentation',
'Topic :: Utilities',
'Framework :: Sphinx :: Extension',
]
requires-python = ">=3.8,<4"
requires-python = ">=3.9,<4"
dependencies = [
"sphinx>=6.0,<9",
"sphinx>=7.0,<9",
"requests-file~=2.1", # external links
"requests~=2.32", # external links
"jsonschema>=3.2.0", # needsimport schema validation
Expand Down Expand Up @@ -141,12 +141,12 @@ disable_error_code = ["no-redef"]

legacy_tox_ini = """
[tox]
envlist = py38
envlist = py39
[testenv]
usedevelop = true
[testenv:py{38,39,310,311,312}]
[testenv:py{39,310,311,312,313}]
extras =
test
test-parallel
Expand Down
4 changes: 2 additions & 2 deletions sphinx_needs/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
from .need import add_external_need, add_need, del_need, generate_need, get_needs_view

__all__ = (
"InvalidNeedException",
"add_dynamic_function",
"add_extra_option",
"add_external_need",
"add_extra_option",
"add_need",
"InvalidNeedException",
"add_need_type",
"del_need",
"generate_need",
Expand Down
3 changes: 2 additions & 1 deletion sphinx_needs/api/need.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import os
import re
import warnings
from collections.abc import Iterable, Iterator
from contextlib import contextmanager
from pathlib import Path
from typing import Any, Iterable, Iterator
from typing import Any

from docutils import nodes
from docutils.parsers.rst.states import RSTState
Expand Down
8 changes: 4 additions & 4 deletions sphinx_needs/builder.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import os
from typing import Iterable, Sequence
from collections.abc import Iterable, Sequence

from docutils import nodes
from sphinx.application import Sphinx
Expand Down Expand Up @@ -37,7 +37,7 @@ def get_outdated_docs(self) -> Iterable[str]:

def write(
self,
build_docnames: Iterable[str],
build_docnames: Iterable[str] | None,
updated_docnames: Sequence[str],
method: str = "update",
) -> None:
Expand Down Expand Up @@ -143,7 +143,7 @@ def get_outdated_docs(self) -> Iterable[str]:

def write(
self,
build_docnames: Iterable[str],
build_docnames: Iterable[str] | None,
updated_docnames: Sequence[str],
method: str = "update",
) -> None:
Expand Down Expand Up @@ -254,6 +254,6 @@ def build_needumls_pumls(app: Sphinx, _exception: Exception) -> None:

# if other builder like html used together with config: needs_build_needumls
needs_builder = NeedumlsBuilder(app, env)
needs_builder.outdir = os.path.join(needs_builder.outdir, config.build_needumls)
needs_builder.outdir = os.path.join(needs_builder.outdir, config.build_needumls) # type: ignore[assignment]

needs_builder.finish()
5 changes: 3 additions & 2 deletions sphinx_needs/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import annotations

from collections.abc import Mapping
from dataclasses import MISSING, dataclass, field, fields
from typing import TYPE_CHECKING, Any, Callable, Dict, Literal, Mapping, TypedDict
from typing import TYPE_CHECKING, Any, Callable, Literal, TypedDict

from docutils.parsers.rst import directives
from sphinx.application import Sphinx
Expand Down Expand Up @@ -174,7 +175,7 @@ class ExternalSource(TypedDict, total=False):
"""Added as the `external_css` field for each need item (optional)"""


GlobalOptionsType = Dict[str, Any]
GlobalOptionsType = dict[str, Any]
"""Default values given to specified fields of needs
Values can be:
Expand Down
5 changes: 2 additions & 3 deletions sphinx_needs/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

from __future__ import annotations

from collections.abc import Mapping
from typing import (
TYPE_CHECKING,
Any,
Dict,
Final,
Literal,
Mapping,
NewType,
TypedDict,
)
Expand Down Expand Up @@ -717,7 +716,7 @@ class NeedsUmlType(NeedsBaseDataType):
"""Time taken to process the diagram."""


NeedsMutable = NewType("NeedsMutable", Dict[str, NeedsInfoType])
NeedsMutable = NewType("NeedsMutable", dict[str, NeedsInfoType])
"""A mutable view of the needs, before resolution
"""

Expand Down
3 changes: 2 additions & 1 deletion sphinx_needs/directives/list2need.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import hashlib
import re
from collections.abc import Sequence
from contextlib import suppress
from typing import Any, Sequence
from typing import Any

from docutils import nodes
from docutils.parsers.rst import directives
Expand Down
3 changes: 2 additions & 1 deletion sphinx_needs/directives/need.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import annotations

import re
from typing import Any, Sequence
from collections.abc import Sequence
from typing import Any

from docutils import nodes
from sphinx.addnodes import desc_name, desc_signature
Expand Down
2 changes: 1 addition & 1 deletion sphinx_needs/directives/needbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import hashlib
import math
from typing import Sequence
from collections.abc import Sequence

from docutils import nodes
from docutils.parsers.rst import directives
Expand Down
3 changes: 2 additions & 1 deletion sphinx_needs/directives/needextend.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import annotations

import re
from typing import Any, Callable, Sequence
from collections.abc import Sequence
from typing import Any, Callable

from docutils import nodes
from docutils.parsers.rst import directives
Expand Down
2 changes: 1 addition & 1 deletion sphinx_needs/directives/needextract.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import re
from typing import Sequence
from collections.abc import Sequence

from docutils import nodes
from docutils.parsers.rst import directives
Expand Down
4 changes: 2 additions & 2 deletions sphinx_needs/directives/needflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
__all__ = (
"NeedflowDirective",
"NeedflowGraphiz",
"process_needflow_graphviz",
"NeedflowPlantuml",
"html_visit_needflow_graphviz",
"process_needflow_graphviz",
"process_needflow_plantuml",
"NeedflowPlantuml",
)
3 changes: 2 additions & 1 deletion sphinx_needs/directives/needflow/_directive.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from typing import TYPE_CHECKING, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING

from docutils import nodes
from docutils.parsers.rst import directives
Expand Down
4 changes: 2 additions & 2 deletions sphinx_needs/directives/needflow/_graphviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import html
import textwrap
from functools import lru_cache
from functools import cache
from typing import Callable, Literal, TypedDict
from urllib.parse import urlparse

Expand Down Expand Up @@ -476,7 +476,7 @@ def _render_edge(
return f"{start_id} -> {end_id} [{param_str}];\n"


@lru_cache(maxsize=None)
@cache
def _style_params_from_link_type(
styles: str, style_start: str, style_end: str
) -> list[tuple[str, str]]:
Expand Down
2 changes: 1 addition & 1 deletion sphinx_needs/directives/needgantt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import os
import re
from collections.abc import Sequence
from datetime import datetime
from typing import Sequence

from docutils import nodes
from docutils.parsers.rst import directives
Expand Down
2 changes: 1 addition & 1 deletion sphinx_needs/directives/needimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
import os
import re
from typing import Sequence
from collections.abc import Sequence
from urllib.parse import urlparse

import requests
Expand Down
2 changes: 1 addition & 1 deletion sphinx_needs/directives/needlist.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Sequence
from collections.abc import Sequence

from docutils import nodes
from docutils.parsers.rst import directives
Expand Down
2 changes: 1 addition & 1 deletion sphinx_needs/directives/needpie.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import hashlib
from typing import Iterable, Sequence
from collections.abc import Iterable, Sequence

from docutils import nodes
from docutils.parsers.rst import directives
Expand Down
2 changes: 1 addition & 1 deletion sphinx_needs/directives/needreport.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from collections.abc import Sequence
from pathlib import Path
from typing import Sequence

from docutils import nodes
from docutils.parsers.rst import directives
Expand Down
3 changes: 2 additions & 1 deletion sphinx_needs/directives/needsequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import os
import re
from typing import Any, Sequence
from collections.abc import Sequence
from typing import Any

from docutils import nodes
from docutils.parsers.rst import directives
Expand Down
Loading

0 comments on commit c5acec6

Please sign in to comment.