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

Drop support for Python 3.8 #747

Merged
merged 2 commits into from
Oct 11, 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: 0 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ jobs:
py: 3.10.13
- os: ubuntu-latest
py: 3.9.18
- os: ubuntu-latest
py: 3.8.18
runs-on: ${{ matrix.os }}
steps:
- uses: mhils/workflows/checkout@v11
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## Unreleased: pdoc next

- Remove support for Python 3.8, which has reached end-of-life on 2024-10-07 .
([#747](https://github.com/mitmproxy/pdoc/pull/747), @mhils)

## 2024-09-11: pdoc 14.7.0

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ API Documentation for Python Projects.
pip install pdoc
```

pdoc is compatible with Python 3.8 and newer.
pdoc is compatible with Python 3.9 and newer.


# Usage
Expand Down
12 changes: 7 additions & 5 deletions pdoc/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,13 @@ def mock_some_common_side_effects():

Note that this function must not be used for security purposes, it's easily bypassable.
"""
with patch("subprocess.Popen", new=_PdocDefusedPopen), patch(
"os.startfile", new=_noop, create=True
), patch("sys.stdout", new=io.StringIO()), patch(
"sys.stderr", new=io.StringIO()
), patch("sys.stdin", new=io.StringIO()):
with (
patch("subprocess.Popen", new=_PdocDefusedPopen),
patch("os.startfile", new=_noop, create=True),
patch("sys.stdout", new=io.StringIO()),
patch("sys.stderr", new=io.StringIO()),
patch("sys.stdin", new=io.StringIO()),
):
yield


Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "pdoc"
description = "API Documentation for Python Projects"
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.9"
license = { text="MIT-0" }
authors = [{name = "Maximilian Hils", email = "pdoc@maximilianhils.com"}]
dynamic = ["version"]
Expand All @@ -11,7 +11,6 @@ dependencies = [
"Jinja2 >= 2.11.0",
"pygments >= 2.12.0",
"MarkupSafe >= 1.1.1",
"astunparse; python_version<'3.9'",
]

classifiers = [
Expand All @@ -23,7 +22,6 @@ classifiers = [
"Environment :: Console",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down
1 change: 0 additions & 1 deletion test/test_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ def outfile(self, format: str) -> Path:
with_output_directory=True,
),
Snapshot("misc"),
Snapshot("misc_py39", min_version=(3, 9)),
Snapshot("misc_py310", min_version=(3, 10)),
Snapshot("misc_py312", min_version=(3, 12)),
Snapshot("misc_py313", min_version=(3, 13)),
Expand Down
1,508 changes: 853 additions & 655 deletions test/testdata/misc.html

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions test/testdata/misc.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import abc
from ctypes import Structure
from dataclasses import dataclass
import functools
from functools import cached_property
from functools import lru_cache
import sched
from typing import Generic
from typing import TypeVar
from typing import Union

# https://github.com/mitmproxy/pdoc/issues/226

Expand Down Expand Up @@ -432,6 +436,41 @@ def __new__(cls, *args, **kwargs):
"""This is a class with a docstring inferred from `__new__`."""






class SingleDispatchMethodExample:
@functools.singledispatchmethod
def fancymethod(self, str_or_int: Union[str, int]):
"""A fancy method which is capable of handling either `str` or `int`.

:param str_or_int: string or integer to handle
"""
raise NotImplementedError(f"{type(str_or_int)=} not implemented!")

@fancymethod.register
def fancymethod_handle_str(self, str_to_handle: str):
"""Fancy method handles a string.

:param str_to_handle: string which will be handled
"""
print(f"{type(str_to_handle)} = '{str_to_handle}")

@fancymethod.register
def _fancymethod_handle_int(self, int_to_handle: int):
"""Fancy method handles int (not shown in doc).

:param int_to_handle: int which will be handled
"""
print(f"{type(int_to_handle)} = '{int_to_handle:x}'")


@dataclass(init=False)
class DataclassStructure(Structure):
"""DataclassStructure raises for `inspect.signature`."""


__all__ = [
"Issue226",
"var_with_default_obj",
Expand Down Expand Up @@ -472,4 +511,6 @@ def __new__(cls, *args, **kwargs):
"dynamically_modify_docstring3",
"dynamically_modify_docstring4",
"DocstringFromNew",
"SingleDispatchMethodExample",
"DataclassStructure",
]
8 changes: 8 additions & 0 deletions test/testdata/misc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,12 @@
<class misc.DocstringFromNew
<method def __init__(cls, *args, **kwargs): ... # This is a class with…>
>
<class misc.SingleDispatchMethodExample
<method def __init__(): ...>
<@functools.singledispatchmethod method def fancymethod(self, str_or_int: Union[str, int]): ... # A fancy method which…>
<@fancymethod.register method def fancymethod_handle_str(self, str_to_handle: str): ... # Fancy method handles…>
>
<@dataclass(init=False) class misc.DataclassStructure # DataclassStructure r…
<method def __init__(self, /, *args, **kwargs): ... # inherited from _ctypes.Structure.__init__>
>
>
253 changes: 0 additions & 253 deletions test/testdata/misc_py39.html

This file was deleted.

41 changes: 0 additions & 41 deletions test/testdata/misc_py39.py

This file was deleted.

10 changes: 0 additions & 10 deletions test/testdata/misc_py39.txt

This file was deleted.

Loading