uEdition 0.6.1__py3-none-any.whl → 0.8.0__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.
Potentially problematic release.
This version of uEdition might be problematic. Click here for more details.
- uedition/__about__.py +1 -1
- uedition/cli/__init__.py +2 -2
- uedition/cli/build.py +7 -0
- uedition/cli/check.py +1 -0
- uedition/cli/serve.py +1 -0
- uedition/ext/language_switcher.css +7 -0
- uedition/ext/language_switcher.js +1 -0
- uedition/ext/language_switcher.py +3 -0
- uedition/settings.py +71 -23
- {uedition-0.6.1.dist-info → uedition-0.8.0.dist-info}/METADATA +5 -4
- uedition-0.8.0.dist-info/RECORD +22 -0
- {uedition-0.6.1.dist-info → uedition-0.8.0.dist-info}/WHEEL +1 -1
- uedition-0.6.1.dist-info/RECORD +0 -21
- {uedition-0.6.1.dist-info → uedition-0.8.0.dist-info}/entry_points.txt +0 -0
- {uedition-0.6.1.dist-info → uedition-0.8.0.dist-info}/licenses/LICENSE.txt +0 -0
uedition/__about__.py
CHANGED
uedition/cli/__init__.py
CHANGED
|
@@ -60,13 +60,13 @@ def version() -> None:
|
|
|
60
60
|
print_cli(f'Configuration: {settings["version"]}')
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
@language_app.command()
|
|
63
|
+
@language_app.command("add")
|
|
64
64
|
def language_add(path: str) -> None:
|
|
65
65
|
"""Add a language to the μEdition."""
|
|
66
66
|
language_module.add(path)
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
@language_app.command()
|
|
69
|
+
@language_app.command("update")
|
|
70
70
|
def language_update(path: str) -> None:
|
|
71
71
|
"""Update a language."""
|
|
72
72
|
language_module.update(path)
|
uedition/cli/build.py
CHANGED
|
@@ -138,12 +138,19 @@ def config_build(lang: dict) -> None:
|
|
|
138
138
|
safe_dump(config, out_f, encoding="utf-8")
|
|
139
139
|
|
|
140
140
|
|
|
141
|
+
def static_build(lang: dict) -> None:
|
|
142
|
+
"""Copy the static files for a single language."""
|
|
143
|
+
if path.exists("static"):
|
|
144
|
+
copytree("static", path.join(lang["path"], "_static"), dirs_exist_ok=True)
|
|
145
|
+
|
|
146
|
+
|
|
141
147
|
def full_build(lang: dict) -> None:
|
|
142
148
|
"""Run the full build process for a single language."""
|
|
143
149
|
reload_settings()
|
|
144
150
|
landing_build()
|
|
145
151
|
toc_build(lang)
|
|
146
152
|
config_build(lang)
|
|
153
|
+
static_build(lang)
|
|
147
154
|
subprocess.run(
|
|
148
155
|
[
|
|
149
156
|
"jupyter-book",
|
uedition/cli/check.py
CHANGED
uedition/cli/serve.py
CHANGED
|
@@ -37,6 +37,7 @@ def run() -> None:
|
|
|
37
37
|
settings["languages"], full_rebuilds, partial_rebuilds
|
|
38
38
|
):
|
|
39
39
|
server.watch("*.yml", full_cmd)
|
|
40
|
+
server.watch(path.join("static", "**", "*.*"), full_cmd)
|
|
40
41
|
server.watch(path.join(lang["path"], "**", "*.*"), partial_cmd)
|
|
41
42
|
server.watch("uEdition.*", lambda: [cmd() for cmd in full_rebuilds])
|
|
42
43
|
server.serve(root="site", port=8000)
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
const button = document.createElement('button');
|
|
16
16
|
button.classList.add('btn');
|
|
17
17
|
button.classList.add('dropdown-toggle');
|
|
18
|
+
button.classList.add('ue-language-switcher');
|
|
18
19
|
button.setAttribute('aria-label', 'Switch to another language');
|
|
19
20
|
button.setAttribute('aria-expanded', 'false');
|
|
20
21
|
button.setAttribute('data-bs-toggle', 'dropdown');
|
|
@@ -18,6 +18,7 @@ def add_language_switcher(app: Sphinx) -> None:
|
|
|
18
18
|
None, body=f"""DOCUMENTATION_OPTIONS.UEDITION = {json.dumps(settings)}"""
|
|
19
19
|
)
|
|
20
20
|
app.add_js_file("language_switcher.js")
|
|
21
|
+
app.add_css_file("language_switcher.css")
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
def copy_custom_files(app: Sphinx, exc: bool) -> None:
|
|
@@ -27,6 +28,8 @@ def copy_custom_files(app: Sphinx, exc: bool) -> None:
|
|
|
27
28
|
ext_pkg = files("uedition.ext")
|
|
28
29
|
with as_file(ext_pkg / "language_switcher.js") as js_file:
|
|
29
30
|
copy_asset_file(str(js_file), staticdir)
|
|
31
|
+
with as_file(ext_pkg / "language_switcher.css") as css_file:
|
|
32
|
+
copy_asset_file(str(css_file), staticdir)
|
|
30
33
|
|
|
31
34
|
|
|
32
35
|
def setup(app: Sphinx) -> None:
|
uedition/settings.py
CHANGED
|
@@ -7,10 +7,59 @@ All application settings are accessed via the `settings` dictionary.
|
|
|
7
7
|
"""
|
|
8
8
|
import os
|
|
9
9
|
|
|
10
|
-
from pydantic import
|
|
11
|
-
from pydantic.
|
|
10
|
+
from pydantic import BaseModel
|
|
11
|
+
from pydantic.fields import FieldInfo
|
|
12
|
+
from pydantic_settings import BaseSettings, PydanticBaseSettingsSource
|
|
12
13
|
from yaml import safe_load
|
|
13
|
-
from typing import Any
|
|
14
|
+
from typing import Any, Type, Tuple, Dict
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class YAMLConfigSettingsSource(PydanticBaseSettingsSource):
|
|
18
|
+
"""Loads the configuration settings from a YAML file."""
|
|
19
|
+
|
|
20
|
+
def get_field_value(
|
|
21
|
+
self: "YAMLConfigSettingsSource", field: FieldInfo, field_name: str
|
|
22
|
+
) -> Tuple[Any, str, bool]:
|
|
23
|
+
"""Get the value of a specific field."""
|
|
24
|
+
encoding = self.config.get("env_file_encoding")
|
|
25
|
+
file_content_json = None
|
|
26
|
+
if os.path.exists("uEdition.yaml"):
|
|
27
|
+
with open("uEdition.yaml", encoding=encoding) as in_f:
|
|
28
|
+
file_content_json = safe_load(in_f)
|
|
29
|
+
elif os.path.exists("uEdition.yml"):
|
|
30
|
+
with open("uEdition.yml", encoding=encoding) as in_f:
|
|
31
|
+
file_content_json = safe_load(in_f)
|
|
32
|
+
if file_content_json is not None:
|
|
33
|
+
field_value = file_content_json.get(field_name)
|
|
34
|
+
else:
|
|
35
|
+
field_value = None
|
|
36
|
+
return field_value, field_name, False
|
|
37
|
+
|
|
38
|
+
def prepare_field_value(
|
|
39
|
+
self: "YAMLConfigSettingsSource",
|
|
40
|
+
field_name: str,
|
|
41
|
+
field: FieldInfo,
|
|
42
|
+
value: Any,
|
|
43
|
+
value_is_complex: bool,
|
|
44
|
+
) -> Any:
|
|
45
|
+
"""Just return the value."""
|
|
46
|
+
return value
|
|
47
|
+
|
|
48
|
+
def __call__(self: "YAMLConfigSettingsSource") -> Dict[str, Any]:
|
|
49
|
+
"""Call the loader."""
|
|
50
|
+
d: Dict[str, Any] = {}
|
|
51
|
+
|
|
52
|
+
for field_name, field in self.settings_cls.model_fields.items():
|
|
53
|
+
field_value, field_key, value_is_complex = self.get_field_value(
|
|
54
|
+
field, field_name
|
|
55
|
+
)
|
|
56
|
+
field_value = self.prepare_field_value(
|
|
57
|
+
field_name, field, field_value, value_is_complex
|
|
58
|
+
)
|
|
59
|
+
if field_value is not None:
|
|
60
|
+
d[field_key] = field_value
|
|
61
|
+
|
|
62
|
+
return d
|
|
14
63
|
|
|
15
64
|
|
|
16
65
|
def uedition_yaml_settings(settings: BaseSettings) -> dict[str, Any]:
|
|
@@ -75,26 +124,25 @@ class Settings(BaseSettings):
|
|
|
75
124
|
jb_config: dict = {}
|
|
76
125
|
"""Additional JupyterBook configuration."""
|
|
77
126
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
settings = Settings().dict()
|
|
127
|
+
@classmethod
|
|
128
|
+
def settings_customise_sources(
|
|
129
|
+
cls: Type["Settings"],
|
|
130
|
+
settings_cls: Type[BaseSettings],
|
|
131
|
+
init_settings: PydanticBaseSettingsSource,
|
|
132
|
+
env_settings: PydanticBaseSettingsSource,
|
|
133
|
+
dotenv_settings: PydanticBaseSettingsSource,
|
|
134
|
+
file_secret_settings: PydanticBaseSettingsSource,
|
|
135
|
+
) -> Tuple[PydanticBaseSettingsSource, ...]:
|
|
136
|
+
"""Customise the settings sources."""
|
|
137
|
+
return (
|
|
138
|
+
init_settings,
|
|
139
|
+
env_settings,
|
|
140
|
+
file_secret_settings,
|
|
141
|
+
YAMLConfigSettingsSource(settings_cls),
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
settings = Settings().model_dump()
|
|
98
146
|
|
|
99
147
|
|
|
100
148
|
def reload_settings() -> None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: uEdition
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Project-URL: Documentation, https://github.com/unknown/uedition#readme
|
|
5
5
|
Project-URL: Issues, https://github.com/unknown/uedition/issues
|
|
6
6
|
Project-URL: Source, https://github.com/unknown/uedition
|
|
@@ -14,11 +14,12 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
14
14
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
15
15
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
16
16
|
Requires-Python: >=3.10
|
|
17
|
-
Requires-Dist: copier<
|
|
17
|
+
Requires-Dist: copier<10.0.0,>=9.0.0
|
|
18
18
|
Requires-Dist: jupyter-book<1.0.0,>=0.15.1
|
|
19
19
|
Requires-Dist: livereload
|
|
20
|
-
Requires-Dist: lxml<
|
|
21
|
-
Requires-Dist: pydantic
|
|
20
|
+
Requires-Dist: lxml<6.0.0,>=4.9.2
|
|
21
|
+
Requires-Dist: pydantic-settings<3.0.0,>=2.0.0
|
|
22
|
+
Requires-Dist: pydantic<3.0.0,>=2.0.0
|
|
22
23
|
Requires-Dist: pyyaml<7.0.0,>=6.0.0
|
|
23
24
|
Requires-Dist: typer[all]<1.0.0
|
|
24
25
|
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
uedition/__about__.py,sha256=ZKY67hSUtUpZScVZxX9OP2T8_jgQEouuMOKpfXwtpjY,157
|
|
2
|
+
uedition/__init__.py,sha256=IfQLccTve4Bc-f7TpeuOwXWE03DFAJoWpveFacMiBSA,285
|
|
3
|
+
uedition/__main__.py,sha256=FpsS6LdCNPdC5twonoqvfrqWDyCNreKQz7t9ZeSHcLI,182
|
|
4
|
+
uedition/settings.py,sha256=n1L-c-gkvlowGSMuuH5UT_B2WBUMckQgy5Uu2md56fY,4708
|
|
5
|
+
uedition/cli/__init__.py,sha256=5-kozUHJCDa0-ii9fPq6GtZQCC2sQG1L5WiRHuPiKNg,1528
|
|
6
|
+
uedition/cli/build.py,sha256=Z9yQ2-FxcEGtoOPvWBiJpaCPJArKuScJEXdVr1Nw3pE,6204
|
|
7
|
+
uedition/cli/check.py,sha256=OE5Mis1PwCwqnVBk1waR4AyOVeGBzI5Rudp653hMKAw,7352
|
|
8
|
+
uedition/cli/create.py,sha256=Q-SvDq9VtmUP4DQhuuvt1eZ_72sX8_tcFOj2Bt_T6J8,371
|
|
9
|
+
uedition/cli/language.py,sha256=2UYF_rHZOsDEpBODzqOhztV1Kjq_lwef06NGO33Fo4o,2001
|
|
10
|
+
uedition/cli/serve.py,sha256=_Bcgk0JLhfHxipZHE6jm9kN5_5Ksf-HjK4uThUmc3ac,1341
|
|
11
|
+
uedition/cli/update.py,sha256=xzMnXXJmC1ZuyWjZQC-Cd9LCnbu6ZxybjwDX-4VomoM,357
|
|
12
|
+
uedition/ext/__init__.py,sha256=p7I0TUjlm2Gsg8x3M9Ymc7Xa62DP8ExdzWwCaIgdhQg,395
|
|
13
|
+
uedition/ext/config.py,sha256=Fo4uxc9lskB0tanpO0durw1-jX6ZIL6jmi0dP_HSqH0,6192
|
|
14
|
+
uedition/ext/language_switcher.css,sha256=y4LzkCgCm6E_nHt15I4Ku5QzBNpjwda9bt9FsqD1ybM,132
|
|
15
|
+
uedition/ext/language_switcher.js,sha256=5CL1Es5T_s0qXcbYtpycvh0tMNdn97MHWCoGECe5w0w,2661
|
|
16
|
+
uedition/ext/language_switcher.py,sha256=2kWXKyVyPCUFIdO24azyNg03GYrJwasJ84wNpM1eFFY,1369
|
|
17
|
+
uedition/ext/tei.py,sha256=VOVbecTA7b4HiJuh-ZAc9ZJd0DsJUmwUO-JO_wvByDk,11380
|
|
18
|
+
uedition-0.8.0.dist-info/METADATA,sha256=RE11bhXsEdpEWmrGo6c1g5mOk8iN4nowGQJJIT7ynfg,2014
|
|
19
|
+
uedition-0.8.0.dist-info/WHEEL,sha256=mRYSEL3Ih6g5a_CVMIcwiF__0Ae4_gLYh01YFNwiq1k,87
|
|
20
|
+
uedition-0.8.0.dist-info/entry_points.txt,sha256=Mor9i2VYxcNQcLbMmWGpFYSwsMs3MyewnLmFI3IG0Ls,46
|
|
21
|
+
uedition-0.8.0.dist-info/licenses/LICENSE.txt,sha256=MhLJl8GE8mnuO5i_pvKaobpIGnhiAEdkY-a6LKiuwCE,1101
|
|
22
|
+
uedition-0.8.0.dist-info/RECORD,,
|
uedition-0.6.1.dist-info/RECORD
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
uedition/__about__.py,sha256=Q7rbNFdy8FiqxWhMFtuwZyGXXWxU05a4Qc6faoEtpp4,157
|
|
2
|
-
uedition/__init__.py,sha256=IfQLccTve4Bc-f7TpeuOwXWE03DFAJoWpveFacMiBSA,285
|
|
3
|
-
uedition/__main__.py,sha256=FpsS6LdCNPdC5twonoqvfrqWDyCNreKQz7t9ZeSHcLI,182
|
|
4
|
-
uedition/settings.py,sha256=5Bb1GxJeePFaQVPTzZP0vfwJ09zgdv0OrvoJ7HbAL7g,2900
|
|
5
|
-
uedition/cli/__init__.py,sha256=DmLuxuth3_GwofY4xJl50s0rB0NqTC34-KhIB9IKjVA,1515
|
|
6
|
-
uedition/cli/build.py,sha256=5DHjNxDX9vo2qSRYpCgMo7oUc2w4-ONWsPBXs80XSzE,5973
|
|
7
|
-
uedition/cli/check.py,sha256=BRC_mXMbp9qBsAT6LSWGjQmoKIwzM6TeNOBdt3kLk5M,7295
|
|
8
|
-
uedition/cli/create.py,sha256=Q-SvDq9VtmUP4DQhuuvt1eZ_72sX8_tcFOj2Bt_T6J8,371
|
|
9
|
-
uedition/cli/language.py,sha256=2UYF_rHZOsDEpBODzqOhztV1Kjq_lwef06NGO33Fo4o,2001
|
|
10
|
-
uedition/cli/serve.py,sha256=yBS2cGJ7KGr4GFWx4JF6YaQlIL5mamM2KC4YEOhrqNw,1276
|
|
11
|
-
uedition/cli/update.py,sha256=xzMnXXJmC1ZuyWjZQC-Cd9LCnbu6ZxybjwDX-4VomoM,357
|
|
12
|
-
uedition/ext/__init__.py,sha256=p7I0TUjlm2Gsg8x3M9Ymc7Xa62DP8ExdzWwCaIgdhQg,395
|
|
13
|
-
uedition/ext/config.py,sha256=Fo4uxc9lskB0tanpO0durw1-jX6ZIL6jmi0dP_HSqH0,6192
|
|
14
|
-
uedition/ext/language_switcher.js,sha256=c0_ryemauc6-_5HaNm_JQQECnazvuBHSgHcxDUjal3c,2603
|
|
15
|
-
uedition/ext/language_switcher.py,sha256=Jab_drrp5ijQLJMr567zdMOSAARByb96CBS4Cij05Ks,1200
|
|
16
|
-
uedition/ext/tei.py,sha256=VOVbecTA7b4HiJuh-ZAc9ZJd0DsJUmwUO-JO_wvByDk,11380
|
|
17
|
-
uedition-0.6.1.dist-info/METADATA,sha256=zVJmE0dfHeKwtl1snrWv8NF9udWtb9GMk97sXhAUbqU,1974
|
|
18
|
-
uedition-0.6.1.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87
|
|
19
|
-
uedition-0.6.1.dist-info/entry_points.txt,sha256=Mor9i2VYxcNQcLbMmWGpFYSwsMs3MyewnLmFI3IG0Ls,46
|
|
20
|
-
uedition-0.6.1.dist-info/licenses/LICENSE.txt,sha256=MhLJl8GE8mnuO5i_pvKaobpIGnhiAEdkY-a6LKiuwCE,1101
|
|
21
|
-
uedition-0.6.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|