uEdition 0.8.0__py3-none-any.whl → 1.0.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/settings.py CHANGED
@@ -6,19 +6,20 @@
6
6
  All application settings are accessed via the `settings` dictionary.
7
7
  """
8
8
  import os
9
+ from typing import Annotated, Any, Dict, Tuple, Type
9
10
 
10
11
  from pydantic import BaseModel
11
12
  from pydantic.fields import FieldInfo
13
+ from pydantic.functional_validators import BeforeValidator
12
14
  from pydantic_settings import BaseSettings, PydanticBaseSettingsSource
13
15
  from yaml import safe_load
14
- from typing import Any, Type, Tuple, Dict
15
16
 
16
17
 
17
18
  class YAMLConfigSettingsSource(PydanticBaseSettingsSource):
18
19
  """Loads the configuration settings from a YAML file."""
19
20
 
20
21
  def get_field_value(
21
- self: "YAMLConfigSettingsSource", field: FieldInfo, field_name: str
22
+ self: "YAMLConfigSettingsSource", field: FieldInfo, field_name: str # noqa: ARG002
22
23
  ) -> Tuple[Any, str, bool]:
23
24
  """Get the value of a specific field."""
24
25
  encoding = self.config.get("env_file_encoding")
@@ -37,11 +38,11 @@ class YAMLConfigSettingsSource(PydanticBaseSettingsSource):
37
38
 
38
39
  def prepare_field_value(
39
40
  self: "YAMLConfigSettingsSource",
40
- field_name: str,
41
- field: FieldInfo,
42
- value: Any,
43
- value_is_complex: bool,
44
- ) -> Any:
41
+ field_name: str, # noqa: ARG002
42
+ field: FieldInfo, # noqa: ARG002
43
+ value: Any, # noqa: ANN401
44
+ value_is_complex: bool, # noqa: ARG002, FBT001
45
+ ) -> Any: # noqa: ANN401
45
46
  """Just return the value."""
46
47
  return value
47
48
 
@@ -50,33 +51,14 @@ class YAMLConfigSettingsSource(PydanticBaseSettingsSource):
50
51
  d: Dict[str, Any] = {}
51
52
 
52
53
  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
- )
54
+ field_value, field_key, value_is_complex = self.get_field_value(field, field_name)
55
+ field_value = self.prepare_field_value(field_name, field, field_value, value_is_complex)
59
56
  if field_value is not None:
60
57
  d[field_key] = field_value
61
58
 
62
59
  return d
63
60
 
64
61
 
65
- def uedition_yaml_settings(settings: BaseSettings) -> dict[str, Any]:
66
- """Load the settings from a uEdition.yaml or uEdition.yml file."""
67
- if os.path.exists("uEdition.yaml"):
68
- with open(
69
- "uEdition.yaml", encoding=settings.__config__.env_file_encoding
70
- ) as in_f:
71
- return safe_load(in_f)
72
- elif os.path.exists("uEdition.yml"):
73
- with open(
74
- "uEdition.yml", encoding=settings.__config__.env_file_encoding
75
- ) as in_f:
76
- return safe_load(in_f)
77
- return dict()
78
-
79
-
80
62
  class LanguageSetting(BaseModel):
81
63
  """Settings for a single language."""
82
64
 
@@ -106,6 +88,22 @@ class AuthorSettings(BaseModel):
106
88
  """The author's contact e-mail."""
107
89
 
108
90
 
91
+ class OuputSettings(BaseModel):
92
+ """Settings for the output configuration."""
93
+
94
+ path: str = "docs"
95
+ """The output path."""
96
+ tei: bool = True
97
+ """Whether to generate TEI output."""
98
+
99
+
100
+ def convert_output_str_to_dict(value: str | dict) -> dict:
101
+ """Convert the simple output directory string to a dictionary."""
102
+ if isinstance(value, str):
103
+ return {"path": value}
104
+ return value
105
+
106
+
109
107
  class Settings(BaseSettings):
110
108
  """Application settings."""
111
109
 
@@ -115,7 +113,7 @@ class Settings(BaseSettings):
115
113
  """The author settings."""
116
114
  languages: list[LanguageSetting] = []
117
115
  """The configured languages."""
118
- output: str = "docs"
116
+ output: Annotated[OuputSettings, BeforeValidator(convert_output_str_to_dict)] = OuputSettings()
119
117
  """The output directory."""
120
118
  repository: RepositorySettings = RepositorySettings()
121
119
  """The repository settings."""
@@ -137,6 +135,7 @@ class Settings(BaseSettings):
137
135
  return (
138
136
  init_settings,
139
137
  env_settings,
138
+ dotenv_settings,
140
139
  file_secret_settings,
141
140
  YAMLConfigSettingsSource(settings_cls),
142
141
  )
@@ -147,6 +146,5 @@ settings = Settings().model_dump()
147
146
 
148
147
  def reload_settings() -> None:
149
148
  """Reload the settings."""
150
- global settings
151
149
  settings.clear()
152
150
  settings.update(Settings().dict())
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uEdition
3
- Version: 0.8.0
4
- Project-URL: Documentation, https://github.com/unknown/uedition#readme
5
- Project-URL: Issues, https://github.com/unknown/uedition/issues
6
- Project-URL: Source, https://github.com/unknown/uedition
3
+ Version: 1.0.0
4
+ Project-URL: Documentation, https://github.com/uEdition/uEdition#readme
5
+ Project-URL: Issues, https://github.com/uEdition/uEdition/issues
6
+ Project-URL: Source, https://github.com/uEdition/uEdition
7
7
  Author-email: Mark Hall <mark.hall@work.room3b.eu>
8
8
  License-Expression: MIT
9
9
  License-File: LICENSE.txt
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
15
15
  Classifier: Programming Language :: Python :: Implementation :: PyPy
16
16
  Requires-Python: >=3.10
17
17
  Requires-Dist: copier<10.0.0,>=9.0.0
18
- Requires-Dist: jupyter-book<1.0.0,>=0.15.1
18
+ Requires-Dist: jupyter-book<2.0.0,>=1.0.0
19
19
  Requires-Dist: livereload
20
20
  Requires-Dist: lxml<6.0.0,>=4.9.2
21
21
  Requires-Dist: pydantic-settings<3.0.0,>=2.0.0
@@ -48,6 +48,16 @@ The recommended installation for use is via `pipx`:
48
48
  pipx install uedition
49
49
  ```
50
50
 
51
+ All commands can then be run via
52
+
53
+ ```console
54
+ uEdition {command}
55
+ ```
56
+
57
+ ## Documentation
58
+
59
+ Full documentation is available at [https://uedition.readthedocs.io](https://uedition.readthedocs.io).
60
+
51
61
  ## License
52
62
 
53
- `uedition` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
63
+ The μEdition is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
@@ -0,0 +1,26 @@
1
+ uedition/CHANGELOG.md,sha256=NTTpW1nGpmwqXkLHEoLTHrmyGBXZINKch2Kj_cYZnZY,1356
2
+ uedition/__about__.py,sha256=rLZ6J6d8BZjSI-Yq5EyJrB0Diw4iKah6vRHCOmIswZw,157
3
+ uedition/__init__.py,sha256=xDDK2i5l1NLhxq6_LJH5g7UJDrFEjIJNmT2tcg7xNWI,301
4
+ uedition/__main__.py,sha256=Pg_yGV-ndR2iiImDC3f017llSX6pSYMslIwZlw8vEpQ,189
5
+ uedition/settings.py,sha256=4jWfjD1KmYTwzeD6DhP9taWS-zFp9XHxo1QqUqsSlrA,4774
6
+ uedition/cli/__init__.py,sha256=h3N4ZwgRC72IlkCsTbke4PLTFv-_pn1-npXXPC7S78U,1642
7
+ uedition/cli/build.py,sha256=oeRvkHdLGm5Wb7-UuvjHTMQiuReb9GKYvkDv-W-uV0g,7741
8
+ uedition/cli/check.py,sha256=Jlkyw6mgcz3HM-wJpmzCtKv054MFolCe7m6bSUDtsZA,7005
9
+ uedition/cli/create.py,sha256=Q-SvDq9VtmUP4DQhuuvt1eZ_72sX8_tcFOj2Bt_T6J8,371
10
+ uedition/cli/language.py,sha256=IqSJrZbrQzU-7TJqnCBeC2HUs1N01EAa7jFMvfXTsoA,1943
11
+ uedition/cli/serve.py,sha256=UfVsY26OW9yAz7rnjjatz1gEDGIi1kaTYlkUAiVCuRw,1391
12
+ uedition/cli/update.py,sha256=XKHnvorHqizsB5zP-8ifMrgnQuq6zRk6Tb03dBz_MI4,377
13
+ uedition/ext/__init__.py,sha256=hAK3MB5il4tAkfWnZNVxIJhfJ5vN0Fdmmtz0ZAYsvo4,406
14
+ uedition/ext/config.py,sha256=wmy3sW0g4yha00LRvuHlYc1OnVEpit75U6uD8mPPu_U,5738
15
+ uedition/ext/language_switcher.css,sha256=y4LzkCgCm6E_nHt15I4Ku5QzBNpjwda9bt9FsqD1ybM,132
16
+ uedition/ext/language_switcher.js,sha256=HIgQiLg0WGS_G_VjpfEpTDLqb1HwHxcL3r6mdoSUix4,2697
17
+ uedition/ext/language_switcher.py,sha256=tHpf4HsvMtatVn5dQ3EFlrk5urFaMzsZZY755cvgCu8,1425
18
+ uedition/ext/tei/__init__.py,sha256=8KgVi31bz8nI65m6u4EdT_f1qNCP45HrU0V7MSGlZxA,1074
19
+ uedition/ext/tei/builder.py,sha256=XLFM11Gnt_4G4H-2gaJyjOgko_aMmvgZnKftMsSk8qw,11743
20
+ uedition/ext/tei/parser.py,sha256=PVc-rhNTmFRSsz7HhlYVQrQCdZ-aEGX4z16-g_vFTE4,11286
21
+ uedition/ext/tei/tei_download.js,sha256=5_IPCuamZGPXWriPPPz5wA-zo0Y0Oy1858S6ltxSdQ8,2151
22
+ uedition-1.0.0.dist-info/METADATA,sha256=Xo9beHSFPrUMMC-DiGQNOLIL_Uq5salbOiMi7hXB8z8,2210
23
+ uedition-1.0.0.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
24
+ uedition-1.0.0.dist-info/entry_points.txt,sha256=cDOOVBb1SZ072ZkY1hW4Y7I_WKKGCtCJtDY1XST1Hr4,96
25
+ uedition-1.0.0.dist-info/licenses/LICENSE.txt,sha256=MhLJl8GE8mnuO5i_pvKaobpIGnhiAEdkY-a6LKiuwCE,1101
26
+ uedition-1.0.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.21.0
2
+ Generator: hatchling 1.21.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -0,0 +1,5 @@
1
+ [console_scripts]
2
+ uEdition = uedition.cli:app
3
+
4
+ [sphinx.builders]
5
+ tei = uedition.ext.tei.builder
@@ -1,22 +0,0 @@
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,,
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- uEdition = uedition.cli:app