Skip to content

Commit 4b87891

Browse files
authored
Doc fixes (#490)
2 parents 879271d + e315633 commit 4b87891

File tree

12 files changed

+45
-54
lines changed

12 files changed

+45
-54
lines changed

CHANGES

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ $ uvx --from 'vcspull' --prerelease allow vcspull
3131

3232
<!-- Maintainers, insert changes / features for the next release here -->
3333

34+
### Documentation
35+
36+
#### Fix Sphinx autodoc indentation errors (#490)
37+
38+
- Configure `sphinx-autodoc-typehints` to prevent RST parsing conflicts with
39+
Napoleon-processed docstrings by disabling type injection into docstring
40+
bodies (`always_document_param_types`, `typehints_document_rtype`).
41+
- Suppress cosmetic forward reference warnings from TYPE_CHECKING imports.
42+
3443
_Upcoming changes will be written here._
3544

3645
## vcspull v1.48.0 (2025-11-30)

docs/api/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# API Reference
44

55
:::{seealso}
6-
For granular control see {ref}`libvcs <libvcs:index>`'s {ref}`Commands <libvcs:cmd>` and {ref}`Projects <libvcs:projects>`.
6+
For granular control see the [libvcs documentation](https://libvcs.git-pull.com/en/latest/)—especially the sections on [commands](https://libvcs.git-pull.com/en/latest/usage/commands.html) and [projects](https://libvcs.git-pull.com/en/latest/usage/projects.html).
77
:::
88

99
## Internals

docs/conf.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,18 @@
118118
"member-order": "bysource",
119119
}
120120

121+
# Automatically extract typehints when specified and place them in
122+
# descriptions of the relevant function/method.
123+
autodoc_typehints = "description"
124+
# Don't show class signature with the class' name.
125+
autodoc_class_signature = "separated"
126+
121127
# sphinx-autodoc-typehints
122-
autodoc_typehints = "description" # show type hints in doc body instead of signature
123-
simplify_optional_unions = True
128+
# Suppress warnings for forward references that can't be resolved
129+
# (types in TYPE_CHECKING blocks used for circular import avoidance)
130+
suppress_warnings = [
131+
"sphinx_autodoc_typehints.forward_reference",
132+
]
124133

125134
# sphinx.ext.napoleon
126135
napoleon_google_docstring = True

src/vcspull/_internal/config_reader.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@
77

88
import yaml
99

10-
if t.TYPE_CHECKING:
11-
from typing import Literal, TypeAlias
12-
13-
FormatLiteral = Literal["json", "yaml"]
14-
15-
RawConfigData: TypeAlias = dict[t.Any, t.Any]
10+
FormatLiteral = t.Literal["json", "yaml"]
11+
RawConfigData: t.TypeAlias = dict[t.Any, t.Any]
1612

1713

1814
class ConfigReader:

src/vcspull/cli/add.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import argparse
56
import copy
67
import logging
78
import pathlib
@@ -23,9 +24,6 @@
2324
workspace_root_label,
2425
)
2526

26-
if t.TYPE_CHECKING:
27-
import argparse
28-
2927
log = logging.getLogger(__name__)
3028

3129

src/vcspull/cli/discover.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import argparse
56
import logging
67
import os
78
import pathlib
@@ -23,9 +24,6 @@
2324
workspace_root_label,
2425
)
2526

26-
if t.TYPE_CHECKING:
27-
import argparse
28-
2927
log = logging.getLogger(__name__)
3028

3129
ConfigScope = t.Literal["system", "user", "project", "external"]

src/vcspull/cli/fmt.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import argparse
56
import copy
67
import logging
78
import pathlib
@@ -20,9 +21,6 @@
2021
save_config_yaml,
2122
)
2223

23-
if t.TYPE_CHECKING:
24-
import argparse
25-
2624
log = logging.getLogger(__name__)
2725

2826

src/vcspull/cli/list.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,18 @@
22

33
from __future__ import annotations
44

5+
import argparse
56
import logging
6-
import typing as t
7+
import pathlib
78

89
from vcspull._internal.private_path import PrivatePath
910
from vcspull.config import filter_repos, find_config_files, load_configs
11+
from vcspull.types import ConfigDict
1012

1113
from ._colors import Colors, get_color_mode
1214
from ._output import OutputFormatter, get_output_mode
1315
from ._workspaces import filter_by_workspace
1416

15-
if t.TYPE_CHECKING:
16-
import argparse
17-
import pathlib
18-
19-
from vcspull.types import ConfigDict
20-
2117
log = logging.getLogger(__name__)
2218

2319

src/vcspull/cli/status.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import argparse
56
import asyncio
67
import logging
78
import os
@@ -15,16 +16,12 @@
1516

1617
from vcspull._internal.private_path import PrivatePath
1718
from vcspull.config import filter_repos, find_config_files, load_configs
19+
from vcspull.types import ConfigDict
1820

1921
from ._colors import Colors, get_color_mode
2022
from ._output import OutputFormatter, get_output_mode
2123
from ._workspaces import filter_by_workspace
2224

23-
if t.TYPE_CHECKING:
24-
import argparse
25-
26-
from vcspull.types import ConfigDict
27-
2825
log = logging.getLogger(__name__)
2926

3027
DEFAULT_STATUS_CONCURRENCY = max(1, min(32, (os.cpu_count() or 4) * 2))

src/vcspull/cli/sync.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import argparse
56
import asyncio
67
import contextlib
78
import json
@@ -20,11 +21,14 @@
2021
from time import perf_counter
2122

2223
from libvcs._internal.shortcuts import create_project
24+
from libvcs._internal.types import VCSLiteral
25+
from libvcs.sync.git import GitSync
2326
from libvcs.url import registry as url_tools
2427

2528
from vcspull import exc
2629
from vcspull._internal.private_path import PrivatePath
2730
from vcspull.config import filter_repos, find_config_files, load_configs
31+
from vcspull.types import ConfigDict
2832

2933
from ._colors import Colors, get_color_mode
3034
from ._output import (
@@ -40,14 +44,6 @@
4044
from ._workspaces import filter_by_workspace
4145
from .status import check_repo_status
4246

43-
if t.TYPE_CHECKING:
44-
import argparse
45-
46-
from libvcs._internal.types import VCSLiteral
47-
from libvcs.sync.git import GitSync
48-
49-
from vcspull.types import ConfigDict
50-
5147
log = logging.getLogger(__name__)
5248

5349
ProgressCallback = Callable[[str, datetime], None]

0 commit comments

Comments
 (0)