djangx 0.1.0.dev4__tar.gz → 0.1.0.dev6__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.dev4 → djangx-0.1.0.dev6}/PKG-INFO +1 -1
- {djangx-0.1.0.dev4 → djangx-0.1.0.dev6}/pyproject.toml +5 -7
- {djangx-0.1.0.dev4 → djangx-0.1.0.dev6}/pyproject.toml.orig +5 -7
- djangx-0.1.0.dev6/src/djangx/core/asgi.py +18 -0
- {djangx-0.1.0.dev4 → djangx-0.1.0.dev6}/src/djangx/core/management/__init__.py +21 -10
- {djangx-0.1.0.dev4 → djangx-0.1.0.dev6}/src/djangx/core/utils/__init__.py +1 -1
- djangx-0.1.0.dev6/src/djangx/core/utils/project.py +58 -0
- djangx-0.1.0.dev6/src/djangx/core/wsgi.py +18 -0
- djangx-0.1.0.dev6/src/djangx/py.typed +0 -0
- djangx-0.1.0.dev4/src/djangx/core/__init__.py +0 -27
- djangx-0.1.0.dev4/src/djangx/core/asgi.py +0 -22
- djangx-0.1.0.dev4/src/djangx/core/utils/pyproject.py +0 -84
- djangx-0.1.0.dev4/src/djangx/core/wsgi.py +0 -22
- {djangx-0.1.0.dev4 → djangx-0.1.0.dev6}/LICENSE +0 -0
- {djangx-0.1.0.dev4 → djangx-0.1.0.dev6}/README.md +0 -0
- {djangx-0.1.0.dev4 → djangx-0.1.0.dev6}/src/djangx/__init__.py +0 -0
- {djangx-0.1.0.dev4 → djangx-0.1.0.dev6}/src/djangx/components/__init__.py +0 -0
- /djangx-0.1.0.dev4/src/djangx/core/management/commands/cp.py → /djangx-0.1.0.dev6/src/djangx/core/__init__.py +0 -0
- {djangx-0.1.0.dev4 → djangx-0.1.0.dev6}/src/djangx/core/apps.py +0 -0
- {djangx-0.1.0.dev4 → djangx-0.1.0.dev6}/src/djangx/core/management/commands/__init__.py +0 -0
- /djangx-0.1.0.dev4/src/djangx/core/management/commands/platform.py → /djangx-0.1.0.dev6/src/djangx/core/management/commands/cp.py +0 -0
- /djangx-0.1.0.dev4/src/djangx/core/management/commands/random.py → /djangx-0.1.0.dev6/src/djangx/core/management/commands/platform.py +0 -0
- /djangx-0.1.0.dev4/src/djangx/core/management/commands/rm.py → /djangx-0.1.0.dev6/src/djangx/core/management/commands/random.py +0 -0
- /djangx-0.1.0.dev4/src/djangx/py.typed → /djangx-0.1.0.dev6/src/djangx/core/management/commands/rm.py +0 -0
- {djangx-0.1.0.dev4 → djangx-0.1.0.dev6}/src/djangx/core/utils/enum.py +0 -0
- {djangx-0.1.0.dev4 → djangx-0.1.0.dev6}/src/djangx/core/utils/platform.py +0 -0
- {djangx-0.1.0.dev4 → djangx-0.1.0.dev6}/src/djangx/core/utils/version.py +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.dev6"
|
|
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.dev6"
|
|
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,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 .utils 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 DJANGO_SETTINGS_MODULE, ExitCode, print_version
|
|
5
7
|
from .commands import BUILTIN_COMMANDS, HELP_COMMANDS
|
|
6
8
|
|
|
7
9
|
|
|
@@ -28,8 +30,6 @@ 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
|
|
32
|
-
|
|
33
33
|
if DJANGO_SETTINGS_MODULE:
|
|
34
34
|
from os import environ
|
|
35
35
|
from pathlib import Path
|
|
@@ -47,11 +47,25 @@ def _run_project_or_help(command: str) -> None:
|
|
|
47
47
|
load_dotenv(dotenv)
|
|
48
48
|
|
|
49
49
|
execute_from_command_line(argv)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
else:
|
|
51
|
+
match argv[1]:
|
|
52
|
+
case cmd if cmd in HELP_COMMANDS:
|
|
53
|
+
print(
|
|
54
|
+
"No pyproject.toml found (or it's missing a [project] `settings` key).\n\n"
|
|
55
|
+
"To see project-specific commands, run this from the root of a "
|
|
56
|
+
f"{Package.verbose_name} project, or add to your pyproject.toml:\n\n"
|
|
57
|
+
" [project]\n"
|
|
58
|
+
' settings = "app.settings"'
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
case _:
|
|
62
|
+
print(
|
|
63
|
+
f"Unknown command: '{argv[1]}'\nType '{Package.name} help' for usage."
|
|
64
|
+
)
|
|
65
|
+
raise SystemExit(ExitCode.ERROR)
|
|
66
|
+
|
|
67
|
+
if command in HELP_COMMANDS:
|
|
68
|
+
_run_builtin()
|
|
55
69
|
|
|
56
70
|
|
|
57
71
|
def main() -> None:
|
|
@@ -65,9 +79,6 @@ def main() -> None:
|
|
|
65
79
|
)
|
|
66
80
|
|
|
67
81
|
case "-v" | "--version" | "version":
|
|
68
|
-
from ... import Package
|
|
69
|
-
from ..utils import print_version
|
|
70
|
-
|
|
71
82
|
raise SystemExit(print_version(Package.name))
|
|
72
83
|
|
|
73
84
|
case _ if command in BUILTIN_COMMANDS:
|
|
@@ -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
|
+
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 .utils 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()
|
|
File without changes
|
|
@@ -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
|
|
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
|