diff --git a/.gitignore b/.gitignore
index e48c1b0..c28f927 100755
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,6 @@ wheels/
# Virtual environments
.venv
+
+# Logs
+logs/
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
deleted file mode 100644
index bcc7958..0000000
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 0d63fbb..7ae8938 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -4,4 +4,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 3b2ef14..f1711ae 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,65 +1,44 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -68,10 +47,11 @@
"keyToString": {
"ModuleVcsDetector.initialDetectionPerformed": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
+ "RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
"RunOnceActivity.git.unshallow": "true",
"git-widget-placeholder": "main",
- "last_opened_file_path": "/data/git/compose_gen",
- "run.code.analysis.last.selected.profile": "pProject Default"
+ "run.code.analysis.last.selected.profile": "aDefault",
+ "settings.editor.selected.configurable": "actions.on.save"
}
}]]>
@@ -83,13 +63,24 @@
-
- 1768276046955
+
+ 1768351925652
- 1768276046955
-
+ 1768351925652
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..473a0f4
diff --git a/pyproject.toml b/pyproject.toml
index 2e8bd42..d650769 100755
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -7,6 +7,7 @@ authors = [{ name = "Christian Camper", email = "ccamper7@gmail.com" }]
requires-python = ">=3.13"
dependencies = [
"basedpyright>=1.37.1",
+ "loguru>=0.7.3",
"pyyaml>=6.0.3",
"ruff>=0.14.11",
]
diff --git a/src/docker_compose/__init__.py b/src/docker_compose/__init__.py
index 7db5cf8..a144832 100644
--- a/src/docker_compose/__init__.py
+++ b/src/docker_compose/__init__.py
@@ -1,6 +1,25 @@
+from inspect import isclass
+from itertools import chain
from pathlib import Path
+from loguru import logger
+
ROOT = Path("/nas")
TEMPLATE_ROOT = ROOT.joinpath("docker_templates")
APP_ROOT = ROOT.joinpath("apps")
TRAEFIK_PATH = TEMPLATE_ROOT.joinpath("traefik")
+
+_ = logger.add("logs/app.log", level="DEBUG", rotation="1 second", retention="10")
+
+
+def log_cls(obj: type | object, **kwargs: str | int | bool):
+ logger.debug(
+ "\n\t".join(
+ chain(
+ (
+ f"created\n\tcls: {obj.__name__ if isclass(obj) else type(obj).__name__}",
+ ),
+ (f"{k}: {v}" for k, v in kwargs.items()),
+ )
+ )
+ )
diff --git a/src/docker_compose/__main__.py b/src/docker_compose/__main__.py
index bec333f..09fcc96 100644
--- a/src/docker_compose/__main__.py
+++ b/src/docker_compose/__main__.py
@@ -1,11 +1,13 @@
from collections.abc import Iterator
-from typing import cast
-from docker_compose import TRAEFIK_PATH
-from docker_compose.compose_data.net_yaml import NetArgsYaml
-from docker_compose.render.main import RenderByApp, RenderByOrg
-from docker_compose.util.Ts import TypeYamlCompatibleDict
-from docker_compose.util.yaml_util import to_yaml
+# from typing import cast
+#
+# from docker_compose import TRAEFIK_PATH
+# from docker_compose.compose_data.net_yaml import NetArgsYaml
+from docker_compose.render.main import RenderByApp # , RenderByOrg
+
+# from docker_compose.util.Ts import TypeYamlCompatibleDict
+# from docker_compose.util.yaml_util import to_yaml
def render_all() -> Iterator[str]:
diff --git a/src/docker_compose/compose_data/data.py b/src/docker_compose/compose_data/data.py
index d78ef99..ef38cdc 100644
--- a/src/docker_compose/compose_data/data.py
+++ b/src/docker_compose/compose_data/data.py
@@ -3,6 +3,7 @@ from dataclasses import dataclass
from pathlib import Path
from typing import Self, cast, final, override
+from docker_compose import log_cls
from docker_compose.compose_data import DN
from docker_compose.compose_data.compose_yaml import ComposeYaml
from docker_compose.compose_data.net import Net
@@ -21,6 +22,9 @@ class ComposeData:
networks: Net
volumes: dict[str, VolYaml]
+ def __post_init__(self):
+ log_cls(ComposeData, name=self.name)
+
@override
def __str__(self) -> str:
rep = Replace.format_src("name", self.name)
@@ -39,6 +43,7 @@ class ComposeData:
@classmethod
def from_path(cls, path: Path) -> Self:
+ log_cls(ComposeData, path=str(path))
return cls.from_src_paths(SrcPaths.from_path(path))
@classmethod
diff --git a/src/docker_compose/compose_data/dest_paths.py b/src/docker_compose/compose_data/dest_paths.py
index 4c4cca6..47224e4 100644
--- a/src/docker_compose/compose_data/dest_paths.py
+++ b/src/docker_compose/compose_data/dest_paths.py
@@ -9,6 +9,13 @@ class DestPaths:
compose_file: Path
bind_vol_path: Path
+ # def __post_init__(self):
+ # log_cls(
+ # self,
+ # compose_file=str(self.compose_file),
+ # bind_vol_path=str(self.bind_vol_path),
+ # )
+
@classmethod
def from_path(cls, src: Path) -> Self:
return cls(
diff --git a/src/docker_compose/env/data.py b/src/docker_compose/env/data.py
index 2e81a79..72111fd 100644
--- a/src/docker_compose/env/data.py
+++ b/src/docker_compose/env/data.py
@@ -6,6 +6,7 @@ from functools import partial
from pathlib import Path
from typing import Self, final, override
+from docker_compose import log_cls
from docker_compose.util.replace import Replace
@@ -31,6 +32,7 @@ class EnvData:
@classmethod
def from_path(cls, path: Path) -> Self:
+ log_cls(cls, path=str(path))
return cls({k: v for k, v in cls.get_lines(path)})
@property
@@ -41,4 +43,3 @@ class EnvData:
yield k, v
continue
yield k, p(v)
-
diff --git a/src/docker_compose/env/main.py b/src/docker_compose/env/main.py
index bb8acc1..fa055ab 100644
--- a/src/docker_compose/env/main.py
+++ b/src/docker_compose/env/main.py
@@ -57,7 +57,7 @@ class EnvByOrg:
def from_path(cls, path: Path) -> Self:
return cls(
dict(cls._from_path_sub(path)),
- OrgData.get_app(path),
+ path.stem,
)
#
diff --git a/src/docker_compose/org/data.py b/src/docker_compose/org/data.py
index db95b52..aa802f5 100644
--- a/src/docker_compose/org/data.py
+++ b/src/docker_compose/org/data.py
@@ -3,7 +3,7 @@ from dataclasses import dataclass
from pathlib import Path
from typing import Callable, Self, cast, final
-from docker_compose import APP_ROOT
+from docker_compose import APP_ROOT, log_cls
from docker_compose.org.org_yaml import OrgDataYaml, OrgYaml
from docker_compose.util.replace import Replace
from docker_compose.util.yaml_util import read_yaml
@@ -17,6 +17,14 @@ class OrgData:
url: Replace
dest: Path
+ def __post_init__(self):
+ log_cls(
+ self,
+ app=self.app.dest,
+ org=self.org.dest,
+ url=self.url.dest,
+ )
+
@classmethod
def from_dict(cls, app: str, org: str, data: OrgDataYaml) -> Self:
url = data.get("url")
@@ -29,13 +37,14 @@ class OrgData:
APP_ROOT.joinpath(org, app),
)
- @classmethod
- def get_app(cls, path: Path) -> str:
- return path.stem
+ # @classmethod
+ # def get_app(cls, path: Path) -> str:
+ # return path.stem
@classmethod
def from_path(cls, path: Path) -> Iterator[Self]:
- app = cls.get_app(path)
+ log_cls(cls, path=str(path))
+ app = path.stem
for org, data in cast(OrgYaml, cast(object, read_yaml(path))).items():
yield cls.from_dict(app, org, data)
diff --git a/uv.lock b/uv.lock
index 0c1308d..7457119 100755
--- a/uv.lock
+++ b/uv.lock
@@ -14,12 +14,22 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/ad/d6/6b33bb49f08d761d7c958a1e3cecfb3ffbdcf4ba6bbed65b23ab47516b75/basedpyright-1.37.1-py3-none-any.whl", hash = "sha256:caf3adfe54f51623241712f8b4367adb51ef8a8c2288e3e1ec4118319661340d", size = 12297397, upload-time = "2026-01-08T14:42:50.306Z" },
]
+[[package]]
+name = "colorama"
+version = "0.4.6"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" },
+]
+
[[package]]
name = "docker-compose"
version = "0.1.0"
source = { editable = "." }
dependencies = [
{ name = "basedpyright" },
+ { name = "loguru" },
{ name = "pyyaml" },
{ name = "ruff" },
]
@@ -27,10 +37,24 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "basedpyright", specifier = ">=1.37.1" },
+ { name = "loguru", specifier = ">=0.7.3" },
{ name = "pyyaml", specifier = ">=6.0.3" },
{ name = "ruff", specifier = ">=0.14.11" },
]
+[[package]]
+name = "loguru"
+version = "0.7.3"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "colorama", marker = "sys_platform == 'win32'" },
+ { name = "win32-setctime", marker = "sys_platform == 'win32'" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/3a/05/a1dae3dffd1116099471c643b8924f5aa6524411dc6c63fdae648c4f1aca/loguru-0.7.3.tar.gz", hash = "sha256:19480589e77d47b8d85b2c827ad95d49bf31b0dcde16593892eb51dd18706eb6", size = 63559, upload-time = "2024-12-06T11:20:56.608Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/0c/29/0348de65b8cc732daa3e33e67806420b2ae89bdce2b04af740289c5c6c8c/loguru-0.7.3-py3-none-any.whl", hash = "sha256:31a33c10c8e1e10422bfd431aeb5d351c7cf7fa671e3c4df004162264b28220c", size = 61595, upload-time = "2024-12-06T11:20:54.538Z" },
+]
+
[[package]]
name = "nodejs-wheel-binaries"
version = "24.12.0"
@@ -108,3 +132,12 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/58/f1/90ddc533918d3a2ad628bc3044cdfc094949e6d4b929220c3f0eb8a1c998/ruff-0.14.11-py3-none-win_amd64.whl", hash = "sha256:f981cea63d08456b2c070e64b79cb62f951aa1305282974d4d5216e6e0178ae6", size = 14001379, upload-time = "2026-01-08T19:11:52.591Z" },
{ url = "https://files.pythonhosted.org/packages/c4/1c/1dbe51782c0e1e9cfce1d1004752672d2d4629ea46945d19d731ad772b3b/ruff-0.14.11-py3-none-win_arm64.whl", hash = "sha256:649fb6c9edd7f751db276ef42df1f3df41c38d67d199570ae2a7bd6cbc3590f0", size = 12938644, upload-time = "2026-01-08T19:11:50.027Z" },
]
+
+[[package]]
+name = "win32-setctime"
+version = "1.2.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/b3/8f/705086c9d734d3b663af0e9bb3d4de6578d08f46b1b101c2442fd9aecaa2/win32_setctime-1.2.0.tar.gz", hash = "sha256:ae1fdf948f5640aae05c511ade119313fb6a30d7eabe25fef9764dca5873c4c0", size = 4867, upload-time = "2024-12-07T15:28:28.314Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/e1/07/c6fe3ad3e685340704d314d765b7912993bcb8dc198f0e7a89382d37974b/win32_setctime-1.2.0-py3-none-any.whl", hash = "sha256:95d644c4e708aba81dc3704a116d8cbc974d70b3bdb8be1d150e36be6e9d1390", size = 4083, upload-time = "2024-12-07T15:28:26.465Z" },
+]