djangx 0.1.0.dev3__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.
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/PKG-INFO +1 -1
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/pyproject.toml +5 -7
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/pyproject.toml.orig +5 -7
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/src/djangx/__init__.py +2 -0
- djangx-0.1.0.dev5/src/djangx/core/__init__.py +58 -0
- djangx-0.1.0.dev5/src/djangx/core/asgi.py +18 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/src/djangx/core/management/__init__.py +22 -9
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/src/djangx/core/utils/__init__.py +0 -1
- djangx-0.1.0.dev5/src/djangx/core/wsgi.py +18 -0
- djangx-0.1.0.dev3/src/djangx/core/__init__.py +0 -27
- djangx-0.1.0.dev3/src/djangx/core/asgi.py +0 -22
- djangx-0.1.0.dev3/src/djangx/core/utils/pyproject.py +0 -80
- djangx-0.1.0.dev3/src/djangx/core/wsgi.py +0 -22
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/LICENSE +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/README.md +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/src/djangx/components/__init__.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/src/djangx/core/apps.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/src/djangx/core/management/commands/__init__.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/src/djangx/core/management/commands/cp.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/src/djangx/core/management/commands/platform.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/src/djangx/core/management/commands/random.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/src/djangx/core/management/commands/rm.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/src/djangx/core/utils/enum.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/src/djangx/core/utils/platform.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/src/djangx/core/utils/version.py +0 -0
- {djangx-0.1.0.dev3 → djangx-0.1.0.dev5}/src/djangx/py.typed +0 -0
|
@@ -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.
|
|
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.
|
|
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
|
|
|
@@ -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
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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:
|
|
@@ -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,80 +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
|
-
Args:
|
|
15
|
-
toml_path: Path to the ``pyproject.toml`` file.
|
|
16
|
-
|
|
17
|
-
Raises:
|
|
18
|
-
FileNotFoundError: If *toml_path* does not exist.
|
|
19
|
-
tomllib.TOMLDecodeError: If the file contains invalid TOML.
|
|
20
|
-
|
|
21
|
-
Examples::
|
|
22
|
-
|
|
23
|
-
p = PyProject(Path("pyproject.toml"))
|
|
24
|
-
p.name # "my-project"
|
|
25
|
-
p.version # "0.1.0"
|
|
26
|
-
p.data # the full parsed dict
|
|
27
|
-
"""
|
|
28
|
-
|
|
29
|
-
def __init__(self, toml_path: Path) -> None:
|
|
30
|
-
"""Parse *toml_path* and store the result."""
|
|
31
|
-
from tomllib import load
|
|
32
|
-
|
|
33
|
-
self.path: Path = toml_path
|
|
34
|
-
|
|
35
|
-
with open(file=self.path, mode="rb") as f:
|
|
36
|
-
self._data: dict[str, Any] = load(f)
|
|
37
|
-
|
|
38
|
-
@property
|
|
39
|
-
def name(self) -> str:
|
|
40
|
-
"""The ``[project] name`` value.
|
|
41
|
-
|
|
42
|
-
Raises:
|
|
43
|
-
KeyError: If ``[project]`` or ``name`` is missing.
|
|
44
|
-
"""
|
|
45
|
-
return self._data["project"]["name"]
|
|
46
|
-
|
|
47
|
-
@property
|
|
48
|
-
def version(self) -> str:
|
|
49
|
-
"""The ``[project] version`` value.
|
|
50
|
-
|
|
51
|
-
Raises:
|
|
52
|
-
KeyError: If ``[project]`` or ``version`` is missing.
|
|
53
|
-
"""
|
|
54
|
-
return self._data["project"]["version"]
|
|
55
|
-
|
|
56
|
-
@property
|
|
57
|
-
def description(self) -> str | None:
|
|
58
|
-
"""The ``[project] description`` value, or ``None`` if not set."""
|
|
59
|
-
return self._data["project"].get("description")
|
|
60
|
-
|
|
61
|
-
@property
|
|
62
|
-
def settings(self) -> str | None:
|
|
63
|
-
"""The ``[tool.<package>] settings`` value, or ``None`` if missing or blank.
|
|
64
|
-
|
|
65
|
-
Examples::
|
|
66
|
-
|
|
67
|
-
# [tool.djangx]
|
|
68
|
-
# settings = "app.settings"
|
|
69
|
-
p.settings # "app.settings"
|
|
70
|
-
"""
|
|
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
|
|
76
|
-
|
|
77
|
-
@property
|
|
78
|
-
def data(self) -> dict[str, Any]:
|
|
79
|
-
"""The full parsed TOML as a dict."""
|
|
80
|
-
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
|
|
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
|