devs-common 1.1.5__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.
- devs_common-1.1.5/LICENSE +21 -0
- devs_common-1.1.5/PKG-INFO +57 -0
- devs_common-1.1.5/README.md +19 -0
- devs_common-1.1.5/devs_common/__init__.py +3 -0
- devs_common-1.1.5/devs_common/config.py +90 -0
- devs_common-1.1.5/devs_common/core/__init__.py +13 -0
- devs_common-1.1.5/devs_common/core/container.py +812 -0
- devs_common-1.1.5/devs_common/core/project.py +151 -0
- devs_common-1.1.5/devs_common/core/workspace.py +465 -0
- devs_common-1.1.5/devs_common/devs_config.py +163 -0
- devs_common-1.1.5/devs_common/exceptions.py +51 -0
- devs_common-1.1.5/devs_common/templates/Dockerfile +156 -0
- devs_common-1.1.5/devs_common/templates/devcontainer.json +111 -0
- devs_common-1.1.5/devs_common/templates/scripts/copy-ssh.sh +9 -0
- devs_common-1.1.5/devs_common/templates/scripts/post-create-wrapper.sh +58 -0
- devs_common-1.1.5/devs_common/templates/scripts/python-venv-integration.sh +33 -0
- devs_common-1.1.5/devs_common/templates/scripts/screenshot-webapp.sh +44 -0
- devs_common-1.1.5/devs_common/templates/scripts/setup-workspace.sh +312 -0
- devs_common-1.1.5/devs_common/templates/scripts/webapp-screenshot.py +162 -0
- devs_common-1.1.5/devs_common/templates/sudo-scripts/init-firewall.sh +198 -0
- devs_common-1.1.5/devs_common/templates/sudo-scripts/setup-devs-env.sh +113 -0
- devs_common-1.1.5/devs_common/templates/sudo-scripts/setup-vscode-cache.sh +18 -0
- devs_common-1.1.5/devs_common/templates/sudo-scripts/start-services.sh +55 -0
- devs_common-1.1.5/devs_common/templates/vscode-settings-reference.md +31 -0
- devs_common-1.1.5/devs_common/utils/__init__.py +31 -0
- devs_common-1.1.5/devs_common/utils/config_hash.py +75 -0
- devs_common-1.1.5/devs_common/utils/console.py +39 -0
- devs_common-1.1.5/devs_common/utils/devcontainer.py +482 -0
- devs_common-1.1.5/devs_common/utils/devcontainer_template.py +20 -0
- devs_common-1.1.5/devs_common/utils/docker_client.py +248 -0
- devs_common-1.1.5/devs_common/utils/file_utils.py +186 -0
- devs_common-1.1.5/devs_common/utils/git_utils.py +105 -0
- devs_common-1.1.5/devs_common.egg-info/PKG-INFO +57 -0
- devs_common-1.1.5/devs_common.egg-info/SOURCES.txt +37 -0
- devs_common-1.1.5/devs_common.egg-info/dependency_links.txt +1 -0
- devs_common-1.1.5/devs_common.egg-info/requires.txt +17 -0
- devs_common-1.1.5/devs_common.egg-info/top_level.txt +1 -0
- devs_common-1.1.5/pyproject.toml +77 -0
- devs_common-1.1.5/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Dan Lester
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: devs-common
|
|
3
|
+
Version: 1.1.5
|
|
4
|
+
Summary: Shared utilities for devs package ecosystem
|
|
5
|
+
Author: Dan Lester
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ideonate/devs
|
|
8
|
+
Project-URL: Repository, https://github.com/ideonate/devs
|
|
9
|
+
Project-URL: Issues, https://github.com/ideonate/devs/issues
|
|
10
|
+
Project-URL: Documentation, https://github.com/ideonate/devs/tree/main/packages/common
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Requires-Python: >=3.8
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: docker>=6.0.0
|
|
22
|
+
Requires-Dist: GitPython>=3.1.0
|
|
23
|
+
Requires-Dist: rich>=13.0.0
|
|
24
|
+
Requires-Dist: click>=8.0.0
|
|
25
|
+
Requires-Dist: pydantic>=2.0.0
|
|
26
|
+
Requires-Dist: pathspec>=0.11.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: black>=22.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: isort>=5.0.0; extra == "dev"
|
|
33
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
35
|
+
Requires-Dist: build>=0.10.0; extra == "dev"
|
|
36
|
+
Requires-Dist: twine>=4.0.0; extra == "dev"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
# devs-common
|
|
40
|
+
|
|
41
|
+
Shared utilities and core classes for the devs package ecosystem.
|
|
42
|
+
|
|
43
|
+
## Components
|
|
44
|
+
|
|
45
|
+
- **Core Classes**: Project, WorkspaceManager, ContainerManager
|
|
46
|
+
- **Configuration**: Base configuration classes
|
|
47
|
+
- **Exceptions**: Common exception hierarchy
|
|
48
|
+
- **Utilities**: Docker, Git, and file operation utilities
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from devs_common.core import Project, WorkspaceManager, ContainerManager
|
|
54
|
+
from devs_common.config import BaseConfig
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This package provides the shared foundation for both the devs CLI and webhook packages.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# devs-common
|
|
2
|
+
|
|
3
|
+
Shared utilities and core classes for the devs package ecosystem.
|
|
4
|
+
|
|
5
|
+
## Components
|
|
6
|
+
|
|
7
|
+
- **Core Classes**: Project, WorkspaceManager, ContainerManager
|
|
8
|
+
- **Configuration**: Base configuration classes
|
|
9
|
+
- **Exceptions**: Common exception hierarchy
|
|
10
|
+
- **Utilities**: Docker, Git, and file operation utilities
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
from devs_common.core import Project, WorkspaceManager, ContainerManager
|
|
16
|
+
from devs_common.config import BaseConfig
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This package provides the shared foundation for both the devs CLI and webhook packages.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""Base configuration for devs ecosystem."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Dict, Optional
|
|
6
|
+
from abc import ABC, abstractmethod
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class BaseConfig(ABC):
|
|
10
|
+
"""Base configuration class for devs ecosystem packages."""
|
|
11
|
+
|
|
12
|
+
def __init__(self) -> None:
|
|
13
|
+
"""Initialize base configuration."""
|
|
14
|
+
self._workspaces_dir: Optional[Path] = None
|
|
15
|
+
self._bridge_dir: Optional[Path] = None
|
|
16
|
+
self._project_prefix: Optional[str] = None
|
|
17
|
+
|
|
18
|
+
@property
|
|
19
|
+
def workspaces_dir(self) -> Path:
|
|
20
|
+
"""Get workspaces directory."""
|
|
21
|
+
if self._workspaces_dir is None:
|
|
22
|
+
# Default can be overridden by subclasses
|
|
23
|
+
workspaces_env = os.getenv("DEVS_WORKSPACES_DIR")
|
|
24
|
+
if workspaces_env:
|
|
25
|
+
self._workspaces_dir = Path(workspaces_env)
|
|
26
|
+
else:
|
|
27
|
+
self._workspaces_dir = self.get_default_workspaces_dir()
|
|
28
|
+
return self._workspaces_dir
|
|
29
|
+
|
|
30
|
+
@workspaces_dir.setter
|
|
31
|
+
def workspaces_dir(self, value: Path) -> None:
|
|
32
|
+
"""Set workspaces directory."""
|
|
33
|
+
self._workspaces_dir = value
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def bridge_dir(self) -> Path:
|
|
37
|
+
"""Get bridge directory."""
|
|
38
|
+
if self._bridge_dir is None:
|
|
39
|
+
# Default can be overridden by subclasses
|
|
40
|
+
bridge_env = os.getenv("DEVS_BRIDGE_DIR")
|
|
41
|
+
if bridge_env:
|
|
42
|
+
self._bridge_dir = Path(bridge_env)
|
|
43
|
+
else:
|
|
44
|
+
self._bridge_dir = self.get_default_bridge_dir()
|
|
45
|
+
return self._bridge_dir
|
|
46
|
+
|
|
47
|
+
@bridge_dir.setter
|
|
48
|
+
def bridge_dir(self, value: Path) -> None:
|
|
49
|
+
"""Set bridge directory."""
|
|
50
|
+
self._bridge_dir = value
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def project_prefix(self) -> str:
|
|
54
|
+
"""Get project prefix."""
|
|
55
|
+
if self._project_prefix is None:
|
|
56
|
+
self._project_prefix = os.getenv("DEVS_PROJECT_PREFIX", self.get_default_project_prefix())
|
|
57
|
+
return self._project_prefix
|
|
58
|
+
|
|
59
|
+
@project_prefix.setter
|
|
60
|
+
def project_prefix(self, value: str) -> None:
|
|
61
|
+
"""Set project prefix."""
|
|
62
|
+
self._project_prefix = value
|
|
63
|
+
|
|
64
|
+
@abstractmethod
|
|
65
|
+
def get_default_workspaces_dir(self) -> Path:
|
|
66
|
+
"""Get default workspaces directory. Override in subclasses."""
|
|
67
|
+
pass
|
|
68
|
+
|
|
69
|
+
@abstractmethod
|
|
70
|
+
def get_default_bridge_dir(self) -> Path:
|
|
71
|
+
"""Get default bridge directory. Override in subclasses."""
|
|
72
|
+
pass
|
|
73
|
+
|
|
74
|
+
@abstractmethod
|
|
75
|
+
def get_default_project_prefix(self) -> str:
|
|
76
|
+
"""Get default project prefix. Override in subclasses."""
|
|
77
|
+
pass
|
|
78
|
+
|
|
79
|
+
@property
|
|
80
|
+
def container_labels(self) -> Dict[str, str]:
|
|
81
|
+
"""Standard labels applied to containers."""
|
|
82
|
+
return {
|
|
83
|
+
"devs.managed": "true",
|
|
84
|
+
"devs.version": "0.1.0",
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
def ensure_directories(self) -> None:
|
|
88
|
+
"""Ensure required directories exist."""
|
|
89
|
+
self.workspaces_dir.mkdir(parents=True, exist_ok=True)
|
|
90
|
+
self.bridge_dir.mkdir(parents=True, exist_ok=True)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Core classes for devs ecosystem."""
|
|
2
|
+
|
|
3
|
+
from .project import Project, ProjectInfo
|
|
4
|
+
from .workspace import WorkspaceManager
|
|
5
|
+
from .container import ContainerManager, ContainerInfo
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"Project",
|
|
9
|
+
"ProjectInfo",
|
|
10
|
+
"WorkspaceManager",
|
|
11
|
+
"ContainerManager",
|
|
12
|
+
"ContainerInfo",
|
|
13
|
+
]
|