WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 1e33dc4

Browse files
authored
Doc fixes (#498)
2 parents 55bd6fe + 3fae5fa commit 1e33dc4

File tree

22 files changed

+63
-167
lines changed

22 files changed

+63
-167
lines changed

CHANGES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ $ uv add libvcs --prerelease allow
2020

2121
_Upcoming changes will be written here._
2222

23+
### Documentation (#498)
24+
25+
Fix doctree warnings and broken references
26+
2327
## libvcs 0.38.0 (2025-11-30)
2428

2529
### New features

MIGRATION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ _Notes on the upcoming release will be added here_
2424

2525
<!-- Maintainers, insert migration notes for the next release here -->
2626

27-
#### pytest fixtures: `git_local_clone` renamed to `example_git_repo` (#468)
27+
### pytest fixtures: `git_local_clone` renamed to `example_git_repo` (#468)
2828

2929
- pytest: `git_local_clone` renamed to `example_git_repo`
3030

31-
#### Commands: Listing method renamed (#466)
31+
### Commands: Listing method renamed (#466)
3232

3333
- `libvcs.cmd.git.GitCmd._list()` -> `libvcs.cmd.git.Git.ls()`
3434
- `libvcs.cmd.svn.Svn._list()` -> `libvcs.cmd.svn.Svn.ls()`

docs/conf.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@
110110
# sphinx.ext.autodoc
111111
autoclass_content = "both"
112112
autodoc_member_order = "bysource"
113+
# Don't show class signature with the class' name.
114+
autodoc_class_signature = "separated"
113115
toc_object_entries_show_parents = "hide"
114116
autodoc_default_options = {
115117
"undoc-members": True,
@@ -120,7 +122,9 @@
120122
}
121123

122124
# sphinx-autodoc-typehints
123-
autodoc_typehints = "description" # show type hints in doc body instead of signature
125+
# Automatically extract typehints when specified and place them in
126+
# descriptions of the relevant function/method.
127+
autodoc_typehints = "description"
124128
simplify_optional_unions = True
125129

126130
# sphinx.ext.napoleon
@@ -151,6 +155,18 @@
151155
"gp-libs": ("https://gp-libs.git-pull.com/", None),
152156
}
153157

158+
# Keep network lookups fast and quiet when inventories are slow or unreachable.
159+
intersphinx_timeout = 1
160+
161+
# sphinx-autodoc-typehints
162+
# Suppress warnings for forward references that can't be resolved
163+
# (types in TYPE_CHECKING blocks used for circular import avoidance)
164+
suppress_warnings = [
165+
"intersphinx",
166+
"intersphinx.inventory",
167+
"sphinx_autodoc_typehints.forward_reference",
168+
]
169+
154170

155171
def linkcode_resolve(domain: str, info: dict[str, str]) -> None | str:
156172
"""

docs/pytest-plugin.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ Looking for more flexibility, correctness, or power? Need different defaults? [C
1111
[connect with us]: https://github.com/vcs-python/libvcs/discussions
1212
```
1313

14-
```{module} libvcs.pytest_plugin
15-
16-
```
17-
1814
[pytest]: https://docs.pytest.org/
1915

2016
## Usage
@@ -29,7 +25,7 @@ Pytest will automatically detect the plugin, and its fixtures will be available.
2925

3026
## Fixtures
3127

32-
This pytest plugin works by providing {ref}`pytest fixtures <pytest:fixtures-api>`. The plugin's fixtures ensure that a fresh Git, Subversion, or Mercurial repository is available for each test. It utilizes [session-scoped fixtures] to cache initial repositories, improving performance across tests.
28+
This pytest plugin works by providing [pytest fixtures](https://docs.pytest.org/en/stable/how-to/fixtures.html). The plugin's fixtures ensure that a fresh Git, Subversion, or Mercurial repository is available for each test. It utilizes [session-scoped fixtures] to cache initial repositories, improving performance across tests.
3329

3430
[session-scoped fixtures]: https://docs.pytest.org/en/8.3.x/how-to/fixtures.html#fixture-scopes
3531

docs/url/index.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,9 @@ in {mod}`urlparse` (undocumented).
243243

244244
From there, `GitURL` can be used downstream directly by other projects.
245245

246-
In our case, `libvcs`s' own {ref}`cmd` and {ref}`projects`, as well as a {ref}`vcspull:index`
247-
configuration, will be able to detect and accept various URL patterns.
246+
In our case, `libvcs`s' own {ref}`cmd` and {ref}`projects`, as well as a
247+
[vcspull configuration](https://vcspull.git-pull.com/), will be able to detect and accept various
248+
URL patterns.
248249

249250
### Matchers: Defaults
250251

@@ -255,10 +256,6 @@ When a match occurs, its `defaults` will fill in non-matched groups.
255256
When registering new matchers, higher `weight`s are checked first. If it's a valid regex grouping,
256257
it will be picked.
257258

258-
[^api-unstable]: Provisional API only
259-
260-
It's not determined if Location will be mutable or if modifications will return a new object.
261-
262259
## Explore
263260

264261
```{toctree}

src/libvcs/_internal/dataclasses.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
if t.TYPE_CHECKING:
1515
from _typeshed import DataclassInstance
16+
else:
17+
DataclassInstance = object
1618

1719

1820
class SkipDefaultFieldsReprMixin:

src/libvcs/_internal/run.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def console_to_str(s: bytes) -> str:
3737

3838
if t.TYPE_CHECKING:
3939
_LoggerAdapter = logging.LoggerAdapter[logging.Logger]
40-
from typing import TypeAlias
4140
else:
4241
_LoggerAdapter = logging.LoggerAdapter
4342

@@ -96,12 +95,12 @@ def __call__(self, output: str, timestamp: datetime.datetime) -> None:
9695

9796

9897
if sys.platform == "win32":
99-
_ENV: TypeAlias = Mapping[str, str]
98+
_ENV: t.TypeAlias = Mapping[str, str]
10099
else:
101-
_ENV: TypeAlias = Mapping[bytes, StrPath] | Mapping[str, StrPath]
100+
_ENV: t.TypeAlias = Mapping[bytes, StrPath] | Mapping[str, StrPath]
102101

103102
_CMD = StrPath | Sequence[StrPath]
104-
_FILE: TypeAlias = int | t.IO[t.Any] | None
103+
_FILE: t.TypeAlias = int | t.IO[t.Any] | None
105104

106105

107106
def run(
@@ -158,12 +157,12 @@ def run(
158157
subprocess in real time instead of when the process finishes.
159158
160159
check_returncode : bool
161-
Indicate whether a `libvcs.exc.CommandError` should be raised if return code is
162-
different from 0.
160+
Indicate whether a ``libvcs.exc.CommandError`` should be raised if return
161+
code is different from 0.
163162
164163
callback : ProgressCallbackProtocol
165164
callback to return output as a command executes, accepts a function signature
166-
of `(output, timestamp)`. Example usage::
165+
of ``(output, timestamp)``. Example usage::
167166
168167
def progress_cb(output, timestamp):
169168
sys.stdout.write(output)
@@ -172,7 +171,7 @@ def progress_cb(output, timestamp):
172171
173172
Upcoming changes
174173
----------------
175-
When minimum python >= 3.10, `pipesize: int = -1` will be added after `umask`.
174+
When minimum python >= 3.10, pipesize: int = -1 will be added after umask.
176175
"""
177176
proc = subprocess.Popen(
178177
args,

src/libvcs/_internal/shortcuts.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@
1010
import typing as t
1111

1212
from libvcs import GitSync, HgSync, SvnSync, exc
13+
from libvcs._internal.run import ProgressCallbackProtocol
14+
from libvcs._internal.types import StrPath, VCSLiteral
1315
from libvcs.exc import InvalidVCS
1416
from libvcs.url import registry as url_tools
1517

16-
if t.TYPE_CHECKING:
17-
from typing import TypeGuard
18-
19-
from libvcs._internal.run import ProgressCallbackProtocol
20-
from libvcs._internal.types import StrPath, VCSLiteral
21-
2218

2319
class VCSNoMatchFoundForUrl(exc.LibVCSException):
2420
def __init__(self, url: str, *args: object) -> None:
@@ -131,7 +127,7 @@ def create_project(
131127

132128
assert vcs_matches[0].vcs is not None
133129

134-
def is_vcs(val: t.Any) -> TypeGuard[VCSLiteral]:
130+
def is_vcs(val: t.Any) -> t.TypeGuard[VCSLiteral]:
135131
return isinstance(val, str) and val in {"git", "hg", "svn"}
136132

137133
if is_vcs(vcs_matches[0].vcs):

src/libvcs/_internal/subprocess.py

Lines changed: 5 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@
5151

5252
from .dataclasses import SkipDefaultFieldsReprMixin
5353

54-
if t.TYPE_CHECKING:
55-
from typing import TypeAlias
56-
57-
5854
F = t.TypeVar("F", bound=t.Callable[..., t.Any])
5955

6056

@@ -64,92 +60,19 @@ def __init__(self, output: str, *args: object) -> None:
6460

6561

6662
if sys.platform == "win32":
67-
_ENV: TypeAlias = Mapping[str, str]
63+
_ENV: t.TypeAlias = Mapping[str, str]
6864
else:
69-
_ENV: TypeAlias = Mapping[bytes, StrOrBytesPath] | Mapping[str, StrOrBytesPath]
70-
_FILE: TypeAlias = None | int | t.IO[t.Any]
71-
_TXT: TypeAlias = bytes | str
65+
_ENV: t.TypeAlias = Mapping[bytes, StrOrBytesPath] | Mapping[str, StrOrBytesPath]
66+
_FILE: t.TypeAlias = None | int | t.IO[t.Any]
67+
_TXT: t.TypeAlias = bytes | str
7268
#: Command
73-
_CMD: TypeAlias = StrOrBytesPath | Sequence[StrOrBytesPath]
69+
_CMD: t.TypeAlias = StrOrBytesPath | Sequence[StrOrBytesPath]
7470

7571

7672
@dataclasses.dataclass(repr=False)
7773
class SubprocessCommand(SkipDefaultFieldsReprMixin):
7874
"""Wraps a :mod:`subprocess` request. Inspect, mutate, control before invocation.
7975
80-
Attributes
81-
----------
82-
args : _CMD
83-
A string, or a sequence of program arguments.
84-
85-
bufsize : int
86-
supplied as the buffering argument to the open() function when creating the
87-
stdin/stdout/stderr pipe file objects
88-
89-
executable : Optional[StrOrBytesPath]
90-
A replacement program to execute.
91-
92-
stdin : _FILE
93-
standard output for executed program
94-
95-
stdout :
96-
standard output for executed program
97-
98-
stderr :
99-
standard output for executed program
100-
101-
close_fds : Controls closing or inheriting of file descriptors.
102-
103-
shell : If true, the command will be executed through the shell.
104-
105-
cwd : Sets the current directory before the child is executed.
106-
107-
env : Defines the environment variables for the new process.
108-
109-
text :
110-
If ``True``, decode stdin, stdout and stderr using the given encoding (if set)
111-
or the system default otherwise.
112-
113-
universal_newlines :
114-
Alias of text, provided for backwards compatibility.
115-
116-
startupinfo :
117-
Windows only
118-
119-
creationflags :
120-
Windows only
121-
122-
preexec_fn :
123-
(POSIX only) An object to be called in the child process just before the child
124-
is executed.
125-
126-
restore_signals :
127-
POSIX only
128-
129-
start_new_session :
130-
POSIX only
131-
132-
group :
133-
POSIX only
134-
135-
extra_groups :
136-
POSIX only
137-
138-
user :
139-
POSIX only
140-
141-
umask :
142-
POSIX only
143-
144-
pass_fds :
145-
POSIX only
146-
147-
encoding :
148-
Text mode encoding to use for file objects stdin, stdout and stderr.
149-
150-
errors :
151-
Text mode error handling to use for file objects stdin, stdout and stderr.
152-
15376
Examples
15477
--------
15578
>>> cmd = SubprocessCommand("ls")

src/libvcs/_internal/types.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Internal :term:`type annotations <annotation>`.
1+
"""Internal type annotations.
22
33
Notes
44
-----
@@ -12,14 +12,11 @@
1212
import typing as t
1313
from os import PathLike
1414

15-
if t.TYPE_CHECKING:
16-
from typing import TypeAlias
17-
18-
StrPath: TypeAlias = str | PathLike[str] # stable
15+
StrPath: t.TypeAlias = str | PathLike[str] # stable
1916
""":class:`os.PathLike` or :class:`str`"""
2017

21-
StrOrBytesPath: TypeAlias = str | bytes | PathLike[str] | PathLike[bytes]
22-
""":class:`os.PathLike`, :class:`str` or :term:`bytes-like object`"""
18+
StrOrBytesPath: t.TypeAlias = str | bytes | PathLike[str] | PathLike[bytes]
19+
""":class:`os.PathLike`, :class:`str` or bytes-like object"""
2320

2421

2522
VCSLiteral = t.Literal["git", "svn", "hg"]

0 commit comments

Comments
 (0)