viperx 0.9.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.
viperx-0.9.5/PKG-INFO ADDED
@@ -0,0 +1,236 @@
1
+ Metadata-Version: 2.3
2
+ Name: viperx
3
+ Version: 0.9.5
4
+ Summary: Professional Python Project Initializer with uv, ml/dl support, and embedded config.
5
+ Keywords: python,project-template,uv,data-science,machine-learning
6
+ Author: Ivann KAMDEM
7
+ Author-email: Ivann KAMDEM <kapoivha@gmail.com>
8
+ License: MIT
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Topic :: Software Development :: Build Tools
12
+ Requires-Dist: gitpython>=3.1.46
13
+ Requires-Dist: jinja2>=3.1.6
14
+ Requires-Dist: rich>=14.2.0
15
+ Requires-Dist: typer>=0.21.1
16
+ Requires-Dist: pyyaml>=6.0.1
17
+ Requires-Python: >=3.11
18
+ Description-Content-Type: text/markdown
19
+
20
+ # šŸ ViperX
21
+
22
+ > **Professional Python Project Initializer**
23
+ > *The modern, snake-fast way to bootstrap Python projects.*
24
+
25
+ **ViperX** is a CLI tool designed to generate production-ready Python projects instantly. It leverages **[uv](https://github.com/astral-sh/uv)** for blazing fast dependency management and offers specialized templates for **Machine Learning** (`ml`) and **Deep Learning** (`dl`).
26
+
27
+ ## ✨ Features
28
+
29
+ - **Blazing Fast**: Built on top of `uv`.
30
+ - **Pre-configured**: `pyproject.toml`, proper `src` layout, `ruff` ready.
31
+ - **ML/DL First**: Templates with `torch`, `tensorflow`, `kagglehub` and **Smart Caching**.
32
+ - **Smart Caching**: Auto-downloads and caches datasets to `~/.cache/viperx/data` (or local `data/`).
33
+ - **Strict Isolation**: Environment variables (`.env`) isolated in `src/<pkg>/` for better security.
34
+ - **Config-in-Package**: Solves the "Colab/Kaggle doesn't see my config" problem.
35
+ - **Platform Agnostic**: Works on Local, VSCode, Colab, and Kaggle.
36
+
37
+ ## šŸ“¦ Installation
38
+
39
+ **Recommended (Global Tool)**
40
+ ```bash
41
+ pipx install viperx
42
+ ```
43
+
44
+ **Alternative (uv)**
45
+ ```bash
46
+ uv tool install viperx
47
+ ```
48
+
49
+ ## šŸš€ Usage
50
+
51
+ ### `init`
52
+ Initialize a new project (Classic, ML, or DL).
53
+
54
+ ```bash
55
+ # Classic Lib (Standard Layout)
56
+ viperx init -n my-lib
57
+
58
+ # Machine Learning ( + Notebooks, Pandas, Scikit-learn, Smart Loader)
59
+ viperx init -n churn-pred -t ml
60
+
61
+ # Deep Learning ( + PyTorch/TensorFlow, CUDA checks)
62
+ viperx init -n deep-vision -t dl --framework pytorch
63
+ # Deep Learning ( + PyTorch/TensorFlow, CUDA checks)
64
+ viperx init -n deep-vision -t dl --framework pytorch
65
+
66
+ # ✨ Declarative Config (Infrastructure as Code)
67
+ viperx config init # Generate template
68
+ viperx init -c viperx.yaml # Apply config
69
+ ```
70
+
71
+ ### `package`
72
+ Manage workspace packages (Monorepo style).
73
+
74
+ ```bash
75
+ # Add a new package to the current workspace
76
+ viperx package add -n my-api -t classic
77
+
78
+ # Remove a package
79
+ viperx package delete -n my-api
80
+ ```
81
+
82
+ ## šŸš€ Quick Start
83
+
84
+ Initialize a new project with a single command:
85
+
86
+ ```bash
87
+ # Classic Package
88
+ viperx init -n my-lib -d "My awesome library"
89
+
90
+ # Deep Learning Project (PyTorch ready)
91
+ viperx init -n deep-vision -t dl --description "Vision Transformer implementation"
92
+
93
+ # Machine Learning Project (Scikit-learn ready)
94
+ viperx init -n churn-prediction -t ml
95
+ ```
96
+
97
+ ## 🧱 Structure
98
+
99
+ šŸ“‚ **Standard Layout**
100
+ ```text
101
+ my-lib/
102
+ ā”œā”€ā”€ pyproject.toml # Managed by uv
103
+ ā”œā”€ā”€ README.md
104
+ ā”œā”€ā”€ README.md
105
+ ā”œā”€ā”€ .gitignore
106
+ └── src/
107
+ └── my_lib/
108
+ ā”œā”€ā”€ __init__.py
109
+ ā”œā”€ā”€ main.py # Entry point
110
+ ā”œā”€ā”€ config.yaml # Data URLs & Params
111
+ ā”œā”€ā”€ config.py # Loader
112
+ ā”œā”€ā”€ .env # Secrets (Isolated)
113
+ └── utils/
114
+ └── data_loader.py # Generic URL/CSV Loader
115
+ ```
116
+
117
+ ### 🧠 Machine Learning & Deep Learning
118
+ For type `ml` or `dl`, you get:
119
+ - **Notebooks**:
120
+ - `Base_Kaggle.ipynb`: Loads data via `kagglehub`.
121
+ - `Base_General.ipynb`: Loads data via `data_loader.py` (URL/Local).
122
+ - **Data Loader**: `src/<pkg>/data_loader.py` handles caching downloads to `data/`.
123
+ - **Config**: Pre-filled with "Hello World" datasets (Iris, Titanic).
124
+
125
+ ### āš™ļø Configurationstalls dependencies (`torch`, `pandas`...).
126
+
127
+ ```text
128
+ deep-vision/
129
+ ā”œā”€ā”€ pyproject.toml
130
+ ā”œā”€ā”€ notebooks/
131
+ │ └── Base.ipynb # Pre-configured notebook (Colab/Kaggle ready)
132
+ └── src/
133
+ └── deep_vision/
134
+ ā”œā”€ā”€ ... # Same robust package structure
135
+ ```
136
+
137
+ ## šŸ’» CLI Usage
138
+
139
+ ### `init` - Create a new project
140
+
141
+ ```bash
142
+ viperx init [OPTIONS]
143
+ ```
144
+
145
+ **Options:**
146
+ - `-n, --name TEXT`: Project name **(Required)**.
147
+ - `-t, --type TEXT`: Project type (`classic`, `ml`, `dl`). Default: `classic`.
148
+ - `-d, --description TEXT`: Project description.
149
+ - `-a, --author TEXT`: Author name (defaults to git user).
150
+ - `-l, --license TEXT`: License type (`MIT`, `Apache-2.0`, `GPLv3`). Default: `MIT`.
151
+ - `-f, --framework TEXT`: DL Framework (`pytorch`, `tensorflow`). Default: `pytorch` (only for `-t dl`).
152
+ - `-v, --verbose`: Enable verbose logging for transparent output.
153
+
154
+ **Examples:**
155
+
156
+ ```bash
157
+ # Classic Library
158
+ viperx init -n my-lib
159
+
160
+ # Deep Learning (PyTorch Default)
161
+ viperx init -n vision-ai -t dl
162
+
163
+ # Deep Learning (TensorFlow)
164
+ viperx init -n tf-legacy -t dl -f tensorflow
165
+ # Deep Learning (TensorFlow)
166
+ viperx init -n tf-legacy -t dl -f tensorflow
167
+
168
+ # From Config File
169
+ viperx init -c viperx.yaml
170
+ ```
171
+
172
+ ### `config` - Declarative Mode
173
+
174
+ Manage your project infrastructure using a YAML file.
175
+
176
+ ```bash
177
+ viperx config init
178
+ ```
179
+ Generates a `viperx.yaml` template in the current directory.
180
+
181
+ ```bash
182
+ viperx init --config viperx.yaml
183
+ ```
184
+ Applies the configuration. This is **idempotent**:
185
+ - Creates the project if it doesn't exist.
186
+ - **Hydrates** the directory if it exists but is empty (e.g., git init).
187
+ - **Updates** the workspace if the project exists (adds missing packages defined in YAML).
188
+
189
+ ### `package` - Manage Workspace
190
+
191
+ Manage packages in your workspace hierarchy (add, update, delete).
192
+
193
+ #### `add`
194
+ Add a new package to your project. Upgrades standalone projects to workspaces automatically.
195
+ ```bash
196
+ ```bash
197
+ viperx package add -n worker-node -t classic --no-readme
198
+ ```
199
+ **Options:**
200
+ - `--readme / --no-readme`: Generate a local `README.md` for the package. Default: `True`.
201
+ - `--env / --no-env`: Generate isolated `.env` and `.env.example` in `src/<pkg>/`.
202
+
203
+ #### `delete`
204
+ Remove a package from the workspace (deletes folder & updates `pyproject.toml`).
205
+ ```bash
206
+ viperx package delete -n worker-node
207
+ ```
208
+
209
+ #### `update`
210
+ Update a package's dependencies (runs `uv lock --upgrade`).
211
+ ```bash
212
+ viperx package update -n worker-node
213
+ ```
214
+
215
+ ---## šŸ“¦ "Magical" Configuration
216
+
217
+ Every project comes with a robust `config.py` using `importlib.resources`.
218
+
219
+ **In your code / notebooks:**
220
+ ```python
221
+ from my_package import SETTINGS, get_dataset_path
222
+
223
+ # Works everywhere: Local, Installed, Colab, Kaggle
224
+ print(SETTINGS['project_name'])
225
+ ```
226
+
227
+ ## šŸ¤ Contributing
228
+
229
+ This project is built 100% with `uv`.
230
+
231
+ 1. Clone the repo
232
+ 2. Sync dependencies: `uv sync`
233
+ 3. Run the CLI: `uv run viperx`
234
+
235
+ ---
236
+ *Built with ā¤ļø by KpihX*
viperx-0.9.5/README.md ADDED
@@ -0,0 +1,217 @@
1
+ # šŸ ViperX
2
+
3
+ > **Professional Python Project Initializer**
4
+ > *The modern, snake-fast way to bootstrap Python projects.*
5
+
6
+ **ViperX** is a CLI tool designed to generate production-ready Python projects instantly. It leverages **[uv](https://github.com/astral-sh/uv)** for blazing fast dependency management and offers specialized templates for **Machine Learning** (`ml`) and **Deep Learning** (`dl`).
7
+
8
+ ## ✨ Features
9
+
10
+ - **Blazing Fast**: Built on top of `uv`.
11
+ - **Pre-configured**: `pyproject.toml`, proper `src` layout, `ruff` ready.
12
+ - **ML/DL First**: Templates with `torch`, `tensorflow`, `kagglehub` and **Smart Caching**.
13
+ - **Smart Caching**: Auto-downloads and caches datasets to `~/.cache/viperx/data` (or local `data/`).
14
+ - **Strict Isolation**: Environment variables (`.env`) isolated in `src/<pkg>/` for better security.
15
+ - **Config-in-Package**: Solves the "Colab/Kaggle doesn't see my config" problem.
16
+ - **Platform Agnostic**: Works on Local, VSCode, Colab, and Kaggle.
17
+
18
+ ## šŸ“¦ Installation
19
+
20
+ **Recommended (Global Tool)**
21
+ ```bash
22
+ pipx install viperx
23
+ ```
24
+
25
+ **Alternative (uv)**
26
+ ```bash
27
+ uv tool install viperx
28
+ ```
29
+
30
+ ## šŸš€ Usage
31
+
32
+ ### `init`
33
+ Initialize a new project (Classic, ML, or DL).
34
+
35
+ ```bash
36
+ # Classic Lib (Standard Layout)
37
+ viperx init -n my-lib
38
+
39
+ # Machine Learning ( + Notebooks, Pandas, Scikit-learn, Smart Loader)
40
+ viperx init -n churn-pred -t ml
41
+
42
+ # Deep Learning ( + PyTorch/TensorFlow, CUDA checks)
43
+ viperx init -n deep-vision -t dl --framework pytorch
44
+ # Deep Learning ( + PyTorch/TensorFlow, CUDA checks)
45
+ viperx init -n deep-vision -t dl --framework pytorch
46
+
47
+ # ✨ Declarative Config (Infrastructure as Code)
48
+ viperx config init # Generate template
49
+ viperx init -c viperx.yaml # Apply config
50
+ ```
51
+
52
+ ### `package`
53
+ Manage workspace packages (Monorepo style).
54
+
55
+ ```bash
56
+ # Add a new package to the current workspace
57
+ viperx package add -n my-api -t classic
58
+
59
+ # Remove a package
60
+ viperx package delete -n my-api
61
+ ```
62
+
63
+ ## šŸš€ Quick Start
64
+
65
+ Initialize a new project with a single command:
66
+
67
+ ```bash
68
+ # Classic Package
69
+ viperx init -n my-lib -d "My awesome library"
70
+
71
+ # Deep Learning Project (PyTorch ready)
72
+ viperx init -n deep-vision -t dl --description "Vision Transformer implementation"
73
+
74
+ # Machine Learning Project (Scikit-learn ready)
75
+ viperx init -n churn-prediction -t ml
76
+ ```
77
+
78
+ ## 🧱 Structure
79
+
80
+ šŸ“‚ **Standard Layout**
81
+ ```text
82
+ my-lib/
83
+ ā”œā”€ā”€ pyproject.toml # Managed by uv
84
+ ā”œā”€ā”€ README.md
85
+ ā”œā”€ā”€ README.md
86
+ ā”œā”€ā”€ .gitignore
87
+ └── src/
88
+ └── my_lib/
89
+ ā”œā”€ā”€ __init__.py
90
+ ā”œā”€ā”€ main.py # Entry point
91
+ ā”œā”€ā”€ config.yaml # Data URLs & Params
92
+ ā”œā”€ā”€ config.py # Loader
93
+ ā”œā”€ā”€ .env # Secrets (Isolated)
94
+ └── utils/
95
+ └── data_loader.py # Generic URL/CSV Loader
96
+ ```
97
+
98
+ ### 🧠 Machine Learning & Deep Learning
99
+ For type `ml` or `dl`, you get:
100
+ - **Notebooks**:
101
+ - `Base_Kaggle.ipynb`: Loads data via `kagglehub`.
102
+ - `Base_General.ipynb`: Loads data via `data_loader.py` (URL/Local).
103
+ - **Data Loader**: `src/<pkg>/data_loader.py` handles caching downloads to `data/`.
104
+ - **Config**: Pre-filled with "Hello World" datasets (Iris, Titanic).
105
+
106
+ ### āš™ļø Configurationstalls dependencies (`torch`, `pandas`...).
107
+
108
+ ```text
109
+ deep-vision/
110
+ ā”œā”€ā”€ pyproject.toml
111
+ ā”œā”€ā”€ notebooks/
112
+ │ └── Base.ipynb # Pre-configured notebook (Colab/Kaggle ready)
113
+ └── src/
114
+ └── deep_vision/
115
+ ā”œā”€ā”€ ... # Same robust package structure
116
+ ```
117
+
118
+ ## šŸ’» CLI Usage
119
+
120
+ ### `init` - Create a new project
121
+
122
+ ```bash
123
+ viperx init [OPTIONS]
124
+ ```
125
+
126
+ **Options:**
127
+ - `-n, --name TEXT`: Project name **(Required)**.
128
+ - `-t, --type TEXT`: Project type (`classic`, `ml`, `dl`). Default: `classic`.
129
+ - `-d, --description TEXT`: Project description.
130
+ - `-a, --author TEXT`: Author name (defaults to git user).
131
+ - `-l, --license TEXT`: License type (`MIT`, `Apache-2.0`, `GPLv3`). Default: `MIT`.
132
+ - `-f, --framework TEXT`: DL Framework (`pytorch`, `tensorflow`). Default: `pytorch` (only for `-t dl`).
133
+ - `-v, --verbose`: Enable verbose logging for transparent output.
134
+
135
+ **Examples:**
136
+
137
+ ```bash
138
+ # Classic Library
139
+ viperx init -n my-lib
140
+
141
+ # Deep Learning (PyTorch Default)
142
+ viperx init -n vision-ai -t dl
143
+
144
+ # Deep Learning (TensorFlow)
145
+ viperx init -n tf-legacy -t dl -f tensorflow
146
+ # Deep Learning (TensorFlow)
147
+ viperx init -n tf-legacy -t dl -f tensorflow
148
+
149
+ # From Config File
150
+ viperx init -c viperx.yaml
151
+ ```
152
+
153
+ ### `config` - Declarative Mode
154
+
155
+ Manage your project infrastructure using a YAML file.
156
+
157
+ ```bash
158
+ viperx config init
159
+ ```
160
+ Generates a `viperx.yaml` template in the current directory.
161
+
162
+ ```bash
163
+ viperx init --config viperx.yaml
164
+ ```
165
+ Applies the configuration. This is **idempotent**:
166
+ - Creates the project if it doesn't exist.
167
+ - **Hydrates** the directory if it exists but is empty (e.g., git init).
168
+ - **Updates** the workspace if the project exists (adds missing packages defined in YAML).
169
+
170
+ ### `package` - Manage Workspace
171
+
172
+ Manage packages in your workspace hierarchy (add, update, delete).
173
+
174
+ #### `add`
175
+ Add a new package to your project. Upgrades standalone projects to workspaces automatically.
176
+ ```bash
177
+ ```bash
178
+ viperx package add -n worker-node -t classic --no-readme
179
+ ```
180
+ **Options:**
181
+ - `--readme / --no-readme`: Generate a local `README.md` for the package. Default: `True`.
182
+ - `--env / --no-env`: Generate isolated `.env` and `.env.example` in `src/<pkg>/`.
183
+
184
+ #### `delete`
185
+ Remove a package from the workspace (deletes folder & updates `pyproject.toml`).
186
+ ```bash
187
+ viperx package delete -n worker-node
188
+ ```
189
+
190
+ #### `update`
191
+ Update a package's dependencies (runs `uv lock --upgrade`).
192
+ ```bash
193
+ viperx package update -n worker-node
194
+ ```
195
+
196
+ ---## šŸ“¦ "Magical" Configuration
197
+
198
+ Every project comes with a robust `config.py` using `importlib.resources`.
199
+
200
+ **In your code / notebooks:**
201
+ ```python
202
+ from my_package import SETTINGS, get_dataset_path
203
+
204
+ # Works everywhere: Local, Installed, Colab, Kaggle
205
+ print(SETTINGS['project_name'])
206
+ ```
207
+
208
+ ## šŸ¤ Contributing
209
+
210
+ This project is built 100% with `uv`.
211
+
212
+ 1. Clone the repo
213
+ 2. Sync dependencies: `uv sync`
214
+ 3. Run the CLI: `uv run viperx`
215
+
216
+ ---
217
+ *Built with ā¤ļø by KpihX*
@@ -0,0 +1,31 @@
1
+ [project]
2
+ name = "viperx"
3
+ version = "0.9.5"
4
+ description = "Professional Python Project Initializer with uv, ml/dl support, and embedded config."
5
+ readme = "README.md"
6
+ authors = [
7
+ { name = "Ivann KAMDEM", email = "kapoivha@gmail.com" }
8
+ ]
9
+ license = { text = "MIT" }
10
+ keywords = ["python", "project-template", "uv", "data-science", "machine-learning"]
11
+ classifiers = [
12
+ "Development Status :: 4 - Beta",
13
+ "Intended Audience :: Developers",
14
+ "Topic :: Software Development :: Build Tools",
15
+ ]
16
+ requires-python = ">=3.11"
17
+ dependencies = [
18
+ "gitpython>=3.1.46",
19
+ "jinja2>=3.1.6",
20
+ "rich>=14.2.0",
21
+ "typer>=0.21.1",
22
+ "pyyaml>=6.0.1",
23
+ ]
24
+
25
+ [project.scripts]
26
+ viperx = "viperx.main:app"
27
+
28
+ [build-system]
29
+ requires = ["uv_build>=0.9.21,<0.10.0"]
30
+ build-backend = "uv_build"
31
+
@@ -0,0 +1,2 @@
1
+ def main() -> None:
2
+ print("Hello from propy!")
@@ -0,0 +1,141 @@
1
+ import yaml
2
+ from pathlib import Path
3
+ from rich.console import Console
4
+ from rich.panel import Panel
5
+
6
+ from viperx.core import ProjectGenerator
7
+ from viperx.constants import DEFAULT_LICENSE, DEFAULT_BUILDER, TYPE_CLASSIC, FRAMEWORK_PYTORCH
8
+
9
+ console = Console()
10
+
11
+ class ConfigEngine:
12
+ """
13
+ Orchestrates project creation and updates based on a declarative YAML config.
14
+ Implements the 'Infrastructure as Code' pattern for ViperX.
15
+ """
16
+
17
+ def __init__(self, config_path: Path, verbose: bool = False):
18
+ self.config_path = config_path
19
+ self.verbose = verbose
20
+ self.config = self._load_config()
21
+ self.root_path = Path.cwd()
22
+
23
+ def _load_config(self) -> dict:
24
+ """Load and validate the YAML configuration."""
25
+ if not self.config_path.exists():
26
+ console.print(f"[bold red]Error:[/bold red] Config file not found at {self.config_path}")
27
+ raise FileNotFoundError(f"Config file not found: {self.config_path}")
28
+
29
+ with open(self.config_path, "r") as f:
30
+ try:
31
+ data = yaml.safe_load(f)
32
+ except yaml.YAMLError as e:
33
+ console.print(f"[bold red]Error:[/bold red] Invalid YAML format: {e}")
34
+ raise ValueError("Invalid YAML")
35
+
36
+ # Basic Validation
37
+ if "project" not in data or "name" not in data["project"]:
38
+ console.print("[bold red]Error:[/bold red] Config must contain 'project.name'")
39
+ raise ValueError("Missing project.name")
40
+
41
+ return data
42
+
43
+ def apply(self):
44
+ """Apply the configuration to the current directory."""
45
+ project_conf = self.config.get("project", {})
46
+ settings_conf = self.config.get("settings", {})
47
+ workspace_conf = self.config.get("workspace", {})
48
+
49
+ project_name = project_conf.get("name")
50
+ target_dir = self.root_path / project_name
51
+
52
+ # 1. Root Project Handling
53
+ # If we are NOT already in the project dir (checking name), we might need to create it
54
+ # Or if we are running in the root of where `viperx init` is called.
55
+
56
+ # Heuristic: Are we already in a folder named 'project_name'?
57
+ if self.root_path.name == project_name:
58
+ # We are inside the project folder
59
+ if not (self.root_path / "pyproject.toml").exists():
60
+ console.print(Panel(f"āš ļø [bold yellow]Current directory matches name but is not initialized. Hydrating:[/bold yellow] {project_name}", border_style="yellow"))
61
+ gen = ProjectGenerator(
62
+ name=project_name,
63
+ description=project_conf.get("description", ""),
64
+ type=settings_conf.get("type", TYPE_CLASSIC),
65
+ author=project_conf.get("author", None),
66
+ license=project_conf.get("license", DEFAULT_LICENSE),
67
+ builder=project_conf.get("builder", DEFAULT_BUILDER),
68
+ use_env=settings_conf.get("use_env", False),
69
+ use_config=settings_conf.get("use_config", True),
70
+ use_tests=settings_conf.get("use_tests", True),
71
+ framework=settings_conf.get("framework", FRAMEWORK_PYTORCH),
72
+ verbose=self.verbose
73
+ )
74
+ # generate() expects parent dir, and will operate on parent/name (which is self.root_path)
75
+ gen.generate(self.root_path.parent)
76
+ else:
77
+ console.print(Panel(f"ā™»ļø [bold blue]Syncing Project:[/bold blue] {project_name}", border_style="blue"))
78
+ current_root = self.root_path
79
+ else:
80
+ # We are outside, check if it exists
81
+ if target_dir.exists() and (target_dir / "pyproject.toml").exists():
82
+ console.print(Panel(f"ā™»ļø [bold blue]Updating Existing Project:[/bold blue] {project_name}", border_style="blue"))
83
+ current_root = target_dir
84
+ else:
85
+ if target_dir.exists():
86
+ console.print(Panel(f"āš ļø [bold yellow]Directory exists but not initialized. Hydrating:[/bold yellow] {project_name}", border_style="yellow"))
87
+ else:
88
+ console.print(Panel(f"šŸš€ [bold green]Creating New Project:[/bold green] {project_name}", border_style="green"))
89
+
90
+ # Create Root (or Hydrate)
91
+ gen = ProjectGenerator(
92
+ name=project_name,
93
+ description=project_conf.get("description", ""),
94
+ type=settings_conf.get("type", TYPE_CLASSIC),
95
+ author=project_conf.get("author", None),
96
+ license=project_conf.get("license", DEFAULT_LICENSE),
97
+ builder=project_conf.get("builder", DEFAULT_BUILDER),
98
+ use_env=settings_conf.get("use_env", False),
99
+ use_config=settings_conf.get("use_config", True),
100
+ use_tests=settings_conf.get("use_tests", True),
101
+ framework=settings_conf.get("framework", FRAMEWORK_PYTORCH),
102
+ verbose=self.verbose
103
+ )
104
+ gen.generate(self.root_path)
105
+ current_root = target_dir
106
+
107
+ # 2. Copy Config to Root (Source of Truth)
108
+ # Only if we aren't reading the one already there
109
+ system_config_path = current_root / "viperx.yaml"
110
+ if self.config_path.absolute() != system_config_path.absolute():
111
+ import shutil
112
+ shutil.copy2(self.config_path, system_config_path)
113
+ console.print(f"[dim]Saved configuration to {system_config_path.name}[/dim]")
114
+
115
+ # 3. Handle Workspace Packages
116
+ packages = workspace_conf.get("packages", [])
117
+ if packages:
118
+ console.print(f"\nšŸ“¦ [bold]Processing {len(packages)} workspace packages...[/bold]")
119
+
120
+ for pkg in packages:
121
+ pkg_name = pkg.get("name")
122
+ pkg_path = current_root / "src" / pkg_name.replace("-", "_") # Approximate check
123
+
124
+ # We instantiate a generator for this package
125
+ pkg_gen = ProjectGenerator(
126
+ name=pkg_name,
127
+ description=pkg.get("description", ""),
128
+ type=pkg.get("type", TYPE_CLASSIC),
129
+ author=project_conf.get("author", "Your Name"), # Inherit author
130
+ use_env=pkg.get("use_env", settings_conf.get("use_env", False)), # Inherit settings or default False
131
+ use_config=pkg.get("use_config", settings_conf.get("use_config", True)), # Inherit or default True
132
+ use_readme=pkg.get("use_readme", True),
133
+ use_tests=pkg.get("use_tests", settings_conf.get("use_tests", True)),
134
+ framework=pkg.get("framework", FRAMEWORK_PYTORCH),
135
+ verbose=self.verbose
136
+ )
137
+
138
+ # Check if package seems to exist (ProjectGenerator handles upgrade logic too)
139
+ pkg_gen.add_to_workspace(current_root)
140
+
141
+ console.print(Panel(f"✨ [bold green]Configuration Applied Successfully![/bold green]\nProject is up to date with {self.config_path.name}", border_style="green"))
@@ -0,0 +1,35 @@
1
+ from pathlib import Path
2
+
3
+ # Project Defaults
4
+ DEFAULT_VERSION = "0.1.0"
5
+ DEFAULT_PYTHON_VERSION = "3.11"
6
+ DEFAULT_LICENSE = "MIT"
7
+ DEFAULT_BUILDER = "uv"
8
+
9
+ # File Names
10
+ CONFIG_FILENAME = "config.yaml"
11
+ PYPROJECT_FILENAME = "pyproject.toml"
12
+ PACKAGE_NAME = "viperx"
13
+ README_FILENAME = "README.md"
14
+ INIT_FILENAME = "__init__.py"
15
+ MAIN_FILENAME = "main.py"
16
+
17
+ # Directory Names
18
+ SRC_DIR = "src"
19
+ NOTEBOOKS_DIR = "notebooks"
20
+ TESTS_DIR = "tests"
21
+
22
+ # Templates
23
+ TEMPLATE_DIR_NAME = "templates"
24
+ TEMPLATES_DIR = Path(__file__).parent / TEMPLATE_DIR_NAME
25
+
26
+ # Types
27
+ TYPE_CLASSIC = "classic"
28
+ TYPE_ML = "ml"
29
+ TYPE_DL = "dl"
30
+ PROJECT_TYPES = [TYPE_CLASSIC, TYPE_ML, TYPE_DL]
31
+
32
+ # DL Frameworks
33
+ FRAMEWORK_PYTORCH = "pytorch"
34
+ FRAMEWORK_TENSORFLOW = "tensorflow"
35
+ DL_FRAMEWORKS = [FRAMEWORK_PYTORCH, FRAMEWORK_TENSORFLOW]