python-lab-toolkit 1.0.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.
Files changed (86) hide show
  1. pylab/__init__.py +43 -0
  2. pylab/cli.py +282 -0
  3. pylab/data/Data.csv +11 -0
  4. pylab/data/alphabet_stock_data.csv +143 -0
  5. pylab/data/breast-cancer.csv +351 -0
  6. pylab/data/dirtydata.csv +33 -0
  7. pylab/data/groceries.csv +359 -0
  8. pylab/data/iris.csv +151 -0
  9. pylab/data/rainfall.csv +151 -0
  10. pylab/data/students.csv +7 -0
  11. pylab/data/winequality-red.csv +1601 -0
  12. pylab/data/winequality-white.csv +2401 -0
  13. pylab/datasets.py +277 -0
  14. pylab/environment.py +136 -0
  15. pylab/errors.py +53 -0
  16. pylab/generator.py +216 -0
  17. pylab/registry.py +562 -0
  18. pylab/templates/q1/variable_validator.py +43 -0
  19. pylab/templates/q10/password_strength.py +42 -0
  20. pylab/templates/q11/recursion_math.py +28 -0
  21. pylab/templates/q12/main_analyzer.py +46 -0
  22. pylab/templates/q12/text_analyzer.py +16 -0
  23. pylab/templates/q12/text_preprocessor.py +15 -0
  24. pylab/templates/q13/student.py +26 -0
  25. pylab/templates/q14/circle.py +26 -0
  26. pylab/templates/q15/employee_salary.py +46 -0
  27. pylab/templates/q16/smart_calculator.py +51 -0
  28. pylab/templates/q17/complex_number.py +43 -0
  29. pylab/templates/q18/vehicle_inheritance.py +43 -0
  30. pylab/templates/q19/file_word_counter.py +48 -0
  31. pylab/templates/q19/sample.txt +6 -0
  32. pylab/templates/q2/single_number.py +26 -0
  33. pylab/templates/q20/age_validator.py +27 -0
  34. pylab/templates/q21/transaction_manager.py +45 -0
  35. pylab/templates/q22/date_formatter.py +30 -0
  36. pylab/templates/q23/rainfall_analyzer.py +73 -0
  37. pylab/templates/q24/student_marks.py +58 -0
  38. pylab/templates/q25/library_manager.py +182 -0
  39. pylab/templates/q26/mysql_employee_manager.py +239 -0
  40. pylab/templates/q27/crud_client.py +98 -0
  41. pylab/templates/q27/mock_server.py +85 -0
  42. pylab/templates/q28/index.html +33 -0
  43. pylab/templates/q28/login_handler.py +31 -0
  44. pylab/templates/q28/server.py +44 -0
  45. pylab/templates/q29/index.html +50 -0
  46. pylab/templates/q29/register_handler.py +42 -0
  47. pylab/templates/q29/server.py +42 -0
  48. pylab/templates/q3/string_operations.py +32 -0
  49. pylab/templates/q30/crud_handler.py +60 -0
  50. pylab/templates/q30/database.py +66 -0
  51. pylab/templates/q30/index.html +59 -0
  52. pylab/templates/q30/server.py +51 -0
  53. pylab/templates/q31/numpy_matrix.py +40 -0
  54. pylab/templates/q32/numpy_slicing.py +43 -0
  55. pylab/templates/q33/pandas_students.py +41 -0
  56. pylab/templates/q34/pandas_salary.py +37 -0
  57. pylab/templates/q35/sales_barchart.py +58 -0
  58. pylab/templates/q36/weather_plot.py +50 -0
  59. pylab/templates/q37/age_categorization.py +38 -0
  60. pylab/templates/q38/concat_rows.py +38 -0
  61. pylab/templates/q39/concat_cols.py +38 -0
  62. pylab/templates/q4/menu_string_processor.py +68 -0
  63. pylab/templates/q40/concat_merge.py +44 -0
  64. pylab/templates/q41/pandas_joins.py +46 -0
  65. pylab/templates/q42/groupby_school.py +32 -0
  66. pylab/templates/q43/groupby_multi.py +29 -0
  67. pylab/templates/q44/alphabet_stock_viz.py +95 -0
  68. pylab/templates/q45/multi_plot.py +65 -0
  69. pylab/templates/q46/dataframe_barchart.py +60 -0
  70. pylab/templates/q47/preprocess_data.py +54 -0
  71. pylab/templates/q48/clean_dirtydata.py +62 -0
  72. pylab/templates/q49/wine_regression.py +169 -0
  73. pylab/templates/q5/phonebook.py +105 -0
  74. pylab/templates/q50/breast_cancer_classifier.py +147 -0
  75. pylab/templates/q51/iris_clustering.py +95 -0
  76. pylab/templates/q52/apriori_groceries.py +88 -0
  77. pylab/templates/q6/calculator.py +67 -0
  78. pylab/templates/q7/session_attendees.py +37 -0
  79. pylab/templates/q8/number_properties.py +68 -0
  80. pylab/templates/q9/greet_people.py +26 -0
  81. python_lab_toolkit-1.0.0.dist-info/LICENSE +21 -0
  82. python_lab_toolkit-1.0.0.dist-info/METADATA +427 -0
  83. python_lab_toolkit-1.0.0.dist-info/RECORD +86 -0
  84. python_lab_toolkit-1.0.0.dist-info/WHEEL +5 -0
  85. python_lab_toolkit-1.0.0.dist-info/entry_points.txt +2 -0
  86. python_lab_toolkit-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,427 @@
1
+ Metadata-Version: 2.1
2
+ Name: python-lab-toolkit
3
+ Version: 1.0.0
4
+ Summary: A beginner-friendly CLI and toolkit to generate 52 complete Python lab solutions with automated dataset management.
5
+ Author-email: Python Lab Toolkit Developers <dev@pylabtoolkit.org>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/pylabtoolkit/python-lab-toolkit
8
+ Project-URL: Documentation, https://github.com/pylabtoolkit/python-lab-toolkit#readme
9
+ Project-URL: Repository, https://github.com/pylabtoolkit/python-lab-toolkit.git
10
+ Project-URL: Issues, https://github.com/pylabtoolkit/python-lab-toolkit/issues
11
+ Keywords: education,python-lab,code-generator,data-science,cli
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Education
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Operating System :: OS Independent
22
+ Classifier: Topic :: Education
23
+ Classifier: Topic :: Software Development :: Code Generators
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
29
+ Provides-Extra: labs
30
+ Requires-Dist: requests>=2.25.0; extra == "labs"
31
+ Requires-Dist: numpy>=1.20.0; extra == "labs"
32
+ Requires-Dist: pandas>=1.3.0; extra == "labs"
33
+ Requires-Dist: matplotlib>=3.4.0; extra == "labs"
34
+ Requires-Dist: seaborn>=0.11.0; extra == "labs"
35
+ Requires-Dist: scikit-learn>=1.0.0; extra == "labs"
36
+ Requires-Dist: mlxtend>=0.19.0; extra == "labs"
37
+ Requires-Dist: mysql-connector-python>=8.0.0; extra == "labs"
38
+ Provides-Extra: requests
39
+ Requires-Dist: requests>=2.25.0; extra == "requests"
40
+
41
+ # Python Lab Toolkit (`python-lab-toolkit`)
42
+
43
+ [![PyPI Version](https://img.shields.io/badge/pypi-v1.0.0-blue.svg)](https://pypi.org/project/python-lab-toolkit/)
44
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue.svg)](https://www.python.org/)
45
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
46
+ [![Zero Comments in Generated Code](https://img.shields.io/badge/clean%20code-zero%20comments-brightgreen.svg)]()
47
+ [![Offline Ready](https://img.shields.io/badge/offline-bundled%20datasets-success.svg)]()
48
+
49
+ A beginner-friendly, production-quality Python package and CLI named `pylab` designed to generate complete, working, runnable solutions for all **52 Python laboratory questions** with automatic dataset downloading and verified offline support.
50
+
51
+ ---
52
+
53
+ ## Table of Contents
54
+ 1. [Key Features](#key-features)
55
+ 2. [Installation](#installation)
56
+ 3. [Quick Start](#quick-start)
57
+ 4. [Complete Command Reference](#complete-command-reference)
58
+ 5. [The 52 Lab Questions Catalog](#the-52-lab-questions-catalog)
59
+ 6. [Automated Dataset Management](#automated-dataset-management)
60
+ 7. [Offline Installation & Laboratory Bundle](#offline-installation--laboratory-bundle)
61
+ 8. [Database Configuration (SQLite & MySQL)](#database-configuration-sqlite--mysql)
62
+ 9. [CGI Web Handlers and Local Test Servers](#cgi-web-handlers-and-local-test-servers)
63
+ 10. [Troubleshooting & FAQ](#troubleshooting--faq)
64
+ 11. [Development & Automated Testing](#development--automated-testing)
65
+ 12. [PyPI Publication Guide](#pypi-publication-guide)
66
+ 13. [License & Dataset Attribution](#license--dataset-attribution)
67
+
68
+ ---
69
+
70
+ ## 1. Key Features
71
+
72
+ - **Short, Intuitive Commands**: Generate any project with simple commands like `pylab q1`, `pylab q12`, `pylab q49`.
73
+ - **Zero Comments in Generated Code**: In accordance with clean code standards, generated Python source code contains **no explanatory inline comments, decorative comments, or header comments**, remaining self-explanatory through readable structure and expressive naming.
74
+ - **Real, Runnable Python Files**: Generates real files on disk (not hidden functions or stubs) that students and instructors can inspect, run, and modify.
75
+ - **Automated Dataset Handling**: Automatically downloads datasets when missing or instantly extracts verified bundled datasets when offline.
76
+ - **100% Offline Capable**: Small verified copies of all required datasets (`winequality-red.csv`, `iris.csv`, `breast-cancer.csv`, `groceries.csv`, `Data.csv`, `dirtydata.csv`, `alphabet_stock_data.csv`, `rainfall.csv`, `students.csv`) are bundled inside the package wheel.
77
+ - **Zero External Dependencies for Generator**: The `pylab` CLI and generator depend strictly on the Python standard library. It installs anywhere instantly without dependency conflicts.
78
+ - **Accidental Overwrite Protection**: Existing user files are never silently overwritten. Use `--force` to deliberately replace files.
79
+ - **Built-in System Doctor**: Run `pylab doctor` to check Python versions, directory permissions, and optional scientific libraries.
80
+
81
+ ---
82
+
83
+ ## 2. Installation
84
+
85
+ ### Standard Installation via pip
86
+ ```bash
87
+ python -m pip install python-lab-toolkit
88
+ ```
89
+
90
+ ### Optional Scientific Libraries
91
+ The core toolkit runs anywhere on standard Python. If you want to execute machine learning, plotting, or numerical labs (Q23, Q31-Q52), install the scientific packages:
92
+ ```bash
93
+ python -m pip install -r requirements-labs.txt
94
+ ```
95
+ Or install specific dependencies per question:
96
+ ```bash
97
+ pylab install-deps q49
98
+ ```
99
+
100
+ ---
101
+
102
+ ## 3. Quick Start
103
+
104
+ ### 1. View Available Questions
105
+ ```bash
106
+ pylab list
107
+ ```
108
+
109
+ ### 2. Generate a Single Question
110
+ Generate the modular text analysis lab (Question 12):
111
+ ```bash
112
+ pylab q12
113
+ ```
114
+ Output:
115
+ ```text
116
+ Question 12 generated successfully.
117
+
118
+ Project: q12_text_analysis/
119
+
120
+ Files:
121
+ text_preprocessor.py
122
+ text_analyzer.py
123
+ main_analyzer.py
124
+ README.md
125
+
126
+ Run:
127
+ python q12_text_analysis/main_analyzer.py
128
+ ```
129
+
130
+ ### 3. Run the Generated Program
131
+ ```bash
132
+ python q12_text_analysis/main_analyzer.py
133
+ ```
134
+
135
+ ### 4. Generate Machine Learning Labs with Automatic Datasets
136
+ Generate the 22-step Wine Quality regression pipeline:
137
+ ```bash
138
+ pylab q49
139
+ ```
140
+ This automatically obtains `winequality-red.csv` and `winequality-white.csv`, creates `results/`, and generates `wine_regression.py` and `README.md`.
141
+
142
+ ---
143
+
144
+ ## 4. Complete Command Reference
145
+
146
+ | Command | Description |
147
+ | :--- | :--- |
148
+ | `pylab list` | Display all 52 registered questions with numbers, titles, and categories. |
149
+ | `pylab list --category <cat>` | Filter questions by category (`fundamentals`, `oop`, `pandas`, etc.). |
150
+ | `pylab q<N>` | Generate Question `<N>` (e.g. `pylab q1`, `pylab q25`, `pylab q49`). |
151
+ | `pylab q<N> --force` | Overwrite existing project files. |
152
+ | `pylab q<N> --offline` | Force usage of bundled offline datasets. |
153
+ | `pylab q<N> --output-dir <dir>` | Generate the project inside a specified directory. |
154
+ | `pylab category <cat>` | Generate all questions belonging to a specific category. |
155
+ | `pylab all` | Generate all 52 questions (prompts for confirmation). |
156
+ | `pylab all --yes` | Generate all 52 questions non-interactively. |
157
+ | `pylab doctor` | Inspect environment, Python version, directory write permissions, and libraries. |
158
+ | `pylab datasets` | Display status and metadata for all bundled and downloadable datasets. |
159
+ | `pylab install-deps <q>` | Check and install missing optional pip packages for a specific question. |
160
+ | `pylab version` | Show the installed toolkit version. |
161
+ | `pylab --help` | Display CLI help and options. |
162
+
163
+ ---
164
+
165
+ ## 5. The 52 Lab Questions Catalog
166
+
167
+ ### Python Fundamentals (Questions 1–11)
168
+ - **Q1 (`q01_variable_name_validator`)**: Validate identifier rules and check reserved keywords using `keyword.iskeyword()`.
169
+ - **Q2 (`q02_single_number`)**: Find the unique integer in an array where all other integers appear twice using XOR ($O(n)$ time, $O(1)$ space).
170
+ - **Q3 (`q03_string_operations`)**: Implement `process_string()` to display uppercase, lowercase, length, slicing reversal `[::-1]`, and palindrome status.
171
+ - **Q4 (`q04_menu_string_processor`)**: Menu-driven program for substring checking, character occurrence counting, substring replacement, and uppercase conversion.
172
+ - **Q5 (`q05_phonebook`)**: Dictionary-based contact management supporting Add, Update, Search, Delete, and Display.
173
+ - **Q6 (`q06_simple_calculator`)**: Arithmetic calculator supporting `+`, `-`, `*`, `/`, `//`, `%`, `**` with zero-division handling.
174
+ - **Q7 (`q07_session_attendees`)**: Set operations on conference attendees: Union, Intersection, AI-only, and Cybersecurity-only.
175
+ - **Q8 (`q08_number_properties`)**: Functions verifying Even/Odd, Palindrome, Armstrong numbers, Prime numbers, and Perfect numbers.
176
+ - **Q9 (`q09_greet_people`)**: Variable argument function `greet_people(*names)` handling zero, one, or multiple parameters.
177
+ - **Q10 (`q10_password_strength`)**: Password validator testing length, digits, uppercase, lowercase, and special characters with detailed deficiency reporting.
178
+ - **Q11 (`q11_recursion`)**: Recursive sum and recursive factorial evaluated on $n = 5, 10, 18$.
179
+
180
+ ### Modular Programming (Question 12)
181
+ - **Q12 (`q12_text_analysis`)**: Multi-module architecture with `text_preprocessor.py`, `text_analyzer.py`, and `main_analyzer.py` displaying required function docstrings via `__doc__`.
182
+
183
+ ### Object-Oriented Programming (Questions 13–18)
184
+ - **Q13 (`q13_student_class`)**: `Student` class with `name`, `roll_number`, `course`, and `display()`.
185
+ - **Q14 (`q14_circle_class`)**: `Circle` class with radius, `area()`, and `circumference()` methods using `math.pi`.
186
+ - **Q15 (`q15_employee_salary`)**: `Employee` gross salary calculator with basic pay, HRA (20%), and DA (10%).
187
+ - **Q16 (`q16_smart_calculator`)**: `SmartCalculator` demonstrating default arguments, `*args` multiplication, and polymorphic type dispatch.
188
+ - **Q17 (`q17_complex_number`)**: `ComplexNumber` class with `+` (`__add__`) and `==` (`__eq__`) operator overloading.
189
+ - **Q18 (`q18_vehicle_inheritance`)**: `Vehicle` base class and `Car` derived class with method overriding and `super()`.
190
+
191
+ ### Files, Exceptions, and Dates (Questions 19–22)
192
+ - **Q19 (`q19_file_word_counter`)**: Read text file, count lines, words, characters, find top 5 frequent words, and handle file exceptions. Includes `sample.txt`.
193
+ - **Q20 (`q20_custom_exception_age`)**: Custom exception `InvalidAgeException` validating ages between 18 and 60.
194
+ - **Q21 (`q21_transaction_handling`)**: Robust banking transaction demonstrating `try`, `except`, `else`, and `finally` blocks.
195
+ - **Q22 (`q22_date_formatter`)**: Date parser converting `dd-mm-yyyy` to `MonthName dd, yyyy` with invalid calendar date detection.
196
+
197
+ ### CSV Processing (Questions 23–24)
198
+ - **Q23 (`q23_rainfall_analysis`)**: Read rainfall CSV data, calculate station averages, maximum rainfall record, standard deviation, and export results.
199
+ - **Q24 (`q24_students_csv`)**: Manage `students.csv`, find highest-scoring student, and compute class average marks.
200
+
201
+ ### Database Systems (Questions 25–26)
202
+ - **Q25 (`q25_sqlite_library`)**: SQLite Library Management system with parameterized single inserts, `executemany()` batch inserts, category queries, and menu CLI.
203
+ - **Q26 (`q26_mysql_employee`)**: MySQL Employee Management system with parameterized queries, salary filtering (> ₹50,000), and secure environment credentials.
204
+
205
+ ### REST API & Networking (Question 27)
206
+ - **Q27 (`q27_crudcrud_api`)**: Functional `requests`-based REST client performing Create, Read, Update, and Delete on students. Includes built-in `mock_server.py` for offline testing!
207
+
208
+ ### CGI & Web Applications (Questions 28–30)
209
+ - **Q28 (`q28_cgi_login`)**: HTML login form and Python CGI handler displaying welcome response, with built-in `server.py`.
210
+ - **Q29 (`q29_cgi_registration`)**: MSc registration form and Python CGI script returning formatted admission receipt.
211
+ - **Q30 (`q30_cgi_crud`)**: Web-based database CRUD portal backed by SQLite, HTML frontend, and Python CGI HTTP server.
212
+
213
+ ### NumPy and Pandas Numerical Analysis (Questions 31–43)
214
+ - **Q31 (`q31_numpy_matrix_operations`)**: Array 1–20 reshaped to 4×5, transpose, total/row/column sums, and even number extraction.
215
+ - **Q32 (`q32_numpy_slicing_reversal`)**: 5×5 array (1–25) submatrix slicing, row slicing, column slicing, and axis reversals.
216
+ - **Q33 (`q33_pandas_student_pass_fail`)**: Convert student marks Series to DataFrame, classify Pass/Fail, and filter passing students.
217
+ - **Q34 (`q34_pandas_employee_salary`)**: Departmental salary analysis computing average salary per department and top earner.
218
+ - **Q35 (`q35_pandas_sales_barchart`)**: 6 months sales table for 3 products, detecting top month, and plotting bar chart to `results/`.
219
+ - **Q36 (`q36_pandas_weather_plot`)**: 7-day weather table calculating average temperature and total rainfall, plotting temperature trend line.
220
+ - **Q37 (`q37_pandas_age_categorization`)**: Continuous age categorization using `pd.cut()` with mismatch detection.
221
+ - **Q38 (`q38_pandas_concat_rows`)**: Concatenate two student DataFrames along rows (`axis=0`).
222
+ - **Q39 (`q39_pandas_concat_cols`)**: Combine student DataFrames along columns (`axis=1`).
223
+ - **Q40 (`q40_pandas_concat_merge`)**: Concatenate student batches and merge with exam scores DataFrame on `student_id`.
224
+ - **Q41 (`q41_pandas_join_operations`)**: Relational join operations: Inner, Left, Right, and Outer joins with detailed semantics explanation.
225
+ - **Q42 (`q42_pandas_groupby_school`)**: Group school records by school code, compute mean/min/max age, and inspect GroupBy object type.
226
+ - **Q43 (`q43_pandas_groupby_multi`)**: Multi-column GroupBy (`['school_code', 'class']`) computing group counts with `size()`.
227
+
228
+ ### Visualization and Preprocessing (Questions 44–48)
229
+ - **Q44 (`q44_alphabet_stock_visualization`)**: Alphabet stock historical data filtering, line plots, volume bar plot, stacked OHLC histogram, and scatter correlation.
230
+ - **Q45 (`q45_multi_plot_demonstration`)**: 2×2 multi-plot demonstration grid (waveform, categories, scatter, histogram).
231
+ - **Q46 (`q46_dataframe_barchart`)**: Grouped categorical bar plot with value annotations and legends.
232
+ - **Q47 (`q47_data_preprocessing`)**: Impute missing numerical values (`SimpleImputer`), One-Hot encode categorical features, and standard scale features (`StandardScaler`).
233
+ - **Q48 (`q48_dirtydata_cleaning`)**: Clean dirty dataset: fix inconsistent date formats, impute null calories, correct outlier duration, and drop duplicates.
234
+
235
+ ### Machine Learning & Data Mining Pipelines (Questions 49–52)
236
+ - **Q49 (`q49_wine_quality_regression`)**: Full 22-step regression pipeline on red and white wine: data integration, correlation heatmap, feature scaling, Linear Regression, Decision Tree Regressor, Random Forest Regressor, and $R^2$, MAE, MSE, RMSE evaluation.
237
+ - **Q50 (`q50_breast_cancer_classification`)**: Breast cancer diagnosis classification, Random Forest feature ranking, top-feature reduction, and classifier comparison (Decision Tree, Random Forest, Logistic Regression) with confusion matrices and false-negative analysis.
238
+ - **Q51 (`q51_iris_clustering`)**: Unsupervised clustering on Iris features: standardization, K-Means ($k = 2, 3, 4$), elbow method, and 2D PCA cluster visualization.
239
+ - **Q52 (`q52_apriori_association_rules`)**: Market basket transaction processing with Apriori, frequent itemset generation, and association rules sorted by lift.
240
+
241
+ ---
242
+
243
+ ## 6. Automated Dataset Management
244
+
245
+ When generating questions requiring datasets, `pylab` automatically acquires them:
246
+
247
+ ```text
248
+ q49_wine_quality_regression/
249
+ ├── wine_regression.py
250
+ ├── winequality-red.csv <-- Auto-acquired
251
+ ├── winequality-white.csv <-- Auto-acquired
252
+ ├── README.md
253
+ └── results/
254
+ ```
255
+
256
+ ### Dataset Registry
257
+ | Dataset Filename | Used In | Official Source | Bundled Offline |
258
+ | :--- | :--- | :--- | :--- |
259
+ | `winequality-red.csv` | Q49 | UCI Machine Learning Repository | Yes |
260
+ | `winequality-white.csv` | Q49 | UCI Machine Learning Repository | Yes |
261
+ | `breast-cancer.csv` | Q50 | UCI Machine Learning Repository | Yes |
262
+ | `iris.csv` | Q51 | UCI Machine Learning Repository | Yes |
263
+ | `groceries.csv` | Q52 | Association Mining Market Baskets | Yes |
264
+ | `Data.csv` | Q47 | ML Preprocessing Reference Data | Yes |
265
+ | `dirtydata.csv` | Q48 | Data Cleaning Reference Data | Yes |
266
+ | `alphabet_stock_data.csv` | Q44 | Financial Time Series Reference | Yes |
267
+ | `rainfall.csv` | Q23 | Weather Station Records | Yes |
268
+ | `students.csv` | Q24 | Student Grades Records | Yes |
269
+
270
+ To view dataset status at any time, run:
271
+ ```bash
272
+ pylab datasets
273
+ ```
274
+
275
+ ---
276
+
277
+ ## 7. Offline Installation & Laboratory Bundle
278
+
279
+ In lab environments where internet access is unavailable or restricted, you can prepare an offline installation bundle.
280
+
281
+ ### Step 1: Prepare the Offline Wheels Folder (on an internet-connected machine)
282
+ ```bash
283
+ mkdir -p offline_bundle/wheels
284
+ python -m pip download -d offline_bundle/wheels python-lab-toolkit
285
+ python -m pip download -d offline_bundle/wheels -r requirements-labs.txt
286
+ ```
287
+
288
+ ### Step 2: Install Completely Offline in the Laboratory
289
+ Transfer the `offline_bundle` folder to your offline laboratory computers and install:
290
+ ```bash
291
+ python -m pip install --no-index --find-links ./offline_bundle/wheels python-lab-toolkit
292
+ ```
293
+
294
+ ### Step 3: Run Generation Offline
295
+ ```bash
296
+ pylab q49 --offline
297
+ ```
298
+ The toolkit will immediately use the verified bundled datasets stored inside the package wheel.
299
+
300
+ ---
301
+
302
+ ## 8. Database Configuration (SQLite & MySQL)
303
+
304
+ ### SQLite (Q25 & Q30)
305
+ SQLite is built into Python. No installation, server configuration, or credentials are required. The database files (`library.db` and `cgi_records.db`) are created automatically in the project folder.
306
+
307
+ ### MySQL (Q26)
308
+ Question 26 integrates with a MySQL database.
309
+ To run Question 26 against your MySQL server:
310
+ 1. Start your local MySQL service (e.g. `sudo systemctl start mysqld` or through XAMPP / MySQL Workbench).
311
+ 2. Configure credentials using environment variables:
312
+ ```bash
313
+ export MYSQL_HOST="localhost"
314
+ export MYSQL_USER="root"
315
+ export MYSQL_PASSWORD="your_password"
316
+ export MYSQL_DATABASE="company_db"
317
+ ```
318
+ 3. Run the manager:
319
+ ```bash
320
+ python q26_mysql_employee/mysql_employee_manager.py
321
+ ```
322
+ Or run the automated demonstration:
323
+ ```bash
324
+ python q26_mysql_employee/mysql_employee_manager.py --demo
325
+ ```
326
+
327
+ ---
328
+
329
+ ## 9. CGI Web Handlers and Local Test Servers
330
+
331
+ Questions 28, 29, and 30 demonstrate CGI forms and web applications. Each generated project contains a self-contained local Python HTTP server (`server.py`).
332
+
333
+ To test in your browser:
334
+ ```bash
335
+ cd q28_cgi_login
336
+ python server.py
337
+ ```
338
+ Open `http://localhost:8080` in your web browser. You can enter credentials, submit forms, and inspect the CGI responses immediately!
339
+
340
+ ---
341
+
342
+ ## 10. Troubleshooting & FAQ
343
+
344
+ ### "No module named 'numpy'" or other scientific library error
345
+ The code generator does not require scientific libraries, but running the generated script might. Run:
346
+ ```bash
347
+ pylab install-deps <question_number>
348
+ # Example: pylab install-deps q49
349
+ ```
350
+ Or install all lab dependencies at once:
351
+ ```bash
352
+ pip install -r requirements-labs.txt
353
+ ```
354
+
355
+ ### "The directory already contains existing files"
356
+ To prevent accidental loss of code, `pylab` will not overwrite existing directories. Pass `--force`:
357
+ ```bash
358
+ pylab q12 --force
359
+ ```
360
+
361
+ ### How can I check if my Python environment is ready?
362
+ Run the built-in system diagnostics tool:
363
+ ```bash
364
+ pylab doctor
365
+ ```
366
+
367
+ ---
368
+
369
+ ## 11. Development & Automated Testing
370
+
371
+ ### Running Tests
372
+ The toolkit includes a 56-test automated test suite verifying registry integrity, file generation, syntax correctness, comment absence (Rule A), CLI subcommands, database queries, and program execution.
373
+
374
+ Run the test suite using standard Python:
375
+ ```bash
376
+ python -m unittest discover -s tests -v
377
+ ```
378
+
379
+ ### Building Distribution Packages
380
+ Build modern wheel and source distributions into `dist/`:
381
+ ```bash
382
+ python setup.py sdist bdist_wheel
383
+ ```
384
+
385
+ ---
386
+
387
+ ## 12. PyPI Publication Guide
388
+
389
+ To publish `python-lab-toolkit` to PyPI:
390
+
391
+ ### Step 1: Install Build and Twine Tools
392
+ ```bash
393
+ python -m pip install --upgrade build twine
394
+ ```
395
+
396
+ ### Step 2: Build Clean Artifacts
397
+ ```bash
398
+ rm -rf dist build src/*.egg-info
399
+ python -m build
400
+ ```
401
+
402
+ ### Step 3: Check Package Metadata with Twine
403
+ ```bash
404
+ python -m twine check dist/*
405
+ ```
406
+
407
+ ### Step 4: Securely Upload to PyPI using an API Token
408
+ ```bash
409
+ python -m twine upload --username __token__ dist/*
410
+ ```
411
+ When prompted for your password, enter your PyPI API token (`pypi-AgEI...`).
412
+
413
+ > [!IMPORTANT]
414
+ > Never hardcode API tokens or passwords in configuration files or version control. Always use `__token__` and enter the secret token interactively or via the `TWINE_PASSWORD` environment variable.
415
+
416
+ ---
417
+
418
+ ## 13. License & Dataset Attribution
419
+
420
+ ### Package License
421
+ This software is distributed under the **MIT License**. See [LICENSE](LICENSE) for full details.
422
+
423
+ ### Dataset Attributions
424
+ - **Wine Quality Datasets (`winequality-red.csv`, `winequality-white.csv`)**: P. Cortez, A. Cerdeira, F. Almeida, T. Matos, and J. Reis (2009). Modeling wine preferences by data mining from physicochemical properties. *Decision Support Systems*, Elsevier, 47(4):547-553.
425
+ - **Breast Cancer Wisconsin (Diagnostic) Dataset (`breast-cancer.csv`)**: Dr. William H. Wolberg, W. Nick Street, and Olvi L. Mangasarian. UCI Machine Learning Repository.
426
+ - **Iris Dataset (`iris.csv`)**: R.A. Fisher (1936). The use of multiple measurements in taxonomic problems. *Annals of Eugenics*, 7, Part II, 179-188.
427
+ - **Groceries Dataset (`groceries.csv`)**: Michael Hahsler, Kurt Hornik, and Christian Buchta (2005). arules - Mining Association Rules and Frequent Itemsets.
@@ -0,0 +1,86 @@
1
+ pylab/__init__.py,sha256=h_cFxSav-zn3IDYntnI5lgYMEQiQUYBc04aui8RwHJo,1089
2
+ pylab/cli.py,sha256=1b6P4uqGpsn32D4dE4voCiGgJ90cqXa1PhSPZqLYOb8,12255
3
+ pylab/datasets.py,sha256=OSvYBtik5Vtv2rzQWPbki1p_-e1xLYuCVwPbundnXVY,12298
4
+ pylab/environment.py,sha256=IeifHQG0lBwmRjGrqjCOSpVc84ymZuJ41FznP47t_m4,5412
5
+ pylab/errors.py,sha256=bseqtjHWKw9BF-pePstRsUaNqhndQR0riiiJCOycvBU,2316
6
+ pylab/generator.py,sha256=GXSvlPTx8KBA543Sx_oj-x3GdMBcJPtSu4q5AJ17-eY,7172
7
+ pylab/registry.py,sha256=8er-Ue0dGtSd-C-wgCK3WWlHa7UYRladJOyVdjVlTaQ,22656
8
+ pylab/data/Data.csv,sha256=Q5ONf9LUPv-SVSNfWwuRZwqmWWwkyKDhkm2jYMPkCOk,217
9
+ pylab/data/alphabet_stock_data.csv,sha256=lUk8N_FsYdx4WSkNYum9dC46Bwo3IsYVKnv-3Hp-6Ys,8477
10
+ pylab/data/breast-cancer.csv,sha256=OAaYdTpjw_axGVtTMhUIB-ne0BBrISgkX_I-wY5N7FY,78914
11
+ pylab/data/dirtydata.csv,sha256=bUVGz1PuL0AH3449FByZCB0QT5OMAfZMmhUiXevw8rY,966
12
+ pylab/data/groceries.csv,sha256=n5QhWjQ64NxM7h1hNbLb8bvt3hwbXnSSp_kqQPNQG1A,13015
13
+ pylab/data/iris.csv,sha256=dRxx9xBjEs2choYW1XobYBqL0KUhooLgzBUevr9Rwh8,4608
14
+ pylab/data/rainfall.csv,sha256=yXoql4QfShwyt63shntu0RlDzX_URuFk9RET5t8_fJI,4637
15
+ pylab/data/students.csv,sha256=OcfoiE0buGucOIIzXHI_y6rpEx_QfTgehb7WROVFr_g,106
16
+ pylab/data/winequality-red.csv,sha256=_PKGkoi7FUSX_c0f_giepj9Dbx4q6GhlJLT6K34L2zM,89292
17
+ pylab/data/winequality-white.csv,sha256=UZMA15xHl7Jfuh6ESqCFoeoo8O7xtPSYV1mGs_8mWhY,134323
18
+ pylab/templates/q1/variable_validator.py,sha256=xVlmM1EpmMKXc9Mw-3N181SoRJEW1rweWf9VQGvybnw,1457
19
+ pylab/templates/q10/password_strength.py,sha256=P85V_5yRfDNMMCDKaGW0hVRDIx2yPZXul63w0Jul-v4,1414
20
+ pylab/templates/q11/recursion_math.py,sha256=BuTXIlwGdUPpCqnm5pjWLbqyzlwLR2Ggt-pNpw_d3sY,697
21
+ pylab/templates/q12/main_analyzer.py,sha256=9wJaKwrlYQNPjVdAtWZTwy3ZMGfYzke7woyDLobZXK8,1812
22
+ pylab/templates/q12/text_analyzer.py,sha256=21ouvw2ZrePowJt3uqeu74lwam9ilOxNSGN0YzDm4-8,638
23
+ pylab/templates/q12/text_preprocessor.py,sha256=fypmszepLhHL-4mV7ieSszPSOvVWUa89cghGCLcEIwY,545
24
+ pylab/templates/q13/student.py,sha256=b-xJokVw_qGNqDqjZ5wHuqHIBLHiAj6tUWv6-5o0jDk,762
25
+ pylab/templates/q14/circle.py,sha256=Z2achhRjL_DqpIZSZVisg0o2XbBCQCxDffAe1hNV8Ug,688
26
+ pylab/templates/q15/employee_salary.py,sha256=XVcPnKGQm30Z_zFDmhuq5YNcfgcryxauOKwBwXAdM_4,1368
27
+ pylab/templates/q16/smart_calculator.py,sha256=7lEHaAReZp8GN-3dVPtIk4chwvyVMoZ7PVwa8ci4Frg,1965
28
+ pylab/templates/q17/complex_number.py,sha256=vTVbgFCCSfdERzXb99oiP3lnJFYa7Fxp_Wg3vzQJXq8,1284
29
+ pylab/templates/q18/vehicle_inheritance.py,sha256=2VD8bctL8ZQnatHxoZt_DGe8mT92qX2-XW0YQ-MRecI,1399
30
+ pylab/templates/q19/file_word_counter.py,sha256=_wFhFO-qKdnoPkrzg0D0ZZui3NNiFej0Z3gmrHbmefc,1576
31
+ pylab/templates/q19/sample.txt,sha256=ckUplNAxTXuKdIRuxlxzgC-clqBpydTE9CZ1-yacad4,544
32
+ pylab/templates/q2/single_number.py,sha256=ilTIYAH4VHFat3ZfhoEXGkno32nUdbvbOJbC6eLqkWQ,645
33
+ pylab/templates/q20/age_validator.py,sha256=S5ryIoNa2quOzDLk6LRznoTx-47Sy04hO0mFgm8ZsrQ,928
34
+ pylab/templates/q21/transaction_manager.py,sha256=qLjFtal63znb1MhG7jVBVWpBijKdbCuZyDFhcoCo7ZU,1518
35
+ pylab/templates/q22/date_formatter.py,sha256=TbRYr6FHFAjgPznKAH-rvYDfNkc0DCNTKEk0Sji_LM8,847
36
+ pylab/templates/q23/rainfall_analyzer.py,sha256=7rERdrmpFDvvfWzHUnnRebPf1nnAhJbK4rUg34FWwAE,2540
37
+ pylab/templates/q24/student_marks.py,sha256=WJI-AFfmOKDugV9UutdZxekGwjM5nWMBlMdPenNzUCw,2131
38
+ pylab/templates/q25/library_manager.py,sha256=iShSwWtWp3bA9j50GgmLFTWV1gPj0j-zztotx38omZU,7188
39
+ pylab/templates/q26/mysql_employee_manager.py,sha256=LB9zLpahC3rBL6PW25isnzs3ZQhudYzgfkmur67ysmo,9310
40
+ pylab/templates/q27/crud_client.py,sha256=bee3RyF37Ex-pxPtlzGKdctuqRdUoPBmg2HcuiRaCKY,3966
41
+ pylab/templates/q27/mock_server.py,sha256=bBiqkPQXFm4wZhXjen5-skEG01f56zv8D6nYM2c5M4k,3174
42
+ pylab/templates/q28/index.html,sha256=G2Ocj8MREa1lfVi3CWl9SfTTTuBPGdYIOswxkndwpNI,1500
43
+ pylab/templates/q28/login_handler.py,sha256=BeHbr7jd29Az3ta6erNw_9MCSwDEIKwFTianIFV5r1w,1090
44
+ pylab/templates/q28/server.py,sha256=EiwLLRAyMAoLc3YqSh9CahPE2i9FMRkqQvoe9uqRJrA,1588
45
+ pylab/templates/q29/index.html,sha256=tggvGbP5v9F6USFSa70PbtTvEh4xTcTm3awF1o2VlaA,2466
46
+ pylab/templates/q29/register_handler.py,sha256=FBWg_zJv_jO2LWq38EsQk1enCBUZEsMDUZOVA_Hqs3w,1686
47
+ pylab/templates/q29/server.py,sha256=8_YS1-5RmMYoDteFtWO-N2Q58BzYTbKoegJU5B6wiyc,1538
48
+ pylab/templates/q3/string_operations.py,sha256=xAXOcwJdaswpXAh8DA89HCxxZDeI8_e7iNjAGVxo_B4,970
49
+ pylab/templates/q30/crud_handler.py,sha256=JgOVVIUJeDil3TJQCmJ7PIuYdsg0UVlwJ55SrPQzHuw,2482
50
+ pylab/templates/q30/database.py,sha256=lCtu8NmO6kPcgLNXeeTumgp3waSIqMTAfOTnLUdIkHQ,1991
51
+ pylab/templates/q30/index.html,sha256=eDHRBB_S0fEZtwaHJrFbhlg3aH1XlaavfdYmCyKmt_A,2909
52
+ pylab/templates/q30/server.py,sha256=5S3bzAW75yyGRYBYexxXIK1sEA15eldp7D1d1J-5t6E,1933
53
+ pylab/templates/q31/numpy_matrix.py,sha256=abnoUjIjoGOz1ZHg3JTpajQCcwtN5E5mas5KRzBfHM0,1104
54
+ pylab/templates/q32/numpy_slicing.py,sha256=kR3d9Rnm2VNiJBXrXhqUuj7lJYnBctewa7Gs4PzuGZI,1154
55
+ pylab/templates/q33/pandas_students.py,sha256=3EIuoXbHfjndJSUMLkgFgzJmvfcGbpIZmmIdtuw4B6I,1213
56
+ pylab/templates/q34/pandas_salary.py,sha256=FzRJVRexN4DYcNXl1kVL_Q_n40Sktty4HkKmdDN9A44,1358
57
+ pylab/templates/q35/sales_barchart.py,sha256=LXW3jbbyRIDdc7ePtta9pFxdFNepMa6usXVHKkH_f-Y,2121
58
+ pylab/templates/q36/weather_plot.py,sha256=rYSFjwJD2gZ96s-pILXEDQKCfcItflWMz5AnNnu5XPU,1748
59
+ pylab/templates/q37/age_categorization.py,sha256=_Kn-mZ8KAGBF3NNDo_N3HEgzr0FRXa9YjyRwDX5VGAU,1192
60
+ pylab/templates/q38/concat_rows.py,sha256=usT0nVhXYyj1SyTEw2-5wdfSs1zvLmI-UUfXZOrGU2Q,1085
61
+ pylab/templates/q39/concat_cols.py,sha256=U-nc8X6dViP6ee3YcmvQiSIjKno-wijl3ihwhAXtBRw,1145
62
+ pylab/templates/q4/menu_string_processor.py,sha256=Ht3XhKOwxrJbZJ3cSUfOGRf5Kk1T8HclZx2q6xiyht0,2589
63
+ pylab/templates/q40/concat_merge.py,sha256=XeiWJAJDfJpF2L-mHQlMAqQ7-Urv1i2fULrmNB7u2pw,1318
64
+ pylab/templates/q41/pandas_joins.py,sha256=OI3ee_2ABkWJ-V4XZy1bhIIC4aGcasni5cJlhEaCK_4,1465
65
+ pylab/templates/q42/groupby_school.py,sha256=X8W4RZjVQXt4wZnYtMPuoOLe7uy5y9KDc1miE85csy0,1009
66
+ pylab/templates/q43/groupby_multi.py,sha256=MUE3waqDzZ3LPGM8AFPcmuq1SqhbZOirCsKB_Dix-8g,986
67
+ pylab/templates/q44/alphabet_stock_viz.py,sha256=w4ZvNCOYtk7-uzVCVcrV0IF4du9xtXa49GC9ebwt2gk,3749
68
+ pylab/templates/q45/multi_plot.py,sha256=1Bx21xATLMT2f7SoqpdfeTJw1VwMg0x0y6MijWzgGCY,2614
69
+ pylab/templates/q46/dataframe_barchart.py,sha256=tDEBduqo42BP_iY2dTvpgA8cFI7tK1B0EpL6ABPPv9o,2114
70
+ pylab/templates/q47/preprocess_data.py,sha256=sFiM9nVLfkEoOkZTNCNNVFfRDLHXr9XLMqdwXicoPoQ,1770
71
+ pylab/templates/q48/clean_dirtydata.py,sha256=MJhA-WhXwwFqz7emqXh8QI3yM39dIdtXept0ahg0Mnk,2019
72
+ pylab/templates/q49/wine_regression.py,sha256=x7d4ALFwv7O-sQh6bpRv4DegpJa2VEV70aXMRuDTkJA,6891
73
+ pylab/templates/q5/phonebook.py,sha256=weoJm8V0kL7jujr0-_2VChpQCY_0vkTrpc4YgOnbMFk,3813
74
+ pylab/templates/q50/breast_cancer_classifier.py,sha256=whyDqoPAqGsk-vhzf9-cQUVhNWv62JX_4xORgotfNjA,6160
75
+ pylab/templates/q51/iris_clustering.py,sha256=WU9d8c7xv_wMHNSwx98jiLJ93rcIUtiSmkVXH5BKX2E,3664
76
+ pylab/templates/q52/apriori_groceries.py,sha256=KwEvprBlXQ2koNVDNeqHcr2IzHFDwWrAYPQ_DxhjDD4,3464
77
+ pylab/templates/q6/calculator.py,sha256=x6viJNf0xTsFrRZSBsoesQRpA-v7rAl_bqoA1FepNkQ,1541
78
+ pylab/templates/q7/session_attendees.py,sha256=IMH7NnLb2aKsB4cFngT4FzV2Zd3HEz2c2T1OZMJEGys,1599
79
+ pylab/templates/q8/number_properties.py,sha256=kPffPigPkVoVY3VcpfTcHOOeSGO0xDu8eD8YIWH9Xqk,1680
80
+ pylab/templates/q9/greet_people.py,sha256=j49u2-JN7772UJ5iC2PKWLUQ2agaAaCOnnOUYLITdpo,855
81
+ python_lab_toolkit-1.0.0.dist-info/LICENSE,sha256=n44B9fLajMt5GE6l9kBl2PPWTmkwrcV_8NxlAcp6kB0,1086
82
+ python_lab_toolkit-1.0.0.dist-info/METADATA,sha256=UEehNgWSfsYHNETIuh0LVlUbNYhaT9YYxZW479UstVo,21607
83
+ python_lab_toolkit-1.0.0.dist-info/WHEEL,sha256=pL8R0wFFS65tNSRnaOVrsw9EOkOqxLrlUPenUYnJKNo,91
84
+ python_lab_toolkit-1.0.0.dist-info/entry_points.txt,sha256=OPmiGlejducbqB4mvHeSoc-SObcQinYZet1tEw1IKjU,41
85
+ python_lab_toolkit-1.0.0.dist-info/top_level.txt,sha256=XJksTdDCzUvlNw1I76OyG11aeIN_RXgz-4udKzdT9OU,6
86
+ python_lab_toolkit-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (74.1.3)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pylab = pylab.cli:main
@@ -0,0 +1 @@
1
+ pylab