MartinPdeS-docs 0.2.0__tar.gz → 0.2.1__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.
- {martinpdes_docs-0.2.0 → martinpdes_docs-0.2.1}/MartinPdeS_docs.egg-info/PKG-INFO +5 -1
- {martinpdes_docs-0.2.0 → martinpdes_docs-0.2.1}/PKG-INFO +5 -1
- {martinpdes_docs-0.2.0 → martinpdes_docs-0.2.1}/README.md +4 -0
- {martinpdes_docs-0.2.0 → martinpdes_docs-0.2.1}/martinpdes_docs/sphinx.py +24 -3
- {martinpdes_docs-0.2.0 → martinpdes_docs-0.2.1}/pyproject.toml +1 -1
- {martinpdes_docs-0.2.0 → martinpdes_docs-0.2.1}/tests/test_configuration.py +17 -0
- {martinpdes_docs-0.2.0 → martinpdes_docs-0.2.1}/MartinPdeS_docs.egg-info/SOURCES.txt +0 -0
- {martinpdes_docs-0.2.0 → martinpdes_docs-0.2.1}/MartinPdeS_docs.egg-info/dependency_links.txt +0 -0
- {martinpdes_docs-0.2.0 → martinpdes_docs-0.2.1}/MartinPdeS_docs.egg-info/requires.txt +0 -0
- {martinpdes_docs-0.2.0 → martinpdes_docs-0.2.1}/MartinPdeS_docs.egg-info/top_level.txt +0 -0
- {martinpdes_docs-0.2.0 → martinpdes_docs-0.2.1}/martinpdes_docs/__init__.py +0 -0
- {martinpdes_docs-0.2.0 → martinpdes_docs-0.2.1}/martinpdes_docs/static/martinpdes_layout.css +0 -0
- {martinpdes_docs-0.2.0 → martinpdes_docs-0.2.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: MartinPdeS-docs
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Shared Sphinx configuration for MartinPdeS scientific Python packages.
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -57,3 +57,7 @@ globals().update(
|
|
|
57
57
|
|
|
58
58
|
Use `gallery_options` for project-specific Sphinx-Gallery settings such as an
|
|
59
59
|
additional image scraper or an example error policy.
|
|
60
|
+
|
|
61
|
+
For packages with compiled extensions, set `prefer_installed_package=True` so
|
|
62
|
+
documentation builds import the installed wheel instead of the source
|
|
63
|
+
checkout.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: MartinPdeS-docs
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Shared Sphinx configuration for MartinPdeS scientific Python packages.
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -57,3 +57,7 @@ globals().update(
|
|
|
57
57
|
|
|
58
58
|
Use `gallery_options` for project-specific Sphinx-Gallery settings such as an
|
|
59
59
|
additional image scraper or an example error policy.
|
|
60
|
+
|
|
61
|
+
For packages with compiled extensions, set `prefer_installed_package=True` so
|
|
62
|
+
documentation builds import the installed wheel instead of the source
|
|
63
|
+
checkout.
|
|
@@ -45,3 +45,7 @@ globals().update(
|
|
|
45
45
|
|
|
46
46
|
Use `gallery_options` for project-specific Sphinx-Gallery settings such as an
|
|
47
47
|
additional image scraper or an example error policy.
|
|
48
|
+
|
|
49
|
+
For packages with compiled extensions, set `prefer_installed_package=True` so
|
|
50
|
+
documentation builds import the installed wheel instead of the source
|
|
51
|
+
checkout.
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
from collections.abc import Mapping, Sequence
|
|
5
|
-
|
|
5
|
+
import sys
|
|
6
|
+
from importlib.metadata import (
|
|
7
|
+
PackageNotFoundError,
|
|
8
|
+
distribution,
|
|
9
|
+
version as distribution_version,
|
|
10
|
+
)
|
|
6
11
|
from pathlib import Path
|
|
7
12
|
|
|
8
13
|
|
|
@@ -35,6 +40,17 @@ def _resolve_version(package: str, version: str | None) -> str:
|
|
|
35
40
|
return "latest"
|
|
36
41
|
|
|
37
42
|
|
|
43
|
+
def _prefer_installed_package(package: str) -> None:
|
|
44
|
+
"""Put an installed distribution before the documentation checkout."""
|
|
45
|
+
try:
|
|
46
|
+
installed_site = str(distribution(package).locate_file(""))
|
|
47
|
+
except PackageNotFoundError:
|
|
48
|
+
return
|
|
49
|
+
|
|
50
|
+
sys.path[:] = [entry for entry in sys.path if entry != installed_site]
|
|
51
|
+
sys.path.insert(0, installed_site)
|
|
52
|
+
|
|
53
|
+
|
|
38
54
|
def configure(
|
|
39
55
|
*,
|
|
40
56
|
project: str,
|
|
@@ -49,6 +65,7 @@ def configure(
|
|
|
49
65
|
gallery_sections: Sequence[str] | None = None,
|
|
50
66
|
gallery_default_thumb: str | None = None,
|
|
51
67
|
gallery_options: Mapping[str, object] | None = None,
|
|
68
|
+
prefer_installed_package: bool = False,
|
|
52
69
|
version: str | None = None,
|
|
53
70
|
source_suffix: str = ".rst",
|
|
54
71
|
master_doc: str = "index",
|
|
@@ -59,9 +76,13 @@ def configure(
|
|
|
59
76
|
keep project-specific settings below that call so they remain easy to
|
|
60
77
|
override. Pass ``gallery_sections`` when examples are split into named
|
|
61
78
|
directories; use ``gallery_default_thumb`` for a project-specific raster
|
|
62
|
-
fallback;
|
|
63
|
-
|
|
79
|
+
fallback; use ``gallery_options`` for less common Sphinx-Gallery settings;
|
|
80
|
+
and set ``prefer_installed_package`` for projects whose documentation must
|
|
81
|
+
import a built wheel instead of the source checkout.
|
|
64
82
|
"""
|
|
83
|
+
if prefer_installed_package:
|
|
84
|
+
_prefer_installed_package(package)
|
|
85
|
+
|
|
65
86
|
resolved_version = _resolve_version(package, version)
|
|
66
87
|
|
|
67
88
|
default_extensions = [
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
from importlib.metadata import distribution
|
|
2
|
+
import sys
|
|
3
|
+
|
|
1
4
|
from martinpdes_docs import configure
|
|
2
5
|
|
|
3
6
|
|
|
@@ -79,3 +82,17 @@ def test_version_can_be_resolved_from_the_environment(monkeypatch):
|
|
|
79
82
|
)
|
|
80
83
|
|
|
81
84
|
assert config["html_theme_options"]["switcher"]["version_match"] == "v2.3.4"
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def test_installed_package_can_be_preferred(monkeypatch):
|
|
88
|
+
installed_site = str(distribution("MartinPdeS-docs").locate_file(""))
|
|
89
|
+
monkeypatch.setattr(sys, "path", ["checkout", installed_site, "other"])
|
|
90
|
+
|
|
91
|
+
configure(
|
|
92
|
+
project="Example",
|
|
93
|
+
package="MartinPdeS-docs",
|
|
94
|
+
prefer_installed_package=True,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
assert sys.path[0] == installed_site
|
|
98
|
+
assert sys.path.count(installed_site) == 1
|
|
File without changes
|
{martinpdes_docs-0.2.0 → martinpdes_docs-0.2.1}/MartinPdeS_docs.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{martinpdes_docs-0.2.0 → martinpdes_docs-0.2.1}/martinpdes_docs/static/martinpdes_layout.css
RENAMED
|
File without changes
|
|
File without changes
|