pyrefdev 2025.2__tar.gz → 2025.4__tar.gz

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.
Files changed (32) hide show
  1. pyrefdev-2025.4/.github/workflows/ci.yml +39 -0
  2. {pyrefdev-2025.2 → pyrefdev-2025.4}/.gitignore +2 -0
  3. pyrefdev-2025.4/CHANGELOG.md +21 -0
  4. {pyrefdev-2025.2 → pyrefdev-2025.4}/PKG-INFO +32 -4
  5. {pyrefdev-2025.2 → pyrefdev-2025.4}/README.md +29 -2
  6. {pyrefdev-2025.2 → pyrefdev-2025.4}/index.html +97 -42
  7. {pyrefdev-2025.2 → pyrefdev-2025.4}/pyproject.toml +7 -1
  8. pyrefdev-2025.4/src/pyrefdev/_version.py +1 -0
  9. pyrefdev-2025.4/src/pyrefdev/config.py +67 -0
  10. {pyrefdev-2025.2 → pyrefdev-2025.4}/src/pyrefdev/indexer/__main__.py +5 -1
  11. pyrefdev-2025.4/src/pyrefdev/indexer/add_docs.py +49 -0
  12. {pyrefdev-2025.2 → pyrefdev-2025.4}/src/pyrefdev/indexer/crawl_docs.py +44 -48
  13. {pyrefdev-2025.2 → pyrefdev-2025.4}/src/pyrefdev/indexer/parse_docs.py +71 -37
  14. pyrefdev-2025.4/src/pyrefdev/indexer/update_docs.py +16 -0
  15. pyrefdev-2025.4/src/pyrefdev/mapping/__init__.py +21 -0
  16. pyrefdev-2025.4/src/pyrefdev/mapping/dateutil.py +90 -0
  17. pyrefdev-2025.4/src/pyrefdev/mapping/numpy.py +2225 -0
  18. pyrefdev-2025.4/src/pyrefdev/mapping/pandas.py +2135 -0
  19. pyrefdev-2025.4/src/pyrefdev/mapping/requests.py +155 -0
  20. pyrefdev-2025.4/src/pyrefdev/mapping/urllib3.py +264 -0
  21. {pyrefdev-2025.2 → pyrefdev-2025.4}/src/pyrefdev/server.py +1 -1
  22. pyrefdev-2025.4/tests/test_mapping.py +6 -0
  23. {pyrefdev-2025.2 → pyrefdev-2025.4}/uv.lock +120 -109
  24. pyrefdev-2025.2/CHANGELOG.md +0 -9
  25. pyrefdev-2025.2/src/pyrefdev/_version.py +0 -1
  26. pyrefdev-2025.2/src/pyrefdev/indexer/config.py +0 -9
  27. {pyrefdev-2025.2 → pyrefdev-2025.4}/.github/workflows/pypi_upload.yml +0 -0
  28. {pyrefdev-2025.2 → pyrefdev-2025.4}/LICENSE +0 -0
  29. {pyrefdev-2025.2 → pyrefdev-2025.4}/pyrefdev.service +0 -0
  30. {pyrefdev-2025.2 → pyrefdev-2025.4}/src/pyrefdev/__init__.py +0 -0
  31. {pyrefdev-2025.2 → pyrefdev-2025.4}/src/pyrefdev/__main__.py +0 -0
  32. /pyrefdev-2025.2/src/pyrefdev/mapping.py → /pyrefdev-2025.4/src/pyrefdev/mapping/__python__.py +0 -0
@@ -0,0 +1,39 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+
9
+ permissions: {}
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ${{ matrix.os }}
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ os: [macos-latest, ubuntu-latest, windows-latest]
18
+ python-version:
19
+ - "3.10"
20
+ - "3.11"
21
+ - "3.12"
22
+ - "3.13"
23
+ - "3.13t"
24
+ - "3.14"
25
+ - "3.14t"
26
+ steps:
27
+ - name: Install uv
28
+ uses: astral-sh/setup-uv@v6
29
+ with:
30
+ version: "latest"
31
+ python-version: ${{ matrix.python-version }}
32
+ - uses: actions/checkout@v4
33
+ with:
34
+ fetch-depth: 0
35
+ persist-credentials: false
36
+ - name: Build pyrefdev
37
+ run: uv sync --locked --dev
38
+ - name: Run pytest
39
+ run: uv run pytest
@@ -1,3 +1,5 @@
1
+ .DS_Store
2
+
1
3
  # Hatch-managed version file
2
4
  src/pyrefdev/_version.py
3
5
 
@@ -0,0 +1,21 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ - Fix a bug in the crawler where relative paths aren't joined correctly.
6
+ - Support [pandas](https://pandas.pydata.org/docs/reference/index.html)
7
+ - Support [urllib3](https://urllib3.readthedocs.io/en/stable/reference/index.html)
8
+ - Support [requests](https://requests.readthedocs.io/en/latest/)
9
+
10
+ ## v2025.3
11
+
12
+ - Support [numpy](https://numpy.org/doc/stable/reference/index.html).
13
+
14
+ ## v2025.2
15
+
16
+ - Added a new `pyrefdev-indexer` CLI to `crawl-docs` and `parse-docs`. The `mapping.py` is now reproducible and easily updatable when Python 3.14 is released.
17
+ - Update the mappings.
18
+
19
+ ## v2025.1
20
+
21
+ Initial release.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyrefdev
3
- Version: 2025.2
3
+ Version: 2025.4
4
4
  Summary: The entry point to Python reference docs
5
5
  Project-URL: Home, https://pyref.dev
6
6
  Project-URL: Source, https://github.com/mangoumbrella/pyref.dev
@@ -14,11 +14,12 @@ Classifier: Intended Audience :: Developers
14
14
  Classifier: Operating System :: OS Independent
15
15
  Classifier: Programming Language :: Python
16
16
  Classifier: Programming Language :: Python :: 3 :: Only
17
- Classifier: Programming Language :: Python :: 3.9
18
17
  Classifier: Programming Language :: Python :: 3.10
19
18
  Classifier: Programming Language :: Python :: 3.11
20
19
  Classifier: Programming Language :: Python :: 3.12
21
20
  Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Programming Language :: Python :: Free Threading
22
23
  Classifier: Topic :: Documentation
23
24
  Requires-Python: >=3.10
24
25
  Requires-Dist: yib>=0.2.0
@@ -41,7 +42,7 @@ Description-Content-Type: text/markdown
41
42
  <a href="https://github.com/mangoumbrella/pyref.dev/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/pypi/l/pyrefdev.svg"></a>
42
43
  </p>
43
44
 
44
- It allows you to quickly jump to the official documentation for any Python standard library module, class, or function by using a simple URL pattern:
45
+ It allows you to quickly jump to the official documentation for Python standard library modules and popular packages by using a simple URL pattern:
45
46
 
46
47
  ```
47
48
  https://pyref.dev/<fully.qualified.symbol.name>
@@ -54,8 +55,35 @@ Alternatively, you could also `pip install pyrefdev` and run the `pyrefdev` CLI
54
55
  * https://pyref.dev/json
55
56
  * https://pyref.dev/pathlib.Path
56
57
  * https://pyref.dev/datetime.datetime.strftime
58
+ * https://pyref.dev/numpy.array
57
59
 
58
- For now, the symbols are case-insensitive.
60
+ ## Supported packages
61
+
62
+ See [pyref.dev](https://pyref.dev/#supported-packages) for the list of supported packages.
63
+
64
+ # Case sensitivity
65
+
66
+ For most of the cases, they are case-insensitive. However, for symbols like `typing.final` and `typing.Final`, you need to access them with the correct case.
67
+
68
+ ## Server setup
69
+
70
+ To set up a new server:
71
+
72
+ ```bash
73
+ > git clone https://github.com/mangoumbrella/pyref.dev
74
+ > cd pyref.dev
75
+ > sudo cp pyrefdev.service /etc/systemd/system/pyrefdev.service
76
+ > systemctl start pyrefdev.service
77
+ ```
78
+
79
+ To update to a new version:
80
+
81
+ ```bash
82
+ > cd pyref.dev
83
+ > git pull
84
+ > uv sync --all-extras
85
+ > systemctl restart pyrefdev.service
86
+ ```
59
87
 
60
88
  ## Changelog
61
89
 
@@ -8,7 +8,7 @@
8
8
  <a href="https://github.com/mangoumbrella/pyref.dev/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/pypi/l/pyrefdev.svg"></a>
9
9
  </p>
10
10
 
11
- It allows you to quickly jump to the official documentation for any Python standard library module, class, or function by using a simple URL pattern:
11
+ It allows you to quickly jump to the official documentation for Python standard library modules and popular packages by using a simple URL pattern:
12
12
 
13
13
  ```
14
14
  https://pyref.dev/<fully.qualified.symbol.name>
@@ -21,8 +21,35 @@ Alternatively, you could also `pip install pyrefdev` and run the `pyrefdev` CLI
21
21
  * https://pyref.dev/json
22
22
  * https://pyref.dev/pathlib.Path
23
23
  * https://pyref.dev/datetime.datetime.strftime
24
+ * https://pyref.dev/numpy.array
24
25
 
25
- For now, the symbols are case-insensitive.
26
+ ## Supported packages
27
+
28
+ See [pyref.dev](https://pyref.dev/#supported-packages) for the list of supported packages.
29
+
30
+ # Case sensitivity
31
+
32
+ For most of the cases, they are case-insensitive. However, for symbols like `typing.final` and `typing.Final`, you need to access them with the correct case.
33
+
34
+ ## Server setup
35
+
36
+ To set up a new server:
37
+
38
+ ```bash
39
+ > git clone https://github.com/mangoumbrella/pyref.dev
40
+ > cd pyref.dev
41
+ > sudo cp pyrefdev.service /etc/systemd/system/pyrefdev.service
42
+ > systemctl start pyrefdev.service
43
+ ```
44
+
45
+ To update to a new version:
46
+
47
+ ```bash
48
+ > cd pyref.dev
49
+ > git pull
50
+ > uv sync --all-extras
51
+ > systemctl restart pyrefdev.service
52
+ ```
26
53
 
27
54
  ## Changelog
28
55
 
@@ -17,18 +17,18 @@
17
17
  --gray-600: #6c757d;
18
18
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
19
19
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
20
- --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
21
- --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
22
- --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
20
+ --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
21
+ --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
22
+ --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
23
23
  --header-height: 60px;
24
24
  }
25
-
25
+
26
26
  * {
27
27
  margin: 0;
28
28
  padding: 0;
29
29
  box-sizing: border-box;
30
30
  }
31
-
31
+
32
32
  body {
33
33
  font-family: var(--font-sans);
34
34
  background: var(--light);
@@ -40,22 +40,20 @@
40
40
  position: relative;
41
41
  padding-top: var(--header-height);
42
42
  }
43
-
43
+
44
44
  .header {
45
45
  position: fixed;
46
46
  top: 0;
47
47
  left: 0;
48
48
  right: 0;
49
49
  height: var(--header-height);
50
- /* background-color: white; */
51
- /* box-shadow: var(--shadow-sm); */
52
50
  z-index: 100;
53
51
  display: flex;
54
52
  justify-content: flex-end;
55
53
  align-items: center;
56
54
  padding: 0 1.5rem;
57
55
  }
58
-
56
+
59
57
  .container {
60
58
  width: 90%;
61
59
  max-width: 800px;
@@ -63,13 +61,13 @@
63
61
  padding: 2rem 1.5rem;
64
62
  margin: 0 auto;
65
63
  }
66
-
64
+
67
65
  .logo {
68
66
  margin-bottom: 2rem;
69
67
  position: relative;
70
68
  display: inline-block;
71
69
  }
72
-
70
+
73
71
  .logo::before {
74
72
  content: '';
75
73
  position: absolute;
@@ -82,30 +80,30 @@
82
80
  z-index: -1;
83
81
  opacity: 0.6;
84
82
  }
85
-
83
+
86
84
  h1 {
87
85
  font-size: 3.5rem;
88
86
  font-weight: 800;
89
87
  margin-bottom: 1rem;
90
88
  letter-spacing: -0.05em;
91
89
  }
92
-
90
+
93
91
  h1 .py-blue {
94
92
  color: var(--python-blue);
95
93
  }
96
-
94
+
97
95
  h1 .py-yellow {
98
96
  color: var(--python-yellow);
99
97
  position: relative;
100
98
  }
101
-
99
+
102
100
  .tagline {
103
101
  font-size: 1.4rem;
104
102
  margin-bottom: 2.5rem;
105
103
  color: var(--gray-600);
106
104
  font-weight: 500;
107
105
  }
108
-
106
+
109
107
  p {
110
108
  font-size: 1.2rem;
111
109
  margin-bottom: 2rem;
@@ -114,7 +112,7 @@
114
112
  margin-left: auto;
115
113
  margin-right: auto;
116
114
  }
117
-
115
+
118
116
  .url-pattern {
119
117
  display: inline-block;
120
118
  padding: 1rem 1.5rem;
@@ -128,14 +126,14 @@
128
126
  box-shadow: var(--shadow-sm);
129
127
  word-break: break-all;
130
128
  }
131
-
132
- .examples-title {
129
+
130
+ .section-title {
133
131
  font-weight: 600;
134
132
  color: var(--dark);
135
133
  margin-bottom: 1rem;
136
134
  font-size: 1.3rem;
137
135
  }
138
-
136
+
139
137
  .examples-list {
140
138
  list-style: none;
141
139
  background-color: white;
@@ -146,7 +144,7 @@
146
144
  text-align: left;
147
145
  width: 100%;
148
146
  }
149
-
147
+
150
148
  .examples-list li {
151
149
  margin-bottom: 1rem;
152
150
  padding-bottom: 1rem;
@@ -154,7 +152,7 @@
154
152
  position: relative;
155
153
  padding-left: 1.5rem;
156
154
  }
157
-
155
+
158
156
  .examples-list li::before {
159
157
  content: '→';
160
158
  position: absolute;
@@ -162,13 +160,13 @@
162
160
  color: var(--python-green);
163
161
  font-weight: bold;
164
162
  }
165
-
163
+
166
164
  .examples-list li:last-child {
167
165
  margin-bottom: 0;
168
166
  padding-bottom: 0;
169
167
  border-bottom: none;
170
168
  }
171
-
169
+
172
170
  .examples-list a {
173
171
  color: var(--python-blue);
174
172
  text-decoration: none;
@@ -178,12 +176,47 @@
178
176
  word-break: break-all;
179
177
  display: inline-block;
180
178
  }
181
-
179
+
182
180
  .examples-list a:hover {
183
181
  text-decoration: underline;
184
182
  color: var(--python-green);
185
183
  }
186
-
184
+
185
+ .supported-packages {
186
+ list-style: none;
187
+ background-color: white;
188
+ border-radius: 10px;
189
+ padding: 1.5rem;
190
+ margin-bottom: 2.5rem;
191
+ box-shadow: var(--shadow-md);
192
+ text-align: left;
193
+ width: 100%;
194
+ }
195
+
196
+ .supported-packages li {
197
+ margin-bottom: 1rem;
198
+ padding-bottom: 1rem;
199
+ border-bottom: 1px solid var(--gray-200);
200
+ }
201
+
202
+ .supported-packages li:last-child {
203
+ margin-bottom: 0;
204
+ padding-bottom: 0;
205
+ border-bottom: none;
206
+ }
207
+
208
+ .package-name {
209
+ font-weight: 600;
210
+ font-size: 1rem;
211
+ text-decoration: none;
212
+ transition: color 0.2s ease;
213
+ color: var(--python-blue);
214
+ }
215
+
216
+ .package-name:hover {
217
+ text-decoration: underline;
218
+ }
219
+
187
220
  .github-link {
188
221
  display: inline-flex;
189
222
  align-items: center;
@@ -198,73 +231,82 @@
198
231
  border: 1px solid var(--python-blue);
199
232
  box-shadow: var(--shadow-sm);
200
233
  }
201
-
234
+
202
235
  .github-link:hover {
203
236
  background: white;
204
237
  color: var(--python-blue);
205
238
  transform: translateY(-1px);
206
239
  box-shadow: var(--shadow-md);
207
240
  }
208
-
241
+
209
242
  .github-link svg {
210
243
  margin-right: 0.5rem;
211
244
  }
212
-
245
+
213
246
  .footer {
214
247
  margin-top: 3rem;
215
248
  color: var(--gray-600);
216
249
  font-size: 0.9rem;
217
250
  }
218
-
251
+
219
252
  @media (max-width: 600px) {
220
253
  h1 {
221
254
  font-size: 2.8rem;
222
255
  }
223
-
256
+
224
257
  .tagline {
225
258
  font-size: 1.2rem;
226
259
  }
227
-
260
+
228
261
  p {
229
262
  font-size: 1.1rem;
230
263
  }
231
-
264
+
232
265
  .url-pattern {
233
266
  font-size: 0.9rem;
234
267
  padding: 0.8rem 1rem;
235
268
  }
236
-
269
+
237
270
  .logo::before {
238
271
  width: 50px;
239
272
  height: 50px;
240
273
  top: -12px;
241
274
  left: -20px;
242
275
  }
243
-
276
+
244
277
  .examples-list {
245
278
  padding: 1.2rem 1rem;
246
279
  }
247
-
280
+
248
281
  .examples-list a {
249
282
  font-size: 0.85rem;
250
283
  }
251
-
284
+
252
285
  .examples-list li {
253
286
  padding-left: 1.2rem;
254
287
  margin-bottom: 0.8rem;
255
288
  padding-bottom: 0.8rem;
256
289
  }
257
-
290
+
291
+ .supported-packages {
292
+ padding: 1.2rem 1rem;
293
+ }
294
+
295
+ .supported-packages li {
296
+ margin-bottom: 0.8rem;
297
+ padding-bottom: 0.8rem;
298
+ }
299
+
258
300
  .github-link {
259
301
  padding: 0.5rem 0.8rem;
260
302
  font-size: 0.8rem;
261
303
  }
262
-
304
+
263
305
  .github-link svg {
264
306
  width: 18px;
265
307
  height: 18px;
266
308
  }
267
-
309
+
268
310
  .header {
269
311
  padding: 0 1rem;
270
312
  }
@@ -285,13 +327,26 @@
285
327
  <h1><span class="py-blue">pyref</span>.<span class="py-yellow">dev</span></h1>
286
328
  </div>
287
329
  <p class="tagline">A fast, convenient way to access Python reference docs.</p>
288
- <p>Quickly jump to the official documentation for any Python standard library module, class, or function by using a simple URL pattern:</p>
330
+ <p>Quickly jump to the official documentation for Python standard library modules and popular packages by using a simple URL pattern:</p>
289
331
  <div class="url-pattern">https://pyref.dev/&lt;fully.qualified.symbol.name&gt;</div>
290
- <p class="examples-title">Examples</p>
332
+
333
+ <p class="section-title">Examples</p>
291
334
  <ul class="examples-list">
292
335
  <li><a href="https://pyref.dev/json">https://pyref.dev/json</a></li>
293
336
  <li><a href="https://pyref.dev/pathlib.Path">https://pyref.dev/pathlib.Path</a></li>
294
337
  <li><a href="https://pyref.dev/datetime.datetime.strftime">https://pyref.dev/datetime.datetime.strftime</a></li>
338
+ <li><a href="https://pyref.dev/numpy.array">https://pyref.dev/numpy.array</a></li>
339
+ </ul>
340
+
341
+ <p id="supported-packages" class="section-title">Supported Packages</p>
342
+ <ul class="supported-packages">
343
+ <li><a href="https://docs.python.org/3/library/" class="package-name">Python Standard Library</a></li>
344
+ <li><a href="https://numpy.org/doc/stable/reference/index.html" class="package-name">numpy</a></li>
345
+ <li><a href="https://pandas.pydata.org/docs/reference/index.html" class="package-name">pandas</a></li>
346
+ <li><a href="https://urllib3.readthedocs.io/en/stable/reference/index.html" class="package-name">urllib3</a></li>
347
+ <li><a href="https://requests.readthedocs.io/en/latest/" class="package-name">requests</a></li>
348
+ <li><a href="https://dateutil.readthedocs.io/en/stable/" class="package-name">python-dateutil</a></li>
349
+ <!-- ENTRY-LINE-MARKER -->
295
350
  </ul>
296
351
  </div>
297
352
  </body>
@@ -16,11 +16,12 @@ classifiers = [
16
16
  "Intended Audience :: Developers",
17
17
  "Operating System :: OS Independent",
18
18
  "Programming Language :: Python",
19
- "Programming Language :: Python :: 3.9",
20
19
  "Programming Language :: Python :: 3.10",
21
20
  "Programming Language :: Python :: 3.11",
22
21
  "Programming Language :: Python :: 3.12",
23
22
  "Programming Language :: Python :: 3.13",
23
+ "Programming Language :: Python :: 3.14",
24
+ "Programming Language :: Python :: Free Threading",
24
25
  "Programming Language :: Python :: 3 :: Only",
25
26
  "Topic :: Documentation",
26
27
  ]
@@ -60,3 +61,8 @@ version-file = "src/pyrefdev/_version.py"
60
61
  template = '''
61
62
  version = "{version}"
62
63
  '''
64
+
65
+ [dependency-groups]
66
+ dev = [
67
+ "pytest>=8.4.1",
68
+ ]
@@ -0,0 +1 @@
1
+ version = "2025.4"
@@ -0,0 +1,67 @@
1
+ import dataclasses
2
+
3
+ from yib import yconsole
4
+
5
+
6
+ console = yconsole.Console(stderr=True)
7
+
8
+
9
+ @dataclasses.dataclass
10
+ class Package:
11
+ package: str
12
+ pypi: str
13
+ index: str # The URL for pyref.dev/<name>.
14
+ crawler_root: str # The seed and root URL for crawler.
15
+
16
+ def is_stdlib(self):
17
+ return self.package == "__python__"
18
+
19
+
20
+ SUPPORTED_PACKAGES: dict[str, Package] = {
21
+ "__python__": Package(
22
+ package="__python__",
23
+ pypi="__python__",
24
+ index="https://docs.python.org/3/library",
25
+ crawler_root="https://docs.python.org/3/",
26
+ ),
27
+ "numpy": Package(
28
+ package="numpy",
29
+ pypi="numpy",
30
+ index="https://numpy.org/doc/stable/reference/index.html",
31
+ crawler_root="https://numpy.org/doc/stable/reference/",
32
+ ),
33
+ "pandas": Package(
34
+ package="pandas",
35
+ pypi="pandas",
36
+ index="https://pandas.pydata.org/docs/reference/index.html",
37
+ crawler_root="https://pandas.pydata.org/docs/reference/",
38
+ ),
39
+ "urllib3": Package(
40
+ package="urllib3",
41
+ pypi="urllib3",
42
+ index="https://urllib3.readthedocs.io/en/stable/reference/index.html",
43
+ crawler_root="https://urllib3.readthedocs.io/en/stable/reference/",
44
+ ),
45
+ "requests": Package(
46
+ package="requests",
47
+ pypi="requests",
48
+ index="https://requests.readthedocs.io/en/latest/",
49
+ crawler_root="https://requests.readthedocs.io/en/latest/",
50
+ ),
51
+ "dateutil": Package(
52
+ package="dateutil",
53
+ pypi="python-dateutil",
54
+ index="https://dateutil.readthedocs.io/en/stable/",
55
+ crawler_root="https://dateutil.readthedocs.io/en/stable/",
56
+ ),
57
+ # ENTRY-LINE-MARKER
58
+ }
59
+
60
+
61
+ def get_packages(package: str | None) -> list[Package]:
62
+ if package is None:
63
+ return list(SUPPORTED_PACKAGES.values())
64
+ else:
65
+ if package not in SUPPORTED_PACKAGES:
66
+ console.fatal(f"No package named {package}")
67
+ return [SUPPORTED_PACKAGES[package]]
@@ -1,9 +1,11 @@
1
1
  import cyclopts
2
2
 
3
3
  import pyrefdev
4
+ from pyrefdev.indexer.add_docs import add_docs
4
5
  from pyrefdev.indexer.crawl_docs import crawl_docs
5
6
  from pyrefdev.indexer.parse_docs import parse_docs
6
- from pyrefdev.indexer.config import console
7
+ from pyrefdev.indexer.update_docs import update_docs
8
+ from pyrefdev.config import console
7
9
 
8
10
 
9
11
  app = cyclopts.App(
@@ -12,8 +14,10 @@ app = cyclopts.App(
12
14
  version=pyrefdev.__version__,
13
15
  console=console,
14
16
  )
17
+ app.command(add_docs)
15
18
  app.command(crawl_docs)
16
19
  app.command(parse_docs)
20
+ app.command(update_docs)
17
21
 
18
22
 
19
23
  if __name__ == "__main__":
@@ -0,0 +1,49 @@
1
+ import importlib
2
+ from pathlib import Path
3
+ import re
4
+
5
+ from pyrefdev import config
6
+ from pyrefdev import mapping
7
+ from pyrefdev.config import console
8
+ from pyrefdev.indexer.update_docs import update_docs
9
+
10
+
11
+ _MARKER = re.compile("(\n.*ENTRY-LINE-MARKER.*\n)")
12
+
13
+
14
+ def add_docs(
15
+ package: str,
16
+ *,
17
+ index: str,
18
+ crawler_root: str,
19
+ pypi: str | None = None,
20
+ docs_directory: Path | None = None,
21
+ ) -> None:
22
+ if package in config.SUPPORTED_PACKAGES:
23
+ console.fatal(f"Package exists: {package}")
24
+ pypi = pypi or package
25
+
26
+ config_entry = f"""
27
+ "{package}": Package(
28
+ package="{package}",
29
+ pypi="{pypi}",
30
+ index="{index}",
31
+ crawler_root="{crawler_root}",
32
+ ),"""
33
+ config_file = Path(config.__file__)
34
+ config_content = config_file.read_text()
35
+ config_content = _MARKER.sub(config_entry + r"\g<1>", config_content)
36
+ config_file.write_text(config_content)
37
+
38
+ mapping_file = Path(mapping.__file__).parent / f"{package}.py"
39
+ mapping_file.write_text("MAPPING = {}")
40
+
41
+ index_entry = f"""
42
+ <li><a href="{index}" class="package-name">{pypi}</a></li>"""
43
+ index_file = Path(config.__file__).parent.parent.parent / "index.html"
44
+ index_content = index_file.read_text()
45
+ index_content = _MARKER.sub(index_entry + r"\g<1>", index_content)
46
+ index_file.write_text(index_content)
47
+
48
+ importlib.reload(config)
49
+ update_docs(package, docs_directory=docs_directory)