rapidctl 0.1.0__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.
- rapidctl-0.1.0/.github/workflows/python-publish.yml +41 -0
- rapidctl-0.1.0/.github/workflows/python-test.yml +62 -0
- rapidctl-0.1.0/.gitignore +179 -0
- rapidctl-0.1.0/CHANGELOG.md +27 -0
- rapidctl-0.1.0/PKG-INFO +257 -0
- rapidctl-0.1.0/README.md +247 -0
- rapidctl-0.1.0/examples/example_connector_usage.py +101 -0
- rapidctl-0.1.0/pyproject.toml +25 -0
- rapidctl-0.1.0/rapidctl/__init__.py +0 -0
- rapidctl-0.1.0/rapidctl/bootstrap/__init__.py +0 -0
- rapidctl-0.1.0/rapidctl/bootstrap/client.py +104 -0
- rapidctl-0.1.0/rapidctl/bootstrap/connectors/__init__.py +46 -0
- rapidctl-0.1.0/rapidctl/bootstrap/connectors/base.py +72 -0
- rapidctl-0.1.0/rapidctl/bootstrap/connectors/linux.py +97 -0
- rapidctl-0.1.0/rapidctl/bootstrap/connectors/osx.py +230 -0
- rapidctl-0.1.0/rapidctl/bootstrap/state.py +107 -0
- rapidctl-0.1.0/rapidctl/cli/__init__.py +198 -0
- rapidctl-0.1.0/rapidctl/cli/actions.py +200 -0
- rapidctl-0.1.0/rapidctl/cli/main.py +133 -0
- rapidctl-0.1.0/rapidctl/cli/mcp.py +76 -0
- rapidctl-0.1.0/rapidctl/cli/tasks.py +204 -0
- rapidctl-0.1.0/rapidctl/errors/__init__.py +11 -0
- rapidctl-0.1.0/rapidctl/utils/version.py +105 -0
- rapidctl-0.1.0/tests/conftest.py +21 -0
- rapidctl-0.1.0/tests/test_auth_handling.py +65 -0
- rapidctl-0.1.0/tests/test_auto_detection.py +45 -0
- rapidctl-0.1.0/tests/test_base_connector.py +87 -0
- rapidctl-0.1.0/tests/test_client.py +16 -0
- rapidctl-0.1.0/tests/test_client_connect.py +81 -0
- rapidctl-0.1.0/tests/test_container_validator.py +45 -0
- rapidctl-0.1.0/tests/test_image_caching.py +68 -0
- rapidctl-0.1.0/tests/test_linux_connector.py +42 -0
- rapidctl-0.1.0/tests/test_main_flow.py +65 -0
- rapidctl-0.1.0/tests/test_mcp.py +105 -0
- rapidctl-0.1.0/tests/test_osx_connector.py +98 -0
- rapidctl-0.1.0/tests/test_state_manager.py +87 -0
- rapidctl-0.1.0/tests/test_version_management.py +145 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Python Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
push:
|
|
7
|
+
tags:
|
|
8
|
+
- 'v*'
|
|
9
|
+
paths:
|
|
10
|
+
- 'rapidctl/**'
|
|
11
|
+
- 'pyproject.toml'
|
|
12
|
+
- '.github/workflows/python-publish.yml'
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build-and-publish:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
environment:
|
|
18
|
+
name: pypi
|
|
19
|
+
url: https://pypi.org/p/rapidctl
|
|
20
|
+
permissions:
|
|
21
|
+
id-token: write
|
|
22
|
+
contents: read
|
|
23
|
+
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
with:
|
|
27
|
+
fetch-depth: 0 # Required for hatch-vcs dynamic versioning
|
|
28
|
+
|
|
29
|
+
- name: Set up Python
|
|
30
|
+
uses: actions/setup-python@v5
|
|
31
|
+
with:
|
|
32
|
+
python-version: "3.x"
|
|
33
|
+
|
|
34
|
+
- name: Install build tool
|
|
35
|
+
run: python -m pip install build
|
|
36
|
+
|
|
37
|
+
- name: Build sdist and wheel
|
|
38
|
+
run: python -m build
|
|
39
|
+
|
|
40
|
+
- name: Publish to PyPI
|
|
41
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name: Python Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ "main" ]
|
|
6
|
+
paths:
|
|
7
|
+
- 'rapidctl/**'
|
|
8
|
+
- 'tests/**'
|
|
9
|
+
- 'pyproject.toml'
|
|
10
|
+
- '.github/workflows/python-test.yml'
|
|
11
|
+
pull_request:
|
|
12
|
+
branches: [ "main" ]
|
|
13
|
+
paths:
|
|
14
|
+
- 'rapidctl/**'
|
|
15
|
+
- 'tests/**'
|
|
16
|
+
- 'pyproject.toml'
|
|
17
|
+
- '.github/workflows/python-test.yml'
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
test:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
strategy:
|
|
23
|
+
matrix:
|
|
24
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
25
|
+
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v4
|
|
28
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
29
|
+
uses: actions/setup-python@v5
|
|
30
|
+
with:
|
|
31
|
+
python-version: ${{ matrix.python-version }}
|
|
32
|
+
|
|
33
|
+
- name: Install dependencies
|
|
34
|
+
run: |
|
|
35
|
+
sudo apt-get update
|
|
36
|
+
sudo apt-get install -y podman
|
|
37
|
+
sudo systemctl start podman
|
|
38
|
+
python -m pip install --upgrade pip
|
|
39
|
+
pip install podman pytest
|
|
40
|
+
pip install -e .
|
|
41
|
+
|
|
42
|
+
- name: Start Podman service
|
|
43
|
+
run: |
|
|
44
|
+
# Ensure we have a clean state for the socket
|
|
45
|
+
rm -f /home/runner/podman.sock
|
|
46
|
+
# Start podman system service in background
|
|
47
|
+
podman system service unix:///home/runner/podman.sock --time 0 &
|
|
48
|
+
sleep 10
|
|
49
|
+
# Verify socket exists and Podman can connect to it
|
|
50
|
+
if [ ! -S /home/runner/podman.sock ]; then
|
|
51
|
+
echo "Error: Podman socket not found at /home/runner/podman.sock"
|
|
52
|
+
# Try to show logs if possible (though backgrounded, some info might be in dmesg or similar)
|
|
53
|
+
podman info
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
56
|
+
echo "โ Podman socket created successfully"
|
|
57
|
+
podman --remote --url unix:///home/runner/podman.sock info
|
|
58
|
+
echo "PODMAN_SOCKET=unix:///home/runner/podman.sock" >> $GITHUB_ENV
|
|
59
|
+
|
|
60
|
+
- name: Test with pytest
|
|
61
|
+
run: |
|
|
62
|
+
pytest tests/
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
|
|
2
|
+
# Byte-compiled / optimized / DLL files
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*$py.class
|
|
6
|
+
|
|
7
|
+
# C extensions
|
|
8
|
+
*.so
|
|
9
|
+
|
|
10
|
+
# Distribution / packaging
|
|
11
|
+
.Python
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# UV
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
#uv.lock
|
|
103
|
+
|
|
104
|
+
# poetry
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
106
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
107
|
+
# commonly ignored for libraries.
|
|
108
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
109
|
+
#poetry.lock
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
#pdm.lock
|
|
114
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
115
|
+
# in version control.
|
|
116
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
117
|
+
.pdm.toml
|
|
118
|
+
.pdm-python
|
|
119
|
+
.pdm-build/
|
|
120
|
+
|
|
121
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
122
|
+
__pypackages__/
|
|
123
|
+
|
|
124
|
+
# Celery stuff
|
|
125
|
+
celerybeat-schedule
|
|
126
|
+
celerybeat.pid
|
|
127
|
+
|
|
128
|
+
# SageMath parsed files
|
|
129
|
+
*.sage.py
|
|
130
|
+
|
|
131
|
+
# Environments
|
|
132
|
+
.env
|
|
133
|
+
.venv
|
|
134
|
+
env/
|
|
135
|
+
venv/
|
|
136
|
+
ENV/
|
|
137
|
+
env.bak/
|
|
138
|
+
venv.bak/
|
|
139
|
+
venv_*
|
|
140
|
+
|
|
141
|
+
# Spyder project settings
|
|
142
|
+
.spyderproject
|
|
143
|
+
.spyproject
|
|
144
|
+
|
|
145
|
+
# Rope project settings
|
|
146
|
+
.ropeproject
|
|
147
|
+
|
|
148
|
+
# mkdocs documentation
|
|
149
|
+
/site
|
|
150
|
+
|
|
151
|
+
# mypy
|
|
152
|
+
.mypy_cache/
|
|
153
|
+
.dmypy.json
|
|
154
|
+
dmypy.json
|
|
155
|
+
|
|
156
|
+
# Pyre type checker
|
|
157
|
+
.pyre/
|
|
158
|
+
|
|
159
|
+
# pytype static type analyzer
|
|
160
|
+
.pytype/
|
|
161
|
+
|
|
162
|
+
# Cython debug symbols
|
|
163
|
+
cython_debug/
|
|
164
|
+
|
|
165
|
+
# PyCharm
|
|
166
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
167
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
168
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
169
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
170
|
+
#.idea/
|
|
171
|
+
|
|
172
|
+
# Ruff stuff:
|
|
173
|
+
.ruff_cache/
|
|
174
|
+
|
|
175
|
+
# PyPI configuration file
|
|
176
|
+
.pypirc
|
|
177
|
+
|
|
178
|
+
# Vim editor
|
|
179
|
+
*.swp
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-03-08
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial Beta release of `rapidctl`.
|
|
12
|
+
- Support for creating custom CLI tools using Podman.
|
|
13
|
+
- Automatic container detection and lifecycle management (OSX and Linux).
|
|
14
|
+
- State management for container-based tools.
|
|
15
|
+
- MCP (Model Context Protocol) support for exposing subcommands.
|
|
16
|
+
- Authentication handling for container registries.
|
|
17
|
+
- Image caching and version management.
|
|
18
|
+
- Comprehensive test suite for core functionality.
|
|
19
|
+
- GitHub Actions for automated testing and PyPI publishing.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- Refactored state management into a pluggable `StateManager`.
|
|
23
|
+
- Optimized GitHub Actions to trigger only on relevant file changes.
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
- Improved error handling for container command execution.
|
|
27
|
+
- Resolved issues with Podman authentication on macOS.
|
rapidctl-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rapidctl
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python framework for creating custom CLI tools using Podman
|
|
5
|
+
Project-URL: Homepage, https://github.com/dalethestirling/rapidctl
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Requires-Dist: mcp
|
|
8
|
+
Requires-Dist: podman
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
|
|
11
|
+
# Rapidctl
|
|
12
|
+
|
|
13
|
+
**Rapidctl** is a Python framework for creating custom CLI tools that execute commands inside containerized environments using Podman. It allows you to package and distribute CLI utilities where all dependencies and runtime environments are containerized, ensuring consistency across different systems.
|
|
14
|
+
|
|
15
|
+
## ๐ฏ Purpose
|
|
16
|
+
|
|
17
|
+
Rapidctl solves the problem of distributing CLI tools with complex dependencies. Instead of requiring users to install specific versions of languages, libraries, or system packages, you package everything in a container and provide a lightweight Python wrapper that handles container orchestration transparently.
|
|
18
|
+
|
|
19
|
+
## ๐๏ธ Architecture
|
|
20
|
+
|
|
21
|
+
Rapidctl consists of three main layers:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
25
|
+
โ Your Custom CLI (e.g. examplectl) โ โ User-facing entry point
|
|
26
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
27
|
+
โ Bootstrap Layer (CtlClient) โ โ Configuration & validation
|
|
28
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
29
|
+
โ CLI Layer (PodmanCLI) โ โ Container orchestration
|
|
30
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
31
|
+
โ Podman API โ โ Container runtime
|
|
32
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Components
|
|
36
|
+
|
|
37
|
+
- **Bootstrap Layer** (`rapidctl.bootstrap.client`)
|
|
38
|
+
- `CtlClient`: Defines container configuration and validates container image names
|
|
39
|
+
- Prevents command injection through input sanitization
|
|
40
|
+
|
|
41
|
+
- **Connectors** (`rapidctl.bootstrap.connectors`)
|
|
42
|
+
- Connectors are used to connect to the container runtime
|
|
43
|
+
- Connectors are platform specific
|
|
44
|
+
- Connectors are used by the CLI Layer to interact with the container runtime
|
|
45
|
+
- Connectors are plugins for different ecosystems (Window, OSX, Linux, etc)
|
|
46
|
+
|
|
47
|
+
- **CLI Layer** (`rapidctl.cli`)
|
|
48
|
+
- `PodmanCLI`: Interfaces with Podman API for container operations
|
|
49
|
+
- Handles image pulling, container management, and command execution
|
|
50
|
+
|
|
51
|
+
- **Actions** (`rapidctl.cli.actions`)
|
|
52
|
+
- Actions are an operation to achieve an outcome
|
|
53
|
+
- Actions orchestrate and use one or more tasks to achieve their outcome
|
|
54
|
+
|
|
55
|
+
- **Tasks** (`rapidctl.cli.tasks`)
|
|
56
|
+
- Tasks perform a single operation
|
|
57
|
+
- Tasks are the building blocks of actions
|
|
58
|
+
|
|
59
|
+
## ๐ Quick Start
|
|
60
|
+
|
|
61
|
+
### Prerequisites
|
|
62
|
+
|
|
63
|
+
- Python 3.10+
|
|
64
|
+
- Podman installed and running (on macOS, you will be automatically prompted to start the machine if it is stopped)
|
|
65
|
+
- `podman` Python package
|
|
66
|
+
|
|
67
|
+
### Installation
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Clone the repository
|
|
71
|
+
git clone https://github.com/yourusername/rapidctl.git
|
|
72
|
+
cd rapidctl
|
|
73
|
+
|
|
74
|
+
# Install dependencies
|
|
75
|
+
pip install podman
|
|
76
|
+
|
|
77
|
+
# Optional: Set the Podman socket path manually (auto-detected by default)
|
|
78
|
+
# export PODMAN_SOCKET="unix:///run/user/$(id -u)/podman/podman.sock"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Creating Your Custom CLI Tool
|
|
82
|
+
|
|
83
|
+
1. **Create your CLI wrapper** (e.g., `myctl`):
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
#!/usr/bin/env python
|
|
87
|
+
|
|
88
|
+
import re
|
|
89
|
+
import sys
|
|
90
|
+
from rapidctl.cli.main import main
|
|
91
|
+
from rapidctl.bootstrap import client
|
|
92
|
+
|
|
93
|
+
# Create and configure the client
|
|
94
|
+
client = client.CtlClient()
|
|
95
|
+
client.container_repo = "docker.io/myorg/mytool-container"
|
|
96
|
+
client.baseline_version = "1.0.0"
|
|
97
|
+
client.client_version = "0.0.1"
|
|
98
|
+
|
|
99
|
+
# Run the CLI
|
|
100
|
+
if __name__ == '__main__':
|
|
101
|
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
102
|
+
sys.exit(main(client))
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
2. **Make it executable**:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
chmod +x myctl
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
3. **Use your CLI**:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
./myctl <command> <args>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The tool will automatically:
|
|
118
|
+
- Check if the container image exists locally
|
|
119
|
+
- Pull the image if needed
|
|
120
|
+
- Execute your command inside the container
|
|
121
|
+
|
|
122
|
+
## ๐ Example: rapidctl-examplectl
|
|
123
|
+
|
|
124
|
+
A complete reference implementation and template for building your own CLI tool can be found in the [rapidctl-examplectl](https://github.com/dalethestirling/rapidctl-examplectl) repository.
|
|
125
|
+
|
|
126
|
+
It includes:
|
|
127
|
+
- A working CLI wrapper
|
|
128
|
+
- A `Dockerfile` for the container environment
|
|
129
|
+
- Example command orchestration scripts
|
|
130
|
+
- Version management demonstrations
|
|
131
|
+
|
|
132
|
+
## ๐ง Configuration
|
|
133
|
+
|
|
134
|
+
### CtlClient Properties
|
|
135
|
+
|
|
136
|
+
| Property | Type | Default | Description |
|
|
137
|
+
|----------|------|---------|-------------|
|
|
138
|
+
| `container_repo` | `str` | `None` | Container registry path (e.g., `docker.io/user/image`) |
|
|
139
|
+
| `baseline_version` | `str` | `"1.0.0"` | Container image tag/version |
|
|
140
|
+
| `client_version` | `str` | `"0.0.1"` | Your CLI tool version |
|
|
141
|
+
| `image_id` | `str` | `None` | Specific image ID (optional) |
|
|
142
|
+
| `command_path` | `str` | `"/opt/rapidctl/cmd/"` | Path inside container where commands are located |
|
|
143
|
+
|
|
144
|
+
### Environment Variables
|
|
145
|
+
|
|
146
|
+
- **`PODMAN_SOCKET`**: Path to Podman socket (optional)
|
|
147
|
+
- If not set, rapidctl will auto-detect the socket location using platform-specific connectors
|
|
148
|
+
- On macOS, auto-detection checks:
|
|
149
|
+
- `~/.local/share/containers/podman/machine/podman.sock`
|
|
150
|
+
- `/var/run/docker.sock`
|
|
151
|
+
- Machine-specific socket locations
|
|
152
|
+
- Override auto-detection by setting this variable:
|
|
153
|
+
```bash
|
|
154
|
+
export PODMAN_SOCKET="unix:///path/to/your/podman.sock"
|
|
155
|
+
```
|
|
156
|
+
- Useful for custom Podman installations or when running multiple Podman instances
|
|
157
|
+
|
|
158
|
+
## ๐ Security
|
|
159
|
+
|
|
160
|
+
Rapidctl includes container image name validation to prevent command injection attacks:
|
|
161
|
+
|
|
162
|
+
- Sanitizes registry URLs and image names
|
|
163
|
+
- Validates domain names and repository paths
|
|
164
|
+
- Removes dangerous characters (`;`, `|`, `&`, etc.)
|
|
165
|
+
- Supports standard Docker/Podman image formats
|
|
166
|
+
|
|
167
|
+
Example validated formats:
|
|
168
|
+
- `ubuntu:20.04`
|
|
169
|
+
- `docker.io/library/ubuntu:latest`
|
|
170
|
+
- `registry.example.com/myproject/myimage:v1.2.3`
|
|
171
|
+
- `localhost:5000/my-image`
|
|
172
|
+
|
|
173
|
+
## ๐งช Testing
|
|
174
|
+
|
|
175
|
+
Run the test suite:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# Run all tests
|
|
179
|
+
pytest tests/
|
|
180
|
+
|
|
181
|
+
# Run specific test
|
|
182
|
+
pytest tests/test_client.py
|
|
183
|
+
pytest tests/test_container_validator.py
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## ๐ฆ Project Structure
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
rapidctl/
|
|
190
|
+
โโโ rapidctl/
|
|
191
|
+
โ โโโ __init__.py
|
|
192
|
+
โ โโโ bootstrap/
|
|
193
|
+
โ โ โโโ __init__.py
|
|
194
|
+
โ โ โโโ client.py # CtlClient configuration
|
|
195
|
+
โ โ โโโ state.py # State and cache management
|
|
196
|
+
โ โ โโโ connectors/
|
|
197
|
+
โ โ โโโ __init__.py
|
|
198
|
+
โ โ โโโ base.py # BaseConnector interface
|
|
199
|
+
โ โ โโโ linux.py
|
|
200
|
+
โ โ โโโ osx.py
|
|
201
|
+
โ โโโ cli/
|
|
202
|
+
โ โ โโโ __init__.py # PodmanCLI class
|
|
203
|
+
โ โ โโโ main.py # Main entry point
|
|
204
|
+
โ โ โโโ actions.py # High-level actions
|
|
205
|
+
โ โ โโโ mcp.py # MCP server integration
|
|
206
|
+
โ โ โโโ tasks.py # Low-level tasks
|
|
207
|
+
โ โโโ utils/
|
|
208
|
+
โ โ โโโ version.py # Version utilities
|
|
209
|
+
โ โโโ errors/
|
|
210
|
+
โ โโโ __init__.py # Custom exceptions
|
|
211
|
+
โโโ tests/
|
|
212
|
+
โ โโโ test_client.py
|
|
213
|
+
โ โโโ test_container_validator.py
|
|
214
|
+
โ โโโ ... (comprehensive test suite)
|
|
215
|
+
โโโ examples/
|
|
216
|
+
โ โโโ example_connector_usage.py
|
|
217
|
+
โโโ pyproject.toml # Packaging configuration
|
|
218
|
+
โโโ README.md
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## ๐ ๏ธ Development Status
|
|
222
|
+
|
|
223
|
+
**Current Status**: Alpha / In Development
|
|
224
|
+
|
|
225
|
+
### Known Limitations
|
|
226
|
+
|
|
227
|
+
- Limited error handling and recovery
|
|
228
|
+
|
|
229
|
+
### Roadmap
|
|
230
|
+
|
|
231
|
+
- [x] Complete command execution implementation
|
|
232
|
+
- [ ] Add comprehensive error handling
|
|
233
|
+
- [x] Implement CLI argument parsing
|
|
234
|
+
- [x] Implement MCP support
|
|
235
|
+
- [ ] Add logging framework
|
|
236
|
+
- [x] Create packaging configuration (pyproject.toml)
|
|
237
|
+
- [x] Expand test coverage
|
|
238
|
+
- [x] Add CI/CD pipeline
|
|
239
|
+
- [x] Platform-specific socket detection (macOS complete)
|
|
240
|
+
- [x] Add Linux connector
|
|
241
|
+
- [ ] Add Windows connector
|
|
242
|
+
|
|
243
|
+
## ๐ค Contributing
|
|
244
|
+
|
|
245
|
+
Contributions are welcome! Please feel free to submit issues or pull requests.
|
|
246
|
+
|
|
247
|
+
## ๐ License
|
|
248
|
+
|
|
249
|
+
[Add your license here]
|
|
250
|
+
|
|
251
|
+
## ๐ Support
|
|
252
|
+
|
|
253
|
+
For questions or issues, please open an issue on GitHub.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
**Note**: This project is under active development. APIs may change between versions.
|