|
41 | 41 | # The full version, including alpha/beta/rc tags
|
42 | 42 | release = lightning.__version__
|
43 | 43 |
|
44 |
| -# Options for the linkcode extension |
45 |
| -# ---------------------------------- |
46 |
| -github_user = "Lightning-AI" |
47 |
| -github_repo = project |
48 |
| - |
49 | 44 | # -- Project documents -------------------------------------------------------
|
50 | 45 |
|
51 | 46 | if _FETCH_S3_ASSETS:
|
|
71 | 66 | "sphinx_toolbox.collapse",
|
72 | 67 | "sphinx.ext.todo",
|
73 | 68 | "sphinx.ext.coverage",
|
74 |
| - "sphinx.ext.linkcode", |
| 69 | + # "sphinx.ext.linkcode", |
75 | 70 | "sphinx.ext.autosummary",
|
76 | 71 | "sphinx.ext.napoleon",
|
77 | 72 | # 'sphinxcontrib.mockautodoc', # raises error: directive 'automodule' is already registered ...
|
@@ -324,15 +319,6 @@ def setup(app):
|
324 | 319 | app.add_js_file("copybutton.js")
|
325 | 320 | app.add_css_file("main.css")
|
326 | 321 |
|
327 |
| - |
328 |
| -# copy all notebooks to local folder |
329 |
| -path_nbs = os.path.join(_PATH_HERE, "notebooks") |
330 |
| -if not os.path.isdir(path_nbs): |
331 |
| - os.mkdir(path_nbs) |
332 |
| -for path_ipynb in glob.glob(os.path.join(_PATH_ROOT, "notebooks", "*.ipynb")): |
333 |
| - path_ipynb2 = os.path.join(path_nbs, os.path.basename(path_ipynb)) |
334 |
| - shutil.copy(path_ipynb, path_ipynb2) |
335 |
| - |
336 | 322 | # copy all examples to local folder
|
337 | 323 | path_examples = os.path.join(_PATH_HERE, "..", "examples")
|
338 | 324 | if not os.path.isdir(path_examples):
|
@@ -370,44 +356,6 @@ def _package_list_from_file(file):
|
370 | 356 | autodoc_mock_imports = MOCK_PACKAGES
|
371 | 357 |
|
372 | 358 |
|
373 |
| -# Resolve function |
374 |
| -# This function is used to populate the (source-app) links in the API |
375 |
| -def linkcode_resolve(domain, info): |
376 |
| - def find_source(): |
377 |
| - # try to find the file and line number, based on code from numpy: |
378 |
| - # https://github.com/numpy/numpy/blob/master/doc/source/conf.py#L286 |
379 |
| - obj = sys.modules[info["module"]] |
380 |
| - for part in info["fullname"].split("."): |
381 |
| - obj = getattr(obj, part) |
382 |
| - fname = inspect.getsourcefile(obj) |
383 |
| - # https://github.com/rtfd/readthedocs.org/issues/5735 |
384 |
| - if any(s in fname for s in ("readthedocs", "rtfd", "checkouts")): |
385 |
| - # /home/docs/checkouts/readthedocs.org/user_builds/pytorch_lightning/checkouts/ |
386 |
| - # devel/pytorch_lightning/utilities/cls_experiment.py#L26-L176 |
387 |
| - path_top = os.path.abspath(os.path.join("..", "..", "..")) |
388 |
| - fname = os.path.relpath(fname, start=path_top) |
389 |
| - else: |
390 |
| - # Local build, imitate master |
391 |
| - fname = "master/" + os.path.relpath(fname, start=os.path.abspath("..")) |
392 |
| - source, lineno = inspect.getsourcelines(obj) |
393 |
| - return fname, lineno, lineno + len(source) - 1 |
394 |
| - |
395 |
| - if domain != "py" or not info["module"]: |
396 |
| - return None |
397 |
| - try: |
398 |
| - filename = "%s#L%d-L%d" % find_source() |
399 |
| - except Exception: |
400 |
| - filename = info["module"].replace(".", "/") + ".py" |
401 |
| - # import subprocess |
402 |
| - # tag = subprocess.Popen(['git', 'rev-parse', 'HEAD'], stdout=subprocess.PIPE, |
403 |
| - # universal_newlines=True).communicate()[0][:-1] |
404 |
| - branch = filename.split("/")[0] |
405 |
| - # do mapping from latest tags to master |
406 |
| - branch = {"latest": "master", "stable": "master"}.get(branch, branch) |
407 |
| - filename = "/".join([branch] + filename.split("/")[1:]) |
408 |
| - return f"https://github.com/{github_user}/{github_repo}/blob/{filename}" |
409 |
| - |
410 |
| - |
411 | 359 | autosummary_generate = True
|
412 | 360 |
|
413 | 361 | autodoc_member_order = "groupwise"
|
|
0 commit comments