comfygit-core 0.2.0__py3-none-any.whl
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.
- comfygit_core/analyzers/custom_node_scanner.py +109 -0
- comfygit_core/analyzers/git_change_parser.py +156 -0
- comfygit_core/analyzers/model_scanner.py +318 -0
- comfygit_core/analyzers/node_classifier.py +58 -0
- comfygit_core/analyzers/node_git_analyzer.py +77 -0
- comfygit_core/analyzers/status_scanner.py +362 -0
- comfygit_core/analyzers/workflow_dependency_parser.py +143 -0
- comfygit_core/caching/__init__.py +16 -0
- comfygit_core/caching/api_cache.py +210 -0
- comfygit_core/caching/base.py +212 -0
- comfygit_core/caching/comfyui_cache.py +100 -0
- comfygit_core/caching/custom_node_cache.py +320 -0
- comfygit_core/caching/workflow_cache.py +797 -0
- comfygit_core/clients/__init__.py +4 -0
- comfygit_core/clients/civitai_client.py +412 -0
- comfygit_core/clients/github_client.py +349 -0
- comfygit_core/clients/registry_client.py +230 -0
- comfygit_core/configs/comfyui_builtin_nodes.py +1614 -0
- comfygit_core/configs/comfyui_models.py +62 -0
- comfygit_core/configs/model_config.py +151 -0
- comfygit_core/constants.py +82 -0
- comfygit_core/core/environment.py +1635 -0
- comfygit_core/core/workspace.py +898 -0
- comfygit_core/factories/environment_factory.py +419 -0
- comfygit_core/factories/uv_factory.py +61 -0
- comfygit_core/factories/workspace_factory.py +109 -0
- comfygit_core/infrastructure/sqlite_manager.py +156 -0
- comfygit_core/integrations/__init__.py +7 -0
- comfygit_core/integrations/uv_command.py +318 -0
- comfygit_core/logging/logging_config.py +15 -0
- comfygit_core/managers/environment_git_orchestrator.py +316 -0
- comfygit_core/managers/environment_model_manager.py +296 -0
- comfygit_core/managers/export_import_manager.py +116 -0
- comfygit_core/managers/git_manager.py +667 -0
- comfygit_core/managers/model_download_manager.py +252 -0
- comfygit_core/managers/model_symlink_manager.py +166 -0
- comfygit_core/managers/node_manager.py +1378 -0
- comfygit_core/managers/pyproject_manager.py +1321 -0
- comfygit_core/managers/user_content_symlink_manager.py +436 -0
- comfygit_core/managers/uv_project_manager.py +569 -0
- comfygit_core/managers/workflow_manager.py +1944 -0
- comfygit_core/models/civitai.py +432 -0
- comfygit_core/models/commit.py +18 -0
- comfygit_core/models/environment.py +293 -0
- comfygit_core/models/exceptions.py +378 -0
- comfygit_core/models/manifest.py +132 -0
- comfygit_core/models/node_mapping.py +201 -0
- comfygit_core/models/protocols.py +248 -0
- comfygit_core/models/registry.py +63 -0
- comfygit_core/models/shared.py +356 -0
- comfygit_core/models/sync.py +42 -0
- comfygit_core/models/system.py +204 -0
- comfygit_core/models/workflow.py +914 -0
- comfygit_core/models/workspace_config.py +71 -0
- comfygit_core/py.typed +0 -0
- comfygit_core/repositories/migrate_paths.py +49 -0
- comfygit_core/repositories/model_repository.py +958 -0
- comfygit_core/repositories/node_mappings_repository.py +246 -0
- comfygit_core/repositories/workflow_repository.py +57 -0
- comfygit_core/repositories/workspace_config_repository.py +121 -0
- comfygit_core/resolvers/global_node_resolver.py +459 -0
- comfygit_core/resolvers/model_resolver.py +250 -0
- comfygit_core/services/import_analyzer.py +218 -0
- comfygit_core/services/model_downloader.py +422 -0
- comfygit_core/services/node_lookup_service.py +251 -0
- comfygit_core/services/registry_data_manager.py +161 -0
- comfygit_core/strategies/__init__.py +4 -0
- comfygit_core/strategies/auto.py +72 -0
- comfygit_core/strategies/confirmation.py +69 -0
- comfygit_core/utils/comfyui_ops.py +125 -0
- comfygit_core/utils/common.py +164 -0
- comfygit_core/utils/conflict_parser.py +232 -0
- comfygit_core/utils/dependency_parser.py +231 -0
- comfygit_core/utils/download.py +216 -0
- comfygit_core/utils/environment_cleanup.py +111 -0
- comfygit_core/utils/filesystem.py +178 -0
- comfygit_core/utils/git.py +1184 -0
- comfygit_core/utils/input_signature.py +145 -0
- comfygit_core/utils/model_categories.py +52 -0
- comfygit_core/utils/pytorch.py +71 -0
- comfygit_core/utils/requirements.py +211 -0
- comfygit_core/utils/retry.py +242 -0
- comfygit_core/utils/symlink_utils.py +119 -0
- comfygit_core/utils/system_detector.py +258 -0
- comfygit_core/utils/uuid.py +28 -0
- comfygit_core/utils/uv_error_handler.py +158 -0
- comfygit_core/utils/version.py +73 -0
- comfygit_core/utils/workflow_hash.py +90 -0
- comfygit_core/validation/resolution_tester.py +297 -0
- comfygit_core-0.2.0.dist-info/METADATA +939 -0
- comfygit_core-0.2.0.dist-info/RECORD +93 -0
- comfygit_core-0.2.0.dist-info/WHEEL +4 -0
- comfygit_core-0.2.0.dist-info/licenses/LICENSE.txt +661 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"""Export/Import manager for bundling and extracting environments."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import tarfile
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import TYPE_CHECKING
|
|
7
|
+
|
|
8
|
+
from ..logging.logging_config import get_logger
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from .pyproject_manager import PyprojectManager
|
|
12
|
+
|
|
13
|
+
logger = get_logger(__name__)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ExportImportManager:
|
|
17
|
+
"""Manages environment export and import operations."""
|
|
18
|
+
|
|
19
|
+
def __init__(self, cec_path: Path, comfyui_path: Path):
|
|
20
|
+
self.cec_path = cec_path
|
|
21
|
+
self.comfyui_path = comfyui_path
|
|
22
|
+
|
|
23
|
+
def create_export(
|
|
24
|
+
self,
|
|
25
|
+
output_path: Path,
|
|
26
|
+
pyproject_manager: PyprojectManager
|
|
27
|
+
) -> Path:
|
|
28
|
+
"""Create export tarball.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
output_path: Output .tar.gz file path
|
|
32
|
+
pyproject_manager: PyprojectManager for reading config
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
Path to created tarball
|
|
36
|
+
"""
|
|
37
|
+
logger.info(f"Creating export at {output_path}")
|
|
38
|
+
|
|
39
|
+
with tarfile.open(output_path, "w:gz") as tar:
|
|
40
|
+
# Add pyproject.toml
|
|
41
|
+
pyproject_path = self.cec_path / "pyproject.toml"
|
|
42
|
+
if pyproject_path.exists():
|
|
43
|
+
tar.add(pyproject_path, arcname="pyproject.toml")
|
|
44
|
+
|
|
45
|
+
# Add uv.lock
|
|
46
|
+
lock_path = self.cec_path / "uv.lock"
|
|
47
|
+
if lock_path.exists():
|
|
48
|
+
tar.add(lock_path, arcname="uv.lock")
|
|
49
|
+
|
|
50
|
+
# Add .python-version
|
|
51
|
+
python_version_path = self.cec_path / ".python-version"
|
|
52
|
+
if python_version_path.exists():
|
|
53
|
+
tar.add(python_version_path, arcname=".python-version")
|
|
54
|
+
|
|
55
|
+
# Add workflows
|
|
56
|
+
workflows_path = self.cec_path / "workflows"
|
|
57
|
+
if workflows_path.exists():
|
|
58
|
+
for workflow_file in workflows_path.glob("*.json"):
|
|
59
|
+
tar.add(workflow_file, arcname=f"workflows/{workflow_file.name}")
|
|
60
|
+
|
|
61
|
+
# Add dev nodes (read from pyproject.toml)
|
|
62
|
+
pyproject_data = pyproject_manager.load()
|
|
63
|
+
nodes_config = pyproject_data.get("tool", {}).get("comfygit", {}).get("nodes", {})
|
|
64
|
+
dev_nodes = [name for name, node in nodes_config.items() if node.get("source") == "development"]
|
|
65
|
+
|
|
66
|
+
custom_nodes_path = self.comfyui_path / "custom_nodes"
|
|
67
|
+
if custom_nodes_path.exists():
|
|
68
|
+
for node_name in dev_nodes:
|
|
69
|
+
node_path = custom_nodes_path / node_name
|
|
70
|
+
if node_path.exists():
|
|
71
|
+
self._add_filtered_directory(tar, node_path, f"dev_nodes/{node_name}")
|
|
72
|
+
|
|
73
|
+
logger.info(f"Export created successfully: {output_path}")
|
|
74
|
+
return output_path
|
|
75
|
+
|
|
76
|
+
def extract_import(self, tarball_path: Path, target_cec_path: Path) -> None:
|
|
77
|
+
"""Extract import tarball to target .cec directory.
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
tarball_path: Path to .tar.gz file
|
|
81
|
+
target_cec_path: Target .cec directory (must not exist)
|
|
82
|
+
|
|
83
|
+
Raises:
|
|
84
|
+
ValueError: If target already exists
|
|
85
|
+
"""
|
|
86
|
+
if target_cec_path.exists():
|
|
87
|
+
raise ValueError(f"Target path already exists: {target_cec_path}")
|
|
88
|
+
|
|
89
|
+
logger.info(f"Extracting import from {tarball_path}")
|
|
90
|
+
|
|
91
|
+
# Create target directory
|
|
92
|
+
target_cec_path.mkdir(parents=True)
|
|
93
|
+
|
|
94
|
+
# Extract tarball (use data filter for Python 3.14+ compatibility)
|
|
95
|
+
with tarfile.open(tarball_path, "r:gz") as tar:
|
|
96
|
+
tar.extractall(target_cec_path, filter='data')
|
|
97
|
+
|
|
98
|
+
logger.info(f"Import extracted successfully to {target_cec_path}")
|
|
99
|
+
|
|
100
|
+
def _add_filtered_directory(self, tar: tarfile.TarFile, source_path: Path, arcname: str):
|
|
101
|
+
"""Add directory to tarball, filtering by .gitignore.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
tar: Open tarfile
|
|
105
|
+
source_path: Source directory
|
|
106
|
+
arcname: Archive name prefix
|
|
107
|
+
"""
|
|
108
|
+
# Simple implementation - add all files (MVP)
|
|
109
|
+
# TODO: Add .gitignore filtering if needed
|
|
110
|
+
for item in source_path.rglob("*"):
|
|
111
|
+
if item.is_file():
|
|
112
|
+
# Skip __pycache__ and .pyc files
|
|
113
|
+
if "__pycache__" in item.parts or item.suffix == ".pyc":
|
|
114
|
+
continue
|
|
115
|
+
relative = item.relative_to(source_path)
|
|
116
|
+
tar.add(item, arcname=f"{arcname}/{relative}")
|