djangX 0.1.0.dev3__tar.gz → 0.1.0.dev4__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.
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/PKG-INFO +1 -1
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/pyproject.toml +1 -1
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/pyproject.toml.orig +1 -1
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/utils/pyproject.py +14 -10
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/LICENSE +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/README.md +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/__init__.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/components/__init__.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/__init__.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/apps.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/asgi.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/management/__init__.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/management/commands/__init__.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/management/commands/cp.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/management/commands/platform.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/management/commands/random.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/management/commands/rm.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/utils/__init__.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/utils/enum.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/utils/platform.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/utils/version.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/wsgi.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/py.typed +0 -0
|
@@ -11,11 +11,12 @@ __all__: list[str] = ["PyProject"]
|
|
|
11
11
|
class PyProject:
|
|
12
12
|
"""Read-only view of a parsed ``pyproject.toml`` file.
|
|
13
13
|
|
|
14
|
+
A missing file is treated as empty data.
|
|
15
|
+
|
|
14
16
|
Args:
|
|
15
17
|
toml_path: Path to the ``pyproject.toml`` file.
|
|
16
18
|
|
|
17
19
|
Raises:
|
|
18
|
-
FileNotFoundError: If *toml_path* does not exist.
|
|
19
20
|
tomllib.TOMLDecodeError: If the file contains invalid TOML.
|
|
20
21
|
|
|
21
22
|
Examples::
|
|
@@ -27,13 +28,15 @@ class PyProject:
|
|
|
27
28
|
"""
|
|
28
29
|
|
|
29
30
|
def __init__(self, toml_path: Path) -> None:
|
|
30
|
-
"""Parse *toml_path
|
|
31
|
+
"""Parse *toml_path*, or use empty data if it doesn't exist."""
|
|
31
32
|
from tomllib import load
|
|
32
33
|
|
|
33
34
|
self.path: Path = toml_path
|
|
35
|
+
self._data: dict[str, Any] = {}
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
self.
|
|
37
|
+
if self.path.is_file():
|
|
38
|
+
with open(file=self.path, mode="rb") as f:
|
|
39
|
+
self._data = load(f)
|
|
37
40
|
|
|
38
41
|
@property
|
|
39
42
|
def name(self) -> str:
|
|
@@ -56,7 +59,7 @@ class PyProject:
|
|
|
56
59
|
@property
|
|
57
60
|
def description(self) -> str | None:
|
|
58
61
|
"""The ``[project] description`` value, or ``None`` if not set."""
|
|
59
|
-
return self._data
|
|
62
|
+
return self._data.get("project", {}).get("description")
|
|
60
63
|
|
|
61
64
|
@property
|
|
62
65
|
def settings(self) -> str | None:
|
|
@@ -68,11 +71,12 @@ class PyProject:
|
|
|
68
71
|
# settings = "app.settings"
|
|
69
72
|
p.settings # "app.settings"
|
|
70
73
|
"""
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
tool: Any | None = self._data.get("tool")
|
|
75
|
+
section: Any | None = tool.get(Package.name) if isinstance(tool, dict) else None
|
|
76
|
+
value: Any | None = (
|
|
77
|
+
section.get("settings") if isinstance(section, dict) else None
|
|
78
|
+
)
|
|
79
|
+
return value if isinstance(value, str) and value.strip() else None
|
|
76
80
|
|
|
77
81
|
@property
|
|
78
82
|
def data(self) -> dict[str, Any]:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|