djangx 0.1.0.dev4__tar.gz → 0.1.0.dev5__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 (26) hide show
  1. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/PKG-INFO +1 -1
  2. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/pyproject.toml +5 -7
  3. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/pyproject.toml.orig +5 -7
  4. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/src/djangx/__init__.py +2 -0
  5. djangx-0.1.0.dev5/src/djangx/core/__init__.py +58 -0
  6. djangx-0.1.0.dev5/src/djangx/core/asgi.py +18 -0
  7. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/src/djangx/core/management/__init__.py +22 -9
  8. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/src/djangx/core/utils/__init__.py +0 -1
  9. djangx-0.1.0.dev5/src/djangx/core/wsgi.py +18 -0
  10. djangx-0.1.0.dev4/src/djangx/core/__init__.py +0 -27
  11. djangx-0.1.0.dev4/src/djangx/core/asgi.py +0 -22
  12. djangx-0.1.0.dev4/src/djangx/core/utils/pyproject.py +0 -84
  13. djangx-0.1.0.dev4/src/djangx/core/wsgi.py +0 -22
  14. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/LICENSE +0 -0
  15. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/README.md +0 -0
  16. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/src/djangx/components/__init__.py +0 -0
  17. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/src/djangx/core/apps.py +0 -0
  18. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/src/djangx/core/management/commands/__init__.py +0 -0
  19. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/src/djangx/core/management/commands/cp.py +0 -0
  20. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/src/djangx/core/management/commands/platform.py +0 -0
  21. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/src/djangx/core/management/commands/random.py +0 -0
  22. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/src/djangx/core/management/commands/rm.py +0 -0
  23. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/src/djangx/core/utils/enum.py +0 -0
  24. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/src/djangx/core/utils/platform.py +0 -0
  25. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/src/djangx/core/utils/version.py +0 -0
  26. {djangx-0.1.0.dev4 → djangx-0.1.0.dev5}/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.dev4
3
+ Version: 0.1.0.dev5
4
4
  Summary:
5
5
  Author: Kevin Wakhisi
6
6
  Author-email: Kevin Wakhisi <kevin@treeolive.tech>
@@ -1,6 +1,10 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.13.5,<0.14.0"]
3
+ build-backend = "uv_build"
4
+
1
5
  [project]
2
6
  name = "djangX"
3
- version = "0.1.0.dev4"
7
+ version = "0.1.0.dev5"
4
8
  description = ""
5
9
  readme = "README.md"
6
10
  license = "MIT"
@@ -45,17 +49,11 @@ dev = [
45
49
  "django-stubs>=6.1.2",
46
50
  "djlint>=1.47.0",
47
51
  "poethepoet>=0.49.0",
48
- "psycopg[binary,pool]>=3.3.6",
49
- "vercel>=0.12.0",
50
52
  "djangorestframework>=3.18.3",
51
53
  "django-filter>=26.2",
52
54
  "markdown>=3.11.2",
53
55
  ]
54
56
 
55
- [build-system]
56
- requires = ["uv_build>=0.13.4,<0.14.0"]
57
- build-backend = "uv_build"
58
-
59
57
  [tool.uv]
60
58
  preview-features = [
61
59
  "format-command",
@@ -1,9 +1,13 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.13.5,<0.14.0"]
3
+ build-backend = "uv_build"
4
+
1
5
  [project.urls]
2
6
  repository = "https://github.com/treeolive-tech/djangX.git"
3
7
 
4
8
  [project]
5
9
  name = "djangX"
6
- version = "0.1.0.dev4"
10
+ version = "0.1.0.dev5"
7
11
  description = ""
8
12
  readme = "README.md"
9
13
  license = "MIT"
@@ -31,8 +35,6 @@ dev = [
31
35
  "django-stubs>=6.1.2",
32
36
  "djlint>=1.47.0",
33
37
  "poethepoet>=0.49.0",
34
- "psycopg[binary,pool]>=3.3.6",
35
- "vercel>=0.12.0",
36
38
 
37
39
  # rest framework
38
40
  "djangorestframework>=3.18.3",
@@ -44,10 +46,6 @@ dev = [
44
46
  djangx = "djangx.core.management:main"
45
47
  djx = "djangx.core.management:main"
46
48
 
47
- [build-system]
48
- requires = ["uv_build>=0.13.4,<0.14.0"]
49
- build-backend = "uv_build"
50
-
51
49
  [tool.uv]
52
50
  preview-features = ["format-command", "check-command"]
53
51
 
@@ -1,6 +1,8 @@
1
1
  from pathlib import Path
2
2
  from typing import Final
3
3
 
4
+ __all__: list[str] = ["Package"]
5
+
4
6
 
5
7
  class Package:
6
8
  name: Final[str] = Path(__file__).resolve().parent.name # djangx
@@ -0,0 +1,58 @@
1
+ from pathlib import Path
2
+ from tomllib import load
3
+ from typing import Any
4
+
5
+ __all__: list[str] = ["DJANGO_SETTINGS_MODULE", "Project"]
6
+
7
+
8
+ class Project:
9
+ def __init__(self, toml_path: Path | None = None) -> None:
10
+ """Parse *toml_path*, or use empty data if it doesn't exist."""
11
+ self.path: Path = toml_path or Path.cwd() / "pyproject.toml"
12
+ self._data: dict[str, Any] = {}
13
+
14
+ if self.path.is_file():
15
+ with open(file=self.path, mode="rb") as f:
16
+ self._data = load(f)
17
+
18
+ def _get_str(self, *keys: str) -> str | None:
19
+ """Return the string at *keys*, or ``None`` if missing or not a string.
20
+
21
+ Examples::
22
+
23
+ Project()._get_str("project", "name") # "olyv"
24
+ Project()._get_str("project", "version") # None (not set)
25
+ """
26
+ value: Any = self._data
27
+ for key in keys:
28
+ if not isinstance(value, dict):
29
+ return None
30
+ value = value.get(key)
31
+ return value if isinstance(value, str) else None
32
+
33
+ @property
34
+ def name(self) -> str:
35
+ """The ``[project] name`` value.
36
+
37
+ Raises:
38
+ KeyError: If ``[project]`` or ``name`` is missing.
39
+ """
40
+ return self._data["project"]["name"]
41
+
42
+ @property
43
+ def description(self) -> str | None:
44
+ """The ``[project] description`` value, or ``None`` if not a string."""
45
+ return self._get_str("project", "description")
46
+
47
+ @property
48
+ def settings(self) -> str | None:
49
+ """The ``[project] settings`` value, or ``None`` if not a string.
50
+
51
+ Examples::
52
+
53
+ Project().settings # "app.settings"
54
+ """
55
+ return self._get_str("project", "settings")
56
+
57
+
58
+ DJANGO_SETTINGS_MODULE: str | None = Project().settings
@@ -0,0 +1,18 @@
1
+ """
2
+ ASGI config.
3
+
4
+ It exposes the ASGI callable as a module-level variable named ``app``.
5
+
6
+ For more information on this file, see
7
+ https://docs.djangoproject.com/en/6.0/howto/deployment/asgi/
8
+ """
9
+
10
+ from os import environ
11
+
12
+ from django.core.asgi import get_asgi_application
13
+
14
+ from . import DJANGO_SETTINGS_MODULE
15
+
16
+ assert DJANGO_SETTINGS_MODULE is not None
17
+ environ.setdefault("DJANGO_SETTINGS_MODULE", DJANGO_SETTINGS_MODULE)
18
+ application = get_asgi_application()
@@ -2,6 +2,8 @@
2
2
 
3
3
  from sys import argv
4
4
 
5
+ from ... import Package
6
+ from ..utils import ExitCode, print_version
5
7
  from .commands import BUILTIN_COMMANDS, HELP_COMMANDS
6
8
 
7
9
 
@@ -28,7 +30,7 @@ def _run_builtin() -> None:
28
30
  def _run_project_or_help(command: str) -> None:
29
31
  """Run a command against the project's settings, or show help if none is found."""
30
32
 
31
- from .. import DJANGO_SETTINGS_MODULE, print_help_message
33
+ from .. import DJANGO_SETTINGS_MODULE
32
34
 
33
35
  if DJANGO_SETTINGS_MODULE:
34
36
  from os import environ
@@ -47,11 +49,25 @@ def _run_project_or_help(command: str) -> None:
47
49
  load_dotenv(dotenv)
48
50
 
49
51
  execute_from_command_line(argv)
50
- return
51
-
52
- print_help_message()
53
- if command in HELP_COMMANDS:
54
- _run_builtin()
52
+ else:
53
+ match argv[1]:
54
+ case cmd if cmd in HELP_COMMANDS:
55
+ print(
56
+ "No pyproject.toml found (or it's missing a [project] `settings` key).\n\n"
57
+ "To see project-specific commands, run this from the root of a "
58
+ f"{Package.verbose_name} project, or add to your pyproject.toml:\n\n"
59
+ " [project]\n"
60
+ ' settings = "app.settings"'
61
+ )
62
+
63
+ case _:
64
+ print(
65
+ f"Unknown command: '{argv[1]}'\nType '{Package.name} help' for usage."
66
+ )
67
+ raise SystemExit(ExitCode.ERROR)
68
+
69
+ if command in HELP_COMMANDS:
70
+ _run_builtin()
55
71
 
56
72
 
57
73
  def main() -> None:
@@ -65,9 +81,6 @@ def main() -> None:
65
81
  )
66
82
 
67
83
  case "-v" | "--version" | "version":
68
- from ... import Package
69
- from ..utils import print_version
70
-
71
84
  raise SystemExit(print_version(Package.name))
72
85
 
73
86
  case _ if command in BUILTIN_COMMANDS:
@@ -1,4 +1,3 @@
1
1
  from .enum import *
2
2
  from .platform import *
3
- from .pyproject import *
4
3
  from .version import *
@@ -0,0 +1,18 @@
1
+ """
2
+ WSGI config.
3
+
4
+ It exposes the WSGI callable as a module-level variable named ``app``.
5
+
6
+ For more information on this file, see
7
+ https://docs.djangoproject.com/en/6.0/howto/deployment/wsgi/
8
+ """
9
+
10
+ from os import environ
11
+
12
+ from django.core.wsgi import get_wsgi_application
13
+
14
+ from . import DJANGO_SETTINGS_MODULE
15
+
16
+ assert DJANGO_SETTINGS_MODULE is not None
17
+ environ.setdefault("DJANGO_SETTINGS_MODULE", DJANGO_SETTINGS_MODULE)
18
+ application = get_wsgi_application()
@@ -1,27 +0,0 @@
1
- from pathlib import Path
2
- from sys import argv
3
-
4
- from .. import Package
5
- from .utils import ExitCode, PyProject
6
-
7
- DJANGO_SETTINGS_MODULE: str | None = PyProject(Path.cwd() / "pyproject.toml").settings
8
-
9
-
10
- def print_help_message() -> None:
11
- """Print built-in help, or an error and exit if the command is unknown."""
12
- from .management.commands import HELP_COMMANDS
13
-
14
- match argv[1]:
15
- case cmd if cmd in HELP_COMMANDS:
16
- print(
17
- f"No pyproject.toml found (or it's missing [tool.{Package.name}] `settings` key), "
18
- "so only built-in commands are shown below.\n\n"
19
- "To see project-specific commands, run this from the root of a "
20
- f"{Package.verbose_name} project, or add to your pyproject.toml:\n\n"
21
- f" [tool.{Package.name}]\n"
22
- ' settings = "app.settings"'
23
- )
24
-
25
- case _:
26
- print(f"Unknown command: '{cmd}'\nType '{Package.name} help' for usage.")
27
- raise SystemExit(ExitCode.ERROR)
@@ -1,22 +0,0 @@
1
- """
2
- ASGI config.
3
-
4
- It exposes the ASGI callable as a module-level variable named ``app``.
5
-
6
- For more information on this file, see
7
- https://docs.djangoproject.com/en/6.0/howto/deployment/asgi/
8
- """
9
-
10
- from . import DJANGO_SETTINGS_MODULE
11
-
12
- if DJANGO_SETTINGS_MODULE is None:
13
- from . import print_help_message
14
-
15
- print_help_message()
16
- else:
17
- from os import environ
18
-
19
- from django.core.asgi import get_asgi_application
20
-
21
- environ.setdefault("DJANGO_SETTINGS_MODULE", DJANGO_SETTINGS_MODULE)
22
- application = get_asgi_application()
@@ -1,84 +0,0 @@
1
- """Read ``pyproject.toml`` data and the project's settings module."""
2
-
3
- from pathlib import Path
4
- from typing import Any
5
-
6
- from ... import Package
7
-
8
- __all__: list[str] = ["PyProject"]
9
-
10
-
11
- class PyProject:
12
- """Read-only view of a parsed ``pyproject.toml`` file.
13
-
14
- A missing file is treated as empty data.
15
-
16
- Args:
17
- toml_path: Path to the ``pyproject.toml`` file.
18
-
19
- Raises:
20
- tomllib.TOMLDecodeError: If the file contains invalid TOML.
21
-
22
- Examples::
23
-
24
- p = PyProject(Path("pyproject.toml"))
25
- p.name # "my-project"
26
- p.version # "0.1.0"
27
- p.data # the full parsed dict
28
- """
29
-
30
- def __init__(self, toml_path: Path) -> None:
31
- """Parse *toml_path*, or use empty data if it doesn't exist."""
32
- from tomllib import load
33
-
34
- self.path: Path = toml_path
35
- self._data: dict[str, Any] = {}
36
-
37
- if self.path.is_file():
38
- with open(file=self.path, mode="rb") as f:
39
- self._data = load(f)
40
-
41
- @property
42
- def name(self) -> str:
43
- """The ``[project] name`` value.
44
-
45
- Raises:
46
- KeyError: If ``[project]`` or ``name`` is missing.
47
- """
48
- return self._data["project"]["name"]
49
-
50
- @property
51
- def version(self) -> str:
52
- """The ``[project] version`` value.
53
-
54
- Raises:
55
- KeyError: If ``[project]`` or ``version`` is missing.
56
- """
57
- return self._data["project"]["version"]
58
-
59
- @property
60
- def description(self) -> str | None:
61
- """The ``[project] description`` value, or ``None`` if not set."""
62
- return self._data.get("project", {}).get("description")
63
-
64
- @property
65
- def settings(self) -> str | None:
66
- """The ``[tool.<package>] settings`` value, or ``None`` if missing or blank.
67
-
68
- Examples::
69
-
70
- # [tool.djangx]
71
- # settings = "app.settings"
72
- p.settings # "app.settings"
73
- """
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
80
-
81
- @property
82
- def data(self) -> dict[str, Any]:
83
- """The full parsed TOML as a dict."""
84
- return self._data
@@ -1,22 +0,0 @@
1
- """
2
- WSGI config.
3
-
4
- It exposes the WSGI callable as a module-level variable named ``app``.
5
-
6
- For more information on this file, see
7
- https://docs.djangoproject.com/en/6.0/howto/deployment/wsgi/
8
- """
9
-
10
- from . import DJANGO_SETTINGS_MODULE
11
-
12
- if DJANGO_SETTINGS_MODULE is None:
13
- from . import print_help_message
14
-
15
- print_help_message()
16
- else:
17
- from os import environ
18
-
19
- from django.core.wsgi import get_wsgi_application
20
-
21
- environ.setdefault("DJANGO_SETTINGS_MODULE", DJANGO_SETTINGS_MODULE)
22
- application = get_wsgi_application()
File without changes
File without changes