intersphinx-registry 0.2511.25__py2.py3-none-any.whl → 0.2601.5__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- intersphinx_registry/__init__.py +39 -12
- intersphinx_registry/__main__.py +4 -0
- intersphinx_registry/_info.py +4 -4
- intersphinx_registry/cli.py +128 -0
- intersphinx_registry/lookup.py +142 -42
- intersphinx_registry/registry.json +1 -2
- intersphinx_registry/rev_search.py +720 -0
- intersphinx_registry/reverse_lookup.py +247 -0
- intersphinx_registry/utils.py +125 -0
- intersphinx_registry-0.2601.5.dist-info/METADATA +173 -0
- intersphinx_registry-0.2601.5.dist-info/RECORD +15 -0
- intersphinx_registry-0.2601.5.dist-info/entry_points.txt +3 -0
- intersphinx_registry-0.2511.25.dist-info/METADATA +0 -88
- intersphinx_registry-0.2511.25.dist-info/RECORD +0 -9
- {intersphinx_registry-0.2511.25.dist-info → intersphinx_registry-0.2601.5.dist-info}/WHEEL +0 -0
- {intersphinx_registry-0.2511.25.dist-info → intersphinx_registry-0.2601.5.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import re
|
|
3
|
+
import sys
|
|
4
|
+
import warnings
|
|
5
|
+
from collections import namedtuple
|
|
6
|
+
from io import BytesIO
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from urllib.parse import urljoin, urlparse
|
|
9
|
+
|
|
10
|
+
import requests
|
|
11
|
+
from sphinx.util.inventory import InventoryFile
|
|
12
|
+
|
|
13
|
+
from .utils import _are_dependencies_available, _install_cache
|
|
14
|
+
|
|
15
|
+
ReverseLookupResult = namedtuple(
|
|
16
|
+
"ReverseLookupResult",
|
|
17
|
+
["url", "package", "domain", "rst_entry", "display_name", "inventory_url"],
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _normalize_url_for_matching(url: str) -> str:
|
|
22
|
+
"""
|
|
23
|
+
Normalize URL for fuzzy matching by removing version-specific segments.
|
|
24
|
+
|
|
25
|
+
This helps match URLs like:
|
|
26
|
+
- /stable/ vs /latest/ vs /main/
|
|
27
|
+
- /v1.2.3/ vs /v2.0/ vs /1.5/
|
|
28
|
+
"""
|
|
29
|
+
normalized = re.sub(r"/(latest|stable|main|dev|master)/", "/_VERSION_/", url)
|
|
30
|
+
normalized = re.sub(r"/v?\d+(\.\d+)*/", "/_VERSION_/", normalized)
|
|
31
|
+
return normalized
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def uri_match(user_url: str, inv_url: str) -> bool:
|
|
35
|
+
"""
|
|
36
|
+
Check if two URIs match, handling index.html variations and version normalization.
|
|
37
|
+
|
|
38
|
+
Parameters
|
|
39
|
+
----------
|
|
40
|
+
user_url : str
|
|
41
|
+
URL from user input or RST file
|
|
42
|
+
inv_url : str
|
|
43
|
+
URL from intersphinx inventory
|
|
44
|
+
|
|
45
|
+
Returns
|
|
46
|
+
-------
|
|
47
|
+
bool
|
|
48
|
+
True if the URLs match (considering index.html and version variations), False otherwise
|
|
49
|
+
"""
|
|
50
|
+
if user_url == inv_url:
|
|
51
|
+
return True
|
|
52
|
+
|
|
53
|
+
variants = [user_url]
|
|
54
|
+
if user_url.endswith("/index.html"):
|
|
55
|
+
variants.append(user_url[:-10]) # Remove index.html, keep /
|
|
56
|
+
elif user_url.endswith("/"):
|
|
57
|
+
variants.append(user_url + "index.html")
|
|
58
|
+
else:
|
|
59
|
+
variants.append(user_url + "/index.html")
|
|
60
|
+
|
|
61
|
+
if inv_url in variants:
|
|
62
|
+
return True
|
|
63
|
+
|
|
64
|
+
inv_url_normalized = (
|
|
65
|
+
_normalize_url_for_matching(inv_url).rstrip("/").replace("/index.html", "")
|
|
66
|
+
)
|
|
67
|
+
for variant in variants:
|
|
68
|
+
variant_normalized = (
|
|
69
|
+
_normalize_url_for_matching(variant).rstrip("/").replace("/index.html", "")
|
|
70
|
+
)
|
|
71
|
+
if variant_normalized == inv_url_normalized:
|
|
72
|
+
return True
|
|
73
|
+
|
|
74
|
+
return False
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _do_reverse_lookup(
|
|
78
|
+
urls: list[str],
|
|
79
|
+
) -> list[ReverseLookupResult]:
|
|
80
|
+
"""
|
|
81
|
+
Core reverse lookup logic: given URLs, find which packages they belong to and their rst references.
|
|
82
|
+
|
|
83
|
+
Parameters
|
|
84
|
+
----------
|
|
85
|
+
urls : list[str]
|
|
86
|
+
List of URLs
|
|
87
|
+
|
|
88
|
+
Returns
|
|
89
|
+
-------
|
|
90
|
+
list[ReverseLookupResult]
|
|
91
|
+
List of ReverseLookupResult named tuples with fields:
|
|
92
|
+
url, package, domain, rst_entry, display_name
|
|
93
|
+
"""
|
|
94
|
+
_install_cache()
|
|
95
|
+
|
|
96
|
+
registry_file = Path(__file__).parent / "registry.json"
|
|
97
|
+
registry = json.loads(registry_file.read_bytes())
|
|
98
|
+
|
|
99
|
+
package_urls: dict[str, list[str]] = {}
|
|
100
|
+
|
|
101
|
+
for url_str in urls:
|
|
102
|
+
matched = False
|
|
103
|
+
for package, (base_url, obj_path) in registry.items():
|
|
104
|
+
if url_str.startswith(base_url):
|
|
105
|
+
package_urls.setdefault(package, []).append(url_str)
|
|
106
|
+
matched = True
|
|
107
|
+
break
|
|
108
|
+
|
|
109
|
+
if not matched:
|
|
110
|
+
url_domain = urlparse(url_str).netloc
|
|
111
|
+
url_path_normalized = (
|
|
112
|
+
_normalize_url_for_matching(urlparse(url_str).path)
|
|
113
|
+
.rstrip("/")
|
|
114
|
+
.replace("/index.html", "")
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
for package, (base_url, obj_path) in registry.items():
|
|
118
|
+
base_domain = urlparse(base_url).netloc
|
|
119
|
+
if url_domain == base_domain:
|
|
120
|
+
base_path_normalized = _normalize_url_for_matching(
|
|
121
|
+
urlparse(base_url).path
|
|
122
|
+
).rstrip("/")
|
|
123
|
+
if url_path_normalized.startswith(
|
|
124
|
+
base_path_normalized
|
|
125
|
+
) or base_path_normalized.startswith(url_path_normalized):
|
|
126
|
+
package_urls.setdefault(package, []).append(url_str)
|
|
127
|
+
break
|
|
128
|
+
|
|
129
|
+
results: list[ReverseLookupResult] = []
|
|
130
|
+
|
|
131
|
+
for package, url_list in package_urls.items():
|
|
132
|
+
base_url, obj_path = registry[package]
|
|
133
|
+
inv_url = urljoin(base_url, obj_path if obj_path else "objects.inv")
|
|
134
|
+
|
|
135
|
+
try:
|
|
136
|
+
resp = requests.get(inv_url, timeout=25)
|
|
137
|
+
resp.raise_for_status()
|
|
138
|
+
inv = InventoryFile.load(BytesIO(resp.content), base_url, urljoin)
|
|
139
|
+
except Exception as e:
|
|
140
|
+
warnings.warn(
|
|
141
|
+
f"Failed to load inventory for '{package}' from {inv_url}: {e}",
|
|
142
|
+
UserWarning,
|
|
143
|
+
stacklevel=2,
|
|
144
|
+
)
|
|
145
|
+
for url_str in url_list:
|
|
146
|
+
results.append(
|
|
147
|
+
ReverseLookupResult(url_str, package, None, None, None, None)
|
|
148
|
+
)
|
|
149
|
+
continue
|
|
150
|
+
|
|
151
|
+
inv_urls = {}
|
|
152
|
+
for key, v in inv.items():
|
|
153
|
+
for entry, (proj, ver, uri, display_name) in v.items():
|
|
154
|
+
inv_urls[uri] = (key, entry, display_name)
|
|
155
|
+
|
|
156
|
+
for url_str in url_list:
|
|
157
|
+
found = False
|
|
158
|
+
|
|
159
|
+
for inv_uri, (key, entry, display_name) in inv_urls.items():
|
|
160
|
+
if uri_match(url_str, inv_uri):
|
|
161
|
+
results.append(
|
|
162
|
+
ReverseLookupResult(
|
|
163
|
+
url_str, package, key, entry, display_name, inv_uri
|
|
164
|
+
)
|
|
165
|
+
)
|
|
166
|
+
found = True
|
|
167
|
+
break
|
|
168
|
+
|
|
169
|
+
if not found:
|
|
170
|
+
results.append(
|
|
171
|
+
ReverseLookupResult(url_str, package, None, None, None, None)
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
return results
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def _print_reverse_lookup_results(
|
|
178
|
+
results: list[ReverseLookupResult],
|
|
179
|
+
) -> None:
|
|
180
|
+
"""
|
|
181
|
+
Print formatted reverse lookup results.
|
|
182
|
+
|
|
183
|
+
Parameters
|
|
184
|
+
----------
|
|
185
|
+
results : list[ReverseLookupResult]
|
|
186
|
+
List of ReverseLookupResult named tuples
|
|
187
|
+
"""
|
|
188
|
+
if not results:
|
|
189
|
+
return
|
|
190
|
+
|
|
191
|
+
header_url = "URL"
|
|
192
|
+
header_rst = "Sphinx Reference"
|
|
193
|
+
header_display = "Description"
|
|
194
|
+
|
|
195
|
+
width_url = max(len(header_url), max(len(r.url) for r in results))
|
|
196
|
+
width_rst = max(
|
|
197
|
+
len(header_rst),
|
|
198
|
+
max(
|
|
199
|
+
(
|
|
200
|
+
len(f":{r.domain}:`{r.package}:{r.rst_entry}`")
|
|
201
|
+
if r.rst_entry
|
|
202
|
+
else len("NOT FOUND")
|
|
203
|
+
)
|
|
204
|
+
for r in results
|
|
205
|
+
),
|
|
206
|
+
)
|
|
207
|
+
width_display = max(
|
|
208
|
+
len(header_display),
|
|
209
|
+
max((len(r.display_name) if r.display_name else 0) for r in results),
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
print(f"{header_url:<{width_url}} {header_rst:<{width_rst}} {header_display}")
|
|
213
|
+
print(f"{'-' * width_url} {'-' * width_rst} {'-' * width_display}")
|
|
214
|
+
|
|
215
|
+
for result in results:
|
|
216
|
+
if result.rst_entry:
|
|
217
|
+
rst_ref = f":{result.domain}:`{result.package}:{result.rst_entry}`"
|
|
218
|
+
display = (
|
|
219
|
+
result.display_name
|
|
220
|
+
if result.display_name and result.display_name != "-"
|
|
221
|
+
else result.rst_entry
|
|
222
|
+
)
|
|
223
|
+
print(
|
|
224
|
+
f"{result.url:<{width_url}} {rst_ref:<{width_rst}} {display:<{width_display}}"
|
|
225
|
+
)
|
|
226
|
+
elif result.package:
|
|
227
|
+
print(f"{result.url:<{width_url}} {'NOT FOUND':<{width_rst}}")
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def reverse_lookup(urls: list[str]) -> None:
|
|
231
|
+
"""
|
|
232
|
+
Reverse lookup: given URLs, find which packages they belong to and their rst references.
|
|
233
|
+
|
|
234
|
+
Parameters
|
|
235
|
+
----------
|
|
236
|
+
urls : list[str]
|
|
237
|
+
List of URLs
|
|
238
|
+
"""
|
|
239
|
+
if not urls:
|
|
240
|
+
print("ERROR: No URLs provided", file=sys.stderr)
|
|
241
|
+
return
|
|
242
|
+
|
|
243
|
+
if not _are_dependencies_available():
|
|
244
|
+
return
|
|
245
|
+
|
|
246
|
+
results = _do_reverse_lookup(urls)
|
|
247
|
+
_print_reverse_lookup_results(results)
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import shutil
|
|
2
|
+
import sys
|
|
3
|
+
from datetime import timedelta
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
import platformdirs
|
|
7
|
+
import requests_cache
|
|
8
|
+
|
|
9
|
+
from . import __version__
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _compress_user_path(path: str) -> str:
|
|
13
|
+
"""
|
|
14
|
+
Replace home directory with ~ in a path string.
|
|
15
|
+
|
|
16
|
+
Parameters
|
|
17
|
+
----------
|
|
18
|
+
path : str
|
|
19
|
+
Path to compress
|
|
20
|
+
|
|
21
|
+
Returns
|
|
22
|
+
-------
|
|
23
|
+
str
|
|
24
|
+
Path with home directory replaced by ~
|
|
25
|
+
"""
|
|
26
|
+
home = str(Path.home())
|
|
27
|
+
if path.startswith(home):
|
|
28
|
+
return path.replace(home, "~", 1)
|
|
29
|
+
return path
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _get_cache_dir() -> Path:
|
|
33
|
+
"""
|
|
34
|
+
Get the cache directory for the current version of intersphinx_registry.
|
|
35
|
+
|
|
36
|
+
Returns
|
|
37
|
+
-------
|
|
38
|
+
Path
|
|
39
|
+
Cache directory path with version subdirectory
|
|
40
|
+
"""
|
|
41
|
+
base_cache_dir = Path(platformdirs.user_cache_dir("intersphinx_registry"))
|
|
42
|
+
cache_dir = base_cache_dir / __version__
|
|
43
|
+
cache_dir.mkdir(parents=True, exist_ok=True)
|
|
44
|
+
|
|
45
|
+
return cache_dir
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _cleanup_old_caches() -> None:
|
|
49
|
+
"""
|
|
50
|
+
Remove cache directories from old versions of intersphinx_registry.
|
|
51
|
+
Only keeps the current version's cache.
|
|
52
|
+
"""
|
|
53
|
+
base_cache_dir = Path(platformdirs.user_cache_dir("intersphinx_registry"))
|
|
54
|
+
|
|
55
|
+
if not base_cache_dir.exists():
|
|
56
|
+
return
|
|
57
|
+
|
|
58
|
+
current_version = __version__
|
|
59
|
+
|
|
60
|
+
for version_dir in base_cache_dir.iterdir():
|
|
61
|
+
if version_dir.is_dir() and version_dir.name != current_version:
|
|
62
|
+
try:
|
|
63
|
+
shutil.rmtree(version_dir)
|
|
64
|
+
except Exception:
|
|
65
|
+
pass
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _install_cache() -> None:
|
|
69
|
+
"""
|
|
70
|
+
Install the version-specific requests cache.
|
|
71
|
+
Cleans up old caches on first use.
|
|
72
|
+
"""
|
|
73
|
+
_cleanup_old_caches()
|
|
74
|
+
|
|
75
|
+
cache_dir = _get_cache_dir()
|
|
76
|
+
cache_path = cache_dir / "intersphinx_cache.sqlite"
|
|
77
|
+
|
|
78
|
+
requests_cache.install_cache(
|
|
79
|
+
str(cache_path),
|
|
80
|
+
backend="sqlite",
|
|
81
|
+
expire_after=timedelta(hours=6),
|
|
82
|
+
stale_if_error=True,
|
|
83
|
+
cache_control=True,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _are_dependencies_available() -> bool:
|
|
88
|
+
"""
|
|
89
|
+
Check if CLI dependencies are missing or not.
|
|
90
|
+
Returns True if all dependencies are available, False otherwise.
|
|
91
|
+
"""
|
|
92
|
+
missing = []
|
|
93
|
+
try:
|
|
94
|
+
import sphinx # noqa: F401
|
|
95
|
+
except ModuleNotFoundError:
|
|
96
|
+
missing.append("sphinx")
|
|
97
|
+
|
|
98
|
+
try:
|
|
99
|
+
import requests # noqa: F401
|
|
100
|
+
except ModuleNotFoundError:
|
|
101
|
+
missing.append("requests")
|
|
102
|
+
|
|
103
|
+
try:
|
|
104
|
+
import requests_cache # noqa: F401
|
|
105
|
+
except ModuleNotFoundError:
|
|
106
|
+
missing.append("requests-cache")
|
|
107
|
+
|
|
108
|
+
try:
|
|
109
|
+
import platformdirs # noqa: F401
|
|
110
|
+
except ModuleNotFoundError:
|
|
111
|
+
missing.append("platformdirs")
|
|
112
|
+
|
|
113
|
+
if missing:
|
|
114
|
+
print(
|
|
115
|
+
"ERROR: the lookup functionality requires additional dependencies.",
|
|
116
|
+
file=sys.stderr,
|
|
117
|
+
)
|
|
118
|
+
print(
|
|
119
|
+
"Please install with: pip install 'intersphinx_registry[cli]'",
|
|
120
|
+
file=sys.stderr,
|
|
121
|
+
)
|
|
122
|
+
print(f"Missing dependencies: {', '.join(missing)}", file=sys.stderr)
|
|
123
|
+
return False
|
|
124
|
+
|
|
125
|
+
return True
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: intersphinx_registry
|
|
3
|
+
Version: 0.2601.5
|
|
4
|
+
Summary: This package provides convenient utilities and data to write a sphinx config file.
|
|
5
|
+
Author-email: M Bussonnier <bussonniermatthias@gmail.com>
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: intersphinx_registry[lookup] ; extra == "cli"
|
|
10
|
+
Requires-Dist: sphinx>=8 ; extra == "lookup"
|
|
11
|
+
Requires-Dist: requests ; extra == "lookup"
|
|
12
|
+
Requires-Dist: requests-cache ; extra == "lookup"
|
|
13
|
+
Requires-Dist: platformdirs ; extra == "lookup"
|
|
14
|
+
Requires-Dist: pytest>=7.0 ; extra == "tests"
|
|
15
|
+
Requires-Dist: pytest-xdist ; extra == "tests"
|
|
16
|
+
Requires-Dist: mypy ; extra == "tests"
|
|
17
|
+
Requires-Dist: types-requests ; extra == "tests"
|
|
18
|
+
Requires-Dist: intersphinx_registry[cli] ; extra == "tests"
|
|
19
|
+
Project-URL: Home, https://github.com/Quansight-labs/intersphinx_registry
|
|
20
|
+
Provides-Extra: cli
|
|
21
|
+
Provides-Extra: lookup
|
|
22
|
+
Provides-Extra: tests
|
|
23
|
+
|
|
24
|
+
# Intersphinx Registry
|
|
25
|
+
|
|
26
|
+
A simple utility package that provides a default intersphinx mapping for a large chunk of the Python ecosystem.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Core package only (for use in conf.py/Sphinx projects)
|
|
32
|
+
pip install intersphinx_registry
|
|
33
|
+
|
|
34
|
+
# With a command-line interface
|
|
35
|
+
pip install intersphinx_registry[cli]
|
|
36
|
+
# or
|
|
37
|
+
uv tool install intersphinx_registry[cli]
|
|
38
|
+
# or
|
|
39
|
+
pipx install intersphinx_registry[cli]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
You can also use it without installation:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
uvx intersphinx-registry[cli] lookup numpy,scipy array
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Usage in `conf.py`
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from intersphinx_registry import get_intersphinx_mapping
|
|
52
|
+
|
|
53
|
+
# ...
|
|
54
|
+
intersphinx_mapping = get_intersphinx_mapping(
|
|
55
|
+
packages={"ipython", "matplotlib", "pandas", "python"}
|
|
56
|
+
)
|
|
57
|
+
intersphinx_mapping.update({
|
|
58
|
+
'overwrite': ('<url>', None),
|
|
59
|
+
'my-package': ('<url>', None),
|
|
60
|
+
})
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Command-line interface
|
|
64
|
+
|
|
65
|
+
The package provides a command-line interface for looking up intersphinx targets.
|
|
66
|
+
|
|
67
|
+
> [!NOTE]
|
|
68
|
+
> The CLI requires installing the `[cli]` extra: `pip install intersphinx_registry[cli]`
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
$ intersphinx-registry --version
|
|
72
|
+
# or
|
|
73
|
+
$ intersphinx-registry -v
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### quick lookup
|
|
77
|
+
|
|
78
|
+
You can use the lookup command to search for intersphinx targets and webpages across various packages.
|
|
79
|
+
|
|
80
|
+
Call without arguments to get help:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
$ intersphinx-registry lookup
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Basic usage:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
$ intersphinx-registry lookup <package>[,package] [search_term]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Examples:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
$ intersphinx-registry lookup numpy,scipy array
|
|
96
|
+
$ intersphinx-registry lookup ipython formatters.html
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
You can search multiple packages at once:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
$ intersphinx-registry lookup numpy,scipy Universal
|
|
103
|
+
std:label ufuncs NumPy 2.1 'Universal functions (ufunc)' https://numpy.org/doc/stable/reference/ufuncs.html#ufuncs
|
|
104
|
+
std:label ufuncs-basics NumPy 2.1 'Universal functions (ufunc) basics' https://numpy.org/doc/stable/user/basics.ufuncs.html#ufuncs-basics
|
|
105
|
+
std:label ufuncs-internals NumPy 2.1 'Universal functions' https://numpy.org/doc/stable/dev/internals.code-explanations.html#ufuncs-internals
|
|
106
|
+
std:doc reference/ufuncs NumPy 2.1 'Universal functions (ufunc)' https://numpy.org/doc/stable/reference/ufuncs.html
|
|
107
|
+
std:doc user/basics.ufuncs NumPy 2.1 'Universal functions (ufunc) basics' https://numpy.org/doc/stable/user/basics.ufuncs.html
|
|
108
|
+
std:label non-uniform-random-number-sampling SciPy 1.14.1 'Universal Non-Uniform Random Number Sampling in SciPy' https://docs.scipy.org/doc/scipy/tutorial/stats/sampling.html#non-uniform-random-number-sampling
|
|
109
|
+
std:doc tutorial/stats/sampling SciPy 1.14.1 'Universal Non-Uniform Random Number Sampling in SciPy' https://docs.scipy.org/doc/scipy/tutorial/stats/sampling.html
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
> [!WARNING]
|
|
113
|
+
> There is no cache; the lookup command downloads the inventory of each mentioned package every time.
|
|
114
|
+
|
|
115
|
+
You can also use the lookup functionality via the module interface:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
$ python -m intersphinx_registry.lookup <package>[,package] [search_term]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### reverse-lookup
|
|
122
|
+
|
|
123
|
+
Find which package a documentation URL belongs to and get its Sphinx reference.
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
$ intersphinx-registry reverse-lookup <url> [url...]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Examples:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
$ intersphinx-registry reverse-lookup https://numpy.org/doc/stable/reference/arrays.html
|
|
133
|
+
$ intersphinx-registry reverse-lookup https://docs.python.org/3/ https://numpy.org/doc/stable/
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
This is useful when you have a link to documentation and want to know the corresponding Sphinx reference (`:domain:package:target`) that you can use in your own documentation with intersphinx.
|
|
137
|
+
|
|
138
|
+
### rev-search
|
|
139
|
+
|
|
140
|
+
Scan `.rst` files in a directory for hardcoded URLs and suggest replacements with Sphinx references.
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
$ intersphinx-registry rev-search <directory-or-file>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Examples:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
$ intersphinx-registry rev-search docs/
|
|
150
|
+
$ intersphinx-registry rev-search docs/index.rst
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
This command helps you convert hardcoded URLs in your reStructuredText documentation into proper intersphinx references. It scans your documentation files, finds URLs that match known packages in the registry, and shows you a diff-style output of the suggested changes.
|
|
154
|
+
|
|
155
|
+
## Why ?
|
|
156
|
+
|
|
157
|
+
Sometimes, packages docs move and it's hard to keep track of them. We _try_ to keep the
|
|
158
|
+
registry up to date, so you do not have to ask yourself questions and update your
|
|
159
|
+
intersphinx-mapping.
|
|
160
|
+
|
|
161
|
+
You also might not want to think about adding intersphinx mapping when you refer
|
|
162
|
+
to dependencies.
|
|
163
|
+
|
|
164
|
+
## A package url is wrong !
|
|
165
|
+
|
|
166
|
+
Please send a PR updating only this package in the `registry.json`. We try to
|
|
167
|
+
link only to _stable_ package, not dev versions.
|
|
168
|
+
|
|
169
|
+
## A package is missing !
|
|
170
|
+
|
|
171
|
+
We can't do all packages, but if you think a package is widely used and missing,
|
|
172
|
+
please send a PR.
|
|
173
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
intersphinx_registry/__init__.py,sha256=A51oQMp2TiI5gE0SWH1tcmGhi2QkVSDHteeEoV4k0x8,2477
|
|
2
|
+
intersphinx_registry/__main__.py,sha256=Onf2k3sdsvpaifbi8UFhnbF_yTEHGxRpTT5RUAAWSXU,81
|
|
3
|
+
intersphinx_registry/_info.py,sha256=1aFYUmj1io6kGJaf_8wB9D7MjTkwl8BmOubUY7x3muk,2224
|
|
4
|
+
intersphinx_registry/cli.py,sha256=3X9Rfz59sMlXYDSNTxSk-hrHcCO0OjrRdjGVDzLT--w,4265
|
|
5
|
+
intersphinx_registry/lookup.py,sha256=ffUPEnKl37CObcu0Ul9dzEznSrEal9OeuZKzq5G1Yck,5273
|
|
6
|
+
intersphinx_registry/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
intersphinx_registry/registry.json,sha256=PoZKwZLlAa2h5oWKuJKLRbQWoSGVN19JrxzF3MPvsiM,12711
|
|
8
|
+
intersphinx_registry/rev_search.py,sha256=Gkd8YGWR8L7Gqc57u2YBg0d0iDBH47p8mBVtbCEAHKQ,23667
|
|
9
|
+
intersphinx_registry/reverse_lookup.py,sha256=8kPvX-UUhWlO1o14kJd8PYWpecAXR8y9dAcbt_49SyE,7499
|
|
10
|
+
intersphinx_registry/utils.py,sha256=_WjmtuzlXjuA9z1-Pv-CkgjHtORtlNV6faao2GP4rYI,3021
|
|
11
|
+
intersphinx_registry-0.2601.5.dist-info/entry_points.txt,sha256=qbnBLPGMbSDiZHGpPOiuXwMFfAS7iVT3bakVKhwmHgo,70
|
|
12
|
+
intersphinx_registry-0.2601.5.dist-info/licenses/LICENSE,sha256=j98x_c52nvqkLlr-U8tUaubJG3IBCIFEInYE4L_Yqqo,1086
|
|
13
|
+
intersphinx_registry-0.2601.5.dist-info/WHEEL,sha256=Dyt6SBfaasWElUrURkknVFAZDHSTwxg3PaTza7RSbkY,100
|
|
14
|
+
intersphinx_registry-0.2601.5.dist-info/METADATA,sha256=exl6YyihrpRQiscWMp-AMDofjYvysQbttZcifSVIpUU,5868
|
|
15
|
+
intersphinx_registry-0.2601.5.dist-info/RECORD,,
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: intersphinx_registry
|
|
3
|
-
Version: 0.2511.25
|
|
4
|
-
Summary: This package provides convenient utilities and data to write a sphinx config file.
|
|
5
|
-
Author-email: Matthias Bussonnier <bussonniermatthias@gmail.com>
|
|
6
|
-
Description-Content-Type: text/markdown
|
|
7
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
-
License-File: LICENSE
|
|
9
|
-
Requires-Dist: pytest>=7.0 ; extra == "tests"
|
|
10
|
-
Requires-Dist: pytest-xdist ; extra == "tests"
|
|
11
|
-
Requires-Dist: requests ; extra == "tests"
|
|
12
|
-
Requires-Dist: mypy ; extra == "tests"
|
|
13
|
-
Requires-Dist: types-requests ; extra == "tests"
|
|
14
|
-
Project-URL: Home, https://github.com/Quansight-labs/intersphinx_registry
|
|
15
|
-
Provides-Extra: tests
|
|
16
|
-
|
|
17
|
-
# Intersphinx Registry
|
|
18
|
-
|
|
19
|
-
A simple utility package that provide default inter sphinx mapping for a large chunk of the python ecosystem.
|
|
20
|
-
|
|
21
|
-
Usage in `conf.py`
|
|
22
|
-
|
|
23
|
-
```python
|
|
24
|
-
from intersphinx_registry import get_intersphinx_mapping
|
|
25
|
-
|
|
26
|
-
# ...
|
|
27
|
-
intersphinx_mapping = get_intersphinx_mapping(
|
|
28
|
-
packages={"ipython", "matplotlib", "pandas", "python"}
|
|
29
|
-
)
|
|
30
|
-
intersphinx_mapping.update({
|
|
31
|
-
'overwrite': ('<url>', None),
|
|
32
|
-
'my-package' : ('<url>', None),
|
|
33
|
-
})
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## quick lookup
|
|
37
|
-
|
|
38
|
-
You can use the following to lookup target/webpages of various packages.
|
|
39
|
-
|
|
40
|
-
Call without arguments to get help:
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
$ python -m intersphinx_registry.lookup
|
|
44
|
-
|
|
45
|
-
Usage: python -m intersphinx_registry.lookup <package>[,package] [search_term]
|
|
46
|
-
|
|
47
|
-
Example:
|
|
48
|
-
|
|
49
|
-
$ python -m intersphinx_registry.lookup numpy,scipy array
|
|
50
|
-
$ python -m intersphinx_registry.lookup ipython formatters.html
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
You can search multiple packages as once.
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
$ python -m intersphinx_registry.lookup numpy,scipy Universal
|
|
58
|
-
std:label ufuncs NumPy 2.1 'Universal functions (ufunc)' https://numpy.org/doc/stable/reference/ufuncs.html#ufuncs
|
|
59
|
-
std:label ufuncs-basics NumPy 2.1 'Universal functions (ufunc) basics' https://numpy.org/doc/stable/user/basics.ufuncs.html#ufuncs-basics
|
|
60
|
-
std:label ufuncs-internals NumPy 2.1 'Universal functions' https://numpy.org/doc/stable/dev/internals.code-explanations.html#ufuncs-internals
|
|
61
|
-
std:doc reference/ufuncs NumPy 2.1 'Universal functions (ufunc)' https://numpy.org/doc/stable/reference/ufuncs.html
|
|
62
|
-
std:doc user/basics.ufuncs NumPy 2.1 'Universal functions (ufunc) basics' https://numpy.org/doc/stable/user/basics.ufuncs.html
|
|
63
|
-
std:label non-uniform-random-number-sampling SciPy 1.14.1 'Universal Non-Uniform Random Number Sampling in SciPy' https://docs.scipy.org/doc/scipy/tutorial/stats/sampling.html#non-uniform-random-number-sampling
|
|
64
|
-
std:doc tutorial/stats/sampling SciPy 1.14.1 'Universal Non-Uniform Random Number Sampling in SciPy' https://docs.scipy.org/doc/scipy/tutorial/stats/sampling.html
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Warning, there is no cache, it downloads the inventory of each mentioned package every time.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
## Why ?
|
|
71
|
-
|
|
72
|
-
Sometime packages docs move and it's hard to keep track of. We _try_ to keep the
|
|
73
|
-
registry up to date, so yo do not have to ask yourself questions and update your
|
|
74
|
-
intersphinx-mapping.
|
|
75
|
-
|
|
76
|
-
You also might not want to think about adding intersphinx mapping when you refer
|
|
77
|
-
to dependencies.
|
|
78
|
-
|
|
79
|
-
## A package url is wrong !
|
|
80
|
-
|
|
81
|
-
Please send a PR updating only this package in the `registry.json`. We try to
|
|
82
|
-
link only to _stable_ package, not dev versions.
|
|
83
|
-
|
|
84
|
-
## A package is missing !
|
|
85
|
-
|
|
86
|
-
We can't do all packages, but if you think a package is widely used and missing,
|
|
87
|
-
please send a PR.
|
|
88
|
-
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
intersphinx_registry/__init__.py,sha256=CLRYH6y4UUxQiJQUpvuaeDisoq-ZbkyVtH8GG1FIrxw,1813
|
|
2
|
-
intersphinx_registry/_info.py,sha256=wlicM8WkAaykwDkeyp5JRGgYOG3Kp7diu0bjBlYfH9M,2223
|
|
3
|
-
intersphinx_registry/lookup.py,sha256=cCOpg_Xmr0l7bvRvmHi6V_yrVDPWtgpSGRgUJf8YqFk,2298
|
|
4
|
-
intersphinx_registry/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
intersphinx_registry/registry.json,sha256=0Y--5AOX1HVzLNNfYuyRUHJ1k-yrmc3GrFzv54o1MFM,12771
|
|
6
|
-
intersphinx_registry-0.2511.25.dist-info/licenses/LICENSE,sha256=j98x_c52nvqkLlr-U8tUaubJG3IBCIFEInYE4L_Yqqo,1086
|
|
7
|
-
intersphinx_registry-0.2511.25.dist-info/WHEEL,sha256=Dyt6SBfaasWElUrURkknVFAZDHSTwxg3PaTza7RSbkY,100
|
|
8
|
-
intersphinx_registry-0.2511.25.dist-info/METADATA,sha256=7GUH9SkIR7TjKG2gjI2w2QdpBRkjJ7EpgvCQ0GluvQ8,3555
|
|
9
|
-
intersphinx_registry-0.2511.25.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|