viperx 0.9.14__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.
viperx/utils.py ADDED
@@ -0,0 +1,47 @@
1
+ import re
2
+ import shutil
3
+ import subprocess
4
+ from rich.console import Console
5
+
6
+ console = Console()
7
+
8
+ def check_uv_installed() -> bool:
9
+ """Check if 'uv' is installed and accessible."""
10
+ return shutil.which("uv") is not None
11
+
12
+ def sanitize_project_name(name: str) -> str:
13
+ """
14
+ Sanitize the project name to be a valid Python package name.
15
+ Replaces hyphens with underscores and removes invalid characters.
16
+ """
17
+ # Replace - with _
18
+ name = name.replace("-", "_")
19
+ # Remove any characters that aren't alphanumerics or underscores
20
+ name = re.sub(r"[^a-zA-Z0-9_]", "", name)
21
+ # Ensure it starts with a letter or underscore
22
+ if not re.match(r"^[a-zA-Z_]", name):
23
+ name = f"_{name}"
24
+ return name.lower()
25
+
26
+ def validate_project_name(ctx, param, value):
27
+ """
28
+ Typer callback to validate project name.
29
+ """
30
+ if not re.match(r"^[a-zA-Z0-9_-]+$", value):
31
+ from typer import BadParameter
32
+ raise BadParameter("Project name must contain only letters, numbers, underscores, and hyphens.")
33
+ return value
34
+
35
+ def get_author_from_git() -> tuple[str, str]:
36
+ """
37
+ Attempt to get author name and email from git config.
38
+ Returns (name, email) or defaults.
39
+ """
40
+ try:
41
+ import git
42
+ config = git.GitConfigParser(git.GitConfigParser.get_global_config(), read_only=True)
43
+ name = config.get("user", "name", fallback="Your Name")
44
+ email = config.get("user", "email", fallback="your.email@example.com")
45
+ return name, email
46
+ except Exception:
47
+ return "Your Name", "your.email@example.com"
@@ -0,0 +1,236 @@
1
+ Metadata-Version: 2.3
2
+ Name: viperx
3
+ Version: 0.9.14
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 get # 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 get
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*
@@ -0,0 +1,22 @@
1
+ viperx/__init__.py,sha256=mRrD-SK9PtwBhqgLzJrvefdViNsXCyBGknzFNsIou1I,51
2
+ viperx/config_engine.py,sha256=Fzb5F3rE7BqcnpAdu6QhN28tfQNTuBHI04YuR1B7cHM,7340
3
+ viperx/constants.py,sha256=BMogG1-ik67YeheQdCgjsdS5FNFYiLfdro6utCWwczY,784
4
+ viperx/core.py,sha256=dOLLPxBohYN6A5i1BnT5gx35x6x5n40yYYGm6yEZKHM,18733
5
+ viperx/licenses.py,sha256=TPsG1aqNAjtOsvuD6i3SiC5rUK9f3DslPHQkKiV7vxs,12482
6
+ viperx/main.py,sha256=B8Z6bjESFKFvL80NJcfPGgYycxQP3NwLhKtJDtaj1Zc,9856
7
+ viperx/templates/Base.ipynb.j2,sha256=rlGCw7jIds3RiXFrG8D8oAjzXzzj1cayKjBI91k-1kA,3140
8
+ viperx/templates/Base_General.ipynb.j2,sha256=f5ZUu65khtvBeCofs3Lvzccn5Krl0nRGu0dv7SzLvzg,2716
9
+ viperx/templates/Base_Kaggle.ipynb.j2,sha256=gPkmFt4cA5UzhRU_gLZ1UzSjEa7Mgel001Eqiw94-fc,2698
10
+ viperx/templates/README.md.j2,sha256=TJNUwTcKnjALrP0MOSs8UBx8zNhI8erRHrc2-8nuMgQ,3445
11
+ viperx/templates/__init__.py.j2,sha256=uq8IYd0SGYX2-cpGb9q5197eYs-ode-g5y2NCGWU5YM,196
12
+ viperx/templates/config.py.j2,sha256=sU6bwiA0eW7g0d9Y_rhxSd-6LcMUyYiZKBhcF_OJcxM,1409
13
+ viperx/templates/config.yaml.j2,sha256=IYvjQUioZ9lyzVHVDgwrdjgM6s4pUnCFXwtnydoKe2k,485
14
+ viperx/templates/data_loader.py.j2,sha256=hehewwvBAYJM-acKn6_T4cU5EvUPX7wHAurAQ3z3ET4,3696
15
+ viperx/templates/main.py.j2,sha256=caGN54Hck_EcwT3Aqju52CBuGujSnzU2Hehw8mowzjI,277
16
+ viperx/templates/pyproject.toml.j2,sha256=RnJm7BinT-p646BiC2gxOTBuIX0nmRM7BUqt0n981io,1434
17
+ viperx/templates/viperx_config.yaml.j2,sha256=dZ5GtiGRWT_FOsMeF1YUjqL5wHO0y0i38gqU-lwrVSQ,1379
18
+ viperx/utils.py,sha256=2kiQLDHsPcCELEKeQYbIkSL8e3HhW4pRzw1pUth6hYA,1583
19
+ viperx-0.9.14.dist-info/WHEEL,sha256=RRVLqVugUmFOqBedBFAmA4bsgFcROUBiSUKlERi0Hcg,79
20
+ viperx-0.9.14.dist-info/entry_points.txt,sha256=Is38BrTuf6unQCLgDE990Rjd9HyGldBSw4Uzy_nMePY,44
21
+ viperx-0.9.14.dist-info/METADATA,sha256=OC8UDqEikK2-pU1RKt02YGRbKtsLvg0p-7OFGzvzXKA,6782
22
+ viperx-0.9.14.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.9.21
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ viperx = viperx.main:app
3
+