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.
Files changed (23) hide show
  1. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/PKG-INFO +1 -1
  2. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/pyproject.toml +1 -1
  3. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/pyproject.toml.orig +1 -1
  4. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/utils/pyproject.py +14 -10
  5. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/LICENSE +0 -0
  6. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/README.md +0 -0
  7. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/__init__.py +0 -0
  8. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/components/__init__.py +0 -0
  9. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/__init__.py +0 -0
  10. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/apps.py +0 -0
  11. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/asgi.py +0 -0
  12. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/management/__init__.py +0 -0
  13. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/management/commands/__init__.py +0 -0
  14. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/management/commands/cp.py +0 -0
  15. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/management/commands/platform.py +0 -0
  16. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/management/commands/random.py +0 -0
  17. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/management/commands/rm.py +0 -0
  18. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/utils/__init__.py +0 -0
  19. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/utils/enum.py +0 -0
  20. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/utils/platform.py +0 -0
  21. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/utils/version.py +0 -0
  22. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/core/wsgi.py +0 -0
  23. {djangx-0.1.0.dev3 → djangx-0.1.0.dev4}/src/djangx/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: djangX
3
- Version: 0.1.0.dev3
3
+ Version: 0.1.0.dev4
4
4
  Summary:
5
5
  Author: Kevin Wakhisi
6
6
  Author-email: Kevin Wakhisi <kevin@treeolive.tech>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "djangX"
3
- version = "0.1.0.dev3"
3
+ version = "0.1.0.dev4"
4
4
  description = ""
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -3,7 +3,7 @@ repository = "https://github.com/treeolive-tech/djangX.git"
3
3
 
4
4
  [project]
5
5
  name = "djangX"
6
- version = "0.1.0.dev3"
6
+ version = "0.1.0.dev4"
7
7
  description = ""
8
8
  readme = "README.md"
9
9
  license = "MIT"
@@ -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* and store the result."""
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
- with open(file=self.path, mode="rb") as f:
36
- self._data: dict[str, Any] = load(f)
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["project"].get("description")
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
- try:
72
- value: Any = self._data["tool"][Package.name]["settings"]
73
- return value if isinstance(value, str) and value.strip() else None
74
- except KeyError:
75
- return None
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