Skip to content

Commit 0d39665

Browse files
committed
build: Drop Python 3.6 support
1 parent 4345f38 commit 0d39665

9 files changed

Lines changed: 34 additions & 59 deletions

File tree

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: 0.7.2
2+
_commit: 0.8.1
33
_src_path: gh:pawamoy/copier-pdm
44
author_email: pawamoy@pm.me
55
author_fullname: "Timoth\xE9e Mazzucotelli"

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ jobs:
7373
- macos-latest
7474
- windows-latest
7575
python-version:
76-
- "3.6"
7776
- "3.7"
7877
- "3.8"
7978
- "3.9"

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Load Python objects documentation.
1111

1212
## Requirements
1313

14-
`pytkdocs` requires Python 3.6 or above.
14+
pytkdocs requires Python 3.7 or above.
1515

1616
<details>
17-
<summary>To install Python 3.6, I recommend using <a href="https://github.com/pyenv/pyenv"><code>pyenv</code></a>.</summary>
17+
<summary>To install Python 3.7, I recommend using <a href="https://github.com/pyenv/pyenv"><code>pyenv</code></a>.</summary>
1818

1919
```bash
2020
# install pyenv
@@ -25,26 +25,25 @@ export PATH="${HOME}/.pyenv/bin:${PATH}"
2525
export PYENV_ROOT="${HOME}/.pyenv"
2626
eval "$(pyenv init -)"
2727

28-
# install Python 3.6
29-
pyenv install 3.6.12
28+
# install Python 3.7
29+
pyenv install 3.7.12
3030

3131
# make it available globally
32-
pyenv global system 3.6.12
32+
pyenv global system 3.7.12
3333
```
3434
</details>
3535

3636
## Installation
3737

3838
With `pip`:
3939
```bash
40-
python3.6 -m pip install pytkdocs
40+
pip install pytkdocs
4141
```
4242

4343
With [`pipx`](https://github.com/pipxproject/pipx):
4444
```bash
45-
python3.6 -m pip install --user pipx
46-
47-
pipx install --python python3.6 pytkdocs
45+
python3.7 -m pip install --user pipx
46+
pipx install pytkdocs
4847
```
4948

5049
With `conda`:

config/mypy.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
[mypy]
22
ignore_missing_imports = true
33
exclude = tests/fixtures/
4+
warn_unused_ignores = false
5+
show_error_codes = true

docs/gen_ref_nav.py

100644100755
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,21 @@
88

99
for path in sorted(Path("src").glob("**/*.py")):
1010
module_path = path.relative_to("src").with_suffix("")
11-
doc_path = path.relative_to("src", "pytkdocs").with_suffix(".md")
11+
doc_path = path.relative_to("src").with_suffix(".md")
1212
full_doc_path = Path("reference", doc_path)
1313

1414
parts = list(module_path.parts)
15-
parts[-1] = f"{parts[-1]}.py"
16-
nav[parts] = doc_path
15+
if parts[-1] == "__init__":
16+
parts = parts[:-1]
17+
doc_path = doc_path.with_name("index.md")
18+
full_doc_path = full_doc_path.with_name("index.md")
19+
elif parts[-1] == "__main__":
20+
continue
21+
nav_parts = list(parts)
22+
nav[nav_parts] = doc_path
1723

1824
with mkdocs_gen_files.open(full_doc_path, "w") as fd:
19-
ident = ".".join(module_path.parts)
25+
ident = ".".join(parts)
2026
print("::: " + ident, file=fd)
2127

2228
mkdocs_gen_files.set_edit_path(full_doc_path, path)

duties.py

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import sys
77
import tempfile
88
from contextlib import suppress
9-
from functools import wraps
109
from io import StringIO
1110
from pathlib import Path
1211
from typing import List, Optional, Pattern
@@ -174,43 +173,17 @@ def safety(): # noqa: WPS430
174173
ctx.run(safety, title="Checking dependencies")
175174

176175

177-
def no_docs_py36(nofail=True):
178-
"""
179-
Decorate a duty that builds docs to warn that it's not possible on Python 3.6.
180-
181-
Arguments:
182-
nofail: Whether to fail or not.
183-
184-
Returns:
185-
The decorated function.
186-
"""
187-
188-
def decorator(func):
189-
@wraps(func)
190-
def wrapper(ctx):
191-
if sys.version_info <= (3, 7, 0):
192-
ctx.run(["false"], title="Docs can't be built on Python 3.6", nofail=nofail, quiet=True)
193-
else:
194-
func(ctx)
195-
196-
return wrapper
197-
198-
return decorator
199-
200-
201176
@duty
202-
@no_docs_py36()
203-
def check_docs(ctx, strict: bool = False):
177+
def check_docs(ctx):
204178
"""
205179
Check if the documentation builds correctly.
206180
207181
Arguments:
208182
ctx: The context instance (passed automatically).
209-
strict: Whether to build with MkDocs' struct mode.
210183
"""
211184
Path("htmlcov").mkdir(parents=True, exist_ok=True)
212185
Path("htmlcov/index.html").touch(exist_ok=True)
213-
ctx.run(f"mkdocs build{' -s' if strict else ''}", title="Building documentation", pty=PTY)
186+
ctx.run("mkdocs build", title="Building documentation", pty=PTY)
214187

215188

216189
@duty # noqa: WPS231
@@ -288,7 +261,6 @@ def clean(ctx):
288261

289262

290263
@duty
291-
@no_docs_py36(nofail=False)
292264
def docs(ctx):
293265
"""
294266
Build the documentation locally.
@@ -300,7 +272,6 @@ def docs(ctx):
300272

301273

302274
@duty
303-
@no_docs_py36(nofail=False)
304275
def docs_serve(ctx, host="127.0.0.1", port=8000):
305276
"""
306277
Serve the documentation (localhost:8000).
@@ -314,7 +285,6 @@ def docs_serve(ctx, host="127.0.0.1", port=8000):
314285

315286

316287
@duty
317-
@no_docs_py36(nofail=False)
318288
def docs_deploy(ctx):
319289
"""
320290
Deploy the documentation on GitHub pages.

pyproject.toml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description = "Load Python objects documentation."
88
authors = [{name = "Timothée Mazzucotelli", email = "pawamoy@pm.me"}]
99
license = {file = "LICENSE"}
1010
readme = "README.md"
11-
requires-python = ">=3.6.2"
11+
requires-python = ">=3.7"
1212
keywords = ["python", "source", "signature", "docs"]
1313
dynamic = ["version"]
1414
classifiers = [
@@ -18,7 +18,6 @@ classifiers = [
1818
"Programming Language :: Python",
1919
"Programming Language :: Python :: 3",
2020
"Programming Language :: Python :: 3 :: Only",
21-
"Programming Language :: Python :: 3.6",
2221
"Programming Language :: Python :: 3.7",
2322
"Programming Language :: Python :: 3.8",
2423
"Programming Language :: Python :: 3.9",
@@ -33,7 +32,6 @@ classifiers = [
3332
dependencies = [
3433
"astunparse>=1.6; python_version < '3.9'",
3534
"cached-property>=1.5; python_version < '3.8'",
36-
"dataclasses>=0.7; python_version < '3.7'",
3735
"typing-extensions>=3.7; python_version < '3.8'",
3836
]
3937

@@ -62,13 +60,14 @@ package-dir = "src"
6260
[tool.pdm.dev-dependencies]
6361
duty = ["duty>=0.7"]
6462
docs = [
65-
"mkdocs>=1.2; python_version >= '3.7'",
66-
"mkdocs-coverage>=0.2; python_version >= '3.7'",
67-
"mkdocs-gen-files>=0.3; python_version >= '3.7'",
68-
"mkdocs-literate-nav>=0.4; python_version >= '3.7'",
69-
"mkdocs-material>=7.3; python_version >= '3.7'",
70-
"mkdocstrings>=0.16; python_version >= '3.7'",
71-
"toml>=0.10; python_version >= '3.7'",
63+
"mkdocs>=1.2",
64+
"mkdocs-coverage>=0.2",
65+
"mkdocs-gen-files>=0.3",
66+
"mkdocs-literate-nav>=0.4",
67+
"mkdocs-material>=7.3",
68+
"mkdocs-section-index>=0.3",
69+
"mkdocstrings>=0.16",
70+
"toml>=0.10",
7271
]
7372
format = [
7473
"autoflake>=1.4",

scripts/multirun.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
set -e
33

4-
PYTHON_VERSIONS="${PYTHON_VERSIONS-3.6 3.7 3.8 3.9 3.10 3.11}"
4+
PYTHON_VERSIONS="${PYTHON_VERSIONS-3.7 3.8 3.9 3.10 3.11}"
55

66
if [ -n "${PYTHON_VERSIONS}" ]; then
77
for python_version in ${PYTHON_VERSIONS}; do

scripts/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
set -e
33

4-
PYTHON_VERSIONS="${PYTHON_VERSIONS-3.6 3.7 3.8 3.9 3.10 3.11}"
4+
PYTHON_VERSIONS="${PYTHON_VERSIONS-3.7 3.8 3.9 3.10 3.11}"
55

66
install_with_pipx() {
77
if ! command -v "$1" &>/dev/null; then

0 commit comments

Comments
 (0)