cl1-solutions 1.0.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.
- cl1_solutions-1.0.0/LICENSE +0 -0
- cl1_solutions-1.0.0/MANIFEST.in +5 -0
- cl1_solutions-1.0.0/PKG-INFO +158 -0
- cl1_solutions-1.0.0/README.md +130 -0
- cl1_solutions-1.0.0/cl1_solutions/__init__.py +26 -0
- cl1_solutions-1.0.0/cl1_solutions/__main__.py +6 -0
- cl1_solutions-1.0.0/cl1_solutions/cli.py +175 -0
- cl1_solutions-1.0.0/cl1_solutions/core.py +190 -0
- cl1_solutions-1.0.0/cl1_solutions/datasets/City_Air_Quality.csv +366 -0
- cl1_solutions-1.0.0/cl1_solutions/datasets/Iris.csv +151 -0
- cl1_solutions-1.0.0/cl1_solutions/datasets/Neighborhood_Demographics.csv +7 -0
- cl1_solutions-1.0.0/cl1_solutions/datasets/RealEstate_Prices.csv +801 -0
- cl1_solutions-1.0.0/cl1_solutions/datasets/Retail_Sales_Data.csv +1501 -0
- cl1_solutions-1.0.0/cl1_solutions/datasets/Social_Network_Ads.csv +401 -0
- cl1_solutions-1.0.0/cl1_solutions/datasets/Stock_Prices.csv +521 -0
- cl1_solutions-1.0.0/cl1_solutions/datasets/Telecom_Customer_Churn.csv +1201 -0
- cl1_solutions-1.0.0/cl1_solutions/datasets/Wine.csv +179 -0
- cl1_solutions-1.0.0/cl1_solutions/datasets/car_evaluation.csv +1729 -0
- cl1_solutions-1.0.0/cl1_solutions/datasets/cc_data_sample.csv +1001 -0
- cl1_solutions-1.0.0/cl1_solutions/datasets/diabetes.csv +769 -0
- cl1_solutions-1.0.0/cl1_solutions/datasets/sales_sample.csv +201 -0
- cl1_solutions-1.0.0/cl1_solutions/datasets/sales_sample.json +2402 -0
- cl1_solutions-1.0.0/cl1_solutions/datasets/sales_sample.xlsx +0 -0
- cl1_solutions-1.0.0/cl1_solutions/datasets/uber_fares_sample.csv +2001 -0
- cl1_solutions-1.0.0/cl1_solutions/notebooks/01_Feature_Transformation.ipynb +499 -0
- cl1_solutions-1.0.0/cl1_solutions/notebooks/02_Regression_Analysis.ipynb +536 -0
- cl1_solutions-1.0.0/cl1_solutions/notebooks/03_Classification_Analysis.ipynb +463 -0
- cl1_solutions-1.0.0/cl1_solutions/notebooks/04_Clustering_Analysis.ipynb +421 -0
- cl1_solutions-1.0.0/cl1_solutions/notebooks/05_Ensemble_Learning.ipynb +415 -0
- cl1_solutions-1.0.0/cl1_solutions/notebooks/06_Reinforcement_Learning.ipynb +839 -0
- cl1_solutions-1.0.0/cl1_solutions/notebooks/07_Data_Loading_Storage.ipynb +263 -0
- cl1_solutions-1.0.0/cl1_solutions/notebooks/08_Interacting_With_Web_APIs.ipynb +320 -0
- cl1_solutions-1.0.0/cl1_solutions/notebooks/09_Data_Cleaning_Preparation.ipynb +302 -0
- cl1_solutions-1.0.0/cl1_solutions/notebooks/10_Data_Wrangling.ipynb +270 -0
- cl1_solutions-1.0.0/cl1_solutions/notebooks/11_Data_Visualization.ipynb +282 -0
- cl1_solutions-1.0.0/cl1_solutions/notebooks/12_Data_Aggregation.ipynb +230 -0
- cl1_solutions-1.0.0/cl1_solutions/notebooks/13_Time_Series_Analysis.ipynb +279 -0
- cl1_solutions-1.0.0/cl1_solutions.egg-info/PKG-INFO +158 -0
- cl1_solutions-1.0.0/cl1_solutions.egg-info/SOURCES.txt +44 -0
- cl1_solutions-1.0.0/cl1_solutions.egg-info/dependency_links.txt +1 -0
- cl1_solutions-1.0.0/cl1_solutions.egg-info/entry_points.txt +4 -0
- cl1_solutions-1.0.0/cl1_solutions.egg-info/requires.txt +7 -0
- cl1_solutions-1.0.0/cl1_solutions.egg-info/top_level.txt +1 -0
- cl1_solutions-1.0.0/pyproject.toml +46 -0
- cl1_solutions-1.0.0/setup.cfg +4 -0
- cl1_solutions-1.0.0/setup.py +48 -0
|
File without changes
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cl1-solutions
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: All-in-one CLI and Python package to retrieve Jupyter Notebook solutions and datasets for all CL1 problem statements.
|
|
5
|
+
Home-page: https://github.com/example/cl1-solutions
|
|
6
|
+
Author: CL1 Contributor
|
|
7
|
+
Author-email: CL1 Contributor <developer@example.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
13
|
+
Classifier: Topic :: Education
|
|
14
|
+
Requires-Python: >=3.8
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: numpy
|
|
18
|
+
Requires-Dist: pandas
|
|
19
|
+
Requires-Dist: scikit-learn
|
|
20
|
+
Requires-Dist: matplotlib
|
|
21
|
+
Requires-Dist: seaborn
|
|
22
|
+
Requires-Dist: scipy
|
|
23
|
+
Requires-Dist: openpyxl
|
|
24
|
+
Dynamic: author
|
|
25
|
+
Dynamic: home-page
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
Dynamic: requires-python
|
|
28
|
+
|
|
29
|
+
# CL1 Solutions (`cl1-solutions`)
|
|
30
|
+
|
|
31
|
+
[](https://pypi.org/project/cl1-solutions/)
|
|
32
|
+
[](https://pypi.org/project/cl1-solutions/)
|
|
33
|
+
[](https://opensource.org/licenses/MIT)
|
|
34
|
+
|
|
35
|
+
> **All-in-One CLI & PyPI Package** to retrieve complete, ready-to-run Jupyter Notebook solutions (`.ipynb`) and datasets for all 13 Computational Lab 1 / Data Science & Machine Learning assignments in **one single command** (numbered cleanly from 1 to 13 with no separate sub-parts).
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## ⚡ Quick Start
|
|
40
|
+
|
|
41
|
+
### 1. Install via pip
|
|
42
|
+
|
|
43
|
+
Once published to PyPI:
|
|
44
|
+
```bash
|
|
45
|
+
pip install cl1-solutions
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or install locally from source:
|
|
49
|
+
```bash
|
|
50
|
+
pip install .
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
### 2. Retrieve All Solutions in One Command
|
|
56
|
+
|
|
57
|
+
To extract all 13 Jupyter Notebooks and all sample datasets into your project:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
cl1-get
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
*That's it!* All 13 notebooks and required datasets will be neatly extracted into `./cl1_solutions/`.
|
|
64
|
+
|
|
65
|
+
You can also specify a custom destination directory:
|
|
66
|
+
```bash
|
|
67
|
+
cl1-get all --dest ./my_cl1_notebooks
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 💻 CLI Commands & Usage
|
|
73
|
+
|
|
74
|
+
| Command | Action |
|
|
75
|
+
|---|---|
|
|
76
|
+
| `cl1-get` | **Extract all 13 notebooks and all datasets** (default action) |
|
|
77
|
+
| `cl1-get list` | List all 13 problem statements, categories, and matching notebook files |
|
|
78
|
+
| `cl1-get 1` | Extract only the notebook for Problem 1 (`01_Feature_Transformation.ipynb`) |
|
|
79
|
+
| `cl1-get 6` | Extract only the notebook for Problem 6 (`06_Reinforcement_Learning.ipynb`) |
|
|
80
|
+
| `cl1-get 13` | Extract only the notebook for Problem 13 (`13_Time_Series_Analysis.ipynb`) |
|
|
81
|
+
| `cl1-get info 6` | View detailed description and task list for Problem 6 |
|
|
82
|
+
| `cl1-get data` | Extract only the datasets folder |
|
|
83
|
+
| `cl1-get pypi-help` | Print instructions for building and publishing to PyPI |
|
|
84
|
+
| `python -m cl1_solutions` | Python module execution alias for all CLI commands |
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 📚 Complete Catalog of Included Problem Statements (1 to 13)
|
|
89
|
+
|
|
90
|
+
Every single assignment from 1 to 13 has a dedicated, complete, and thoroughly documented `.ipynb` notebook:
|
|
91
|
+
|
|
92
|
+
| No. | Category / Topic | Notebook File | Datasets | Key Methods & Contents |
|
|
93
|
+
|---|---|---|---|---|
|
|
94
|
+
| **1** | Feature Transformation | `01_Feature_Transformation.ipynb` | `Wine.csv`, `Iris.csv` | **Part A:** PCA for Dimensionality Reduction on Wine. **Part B:** LDA on Iris dataset for flower classification. |
|
|
95
|
+
| **2** | Regression Analysis | `02_Regression_Analysis.ipynb` | `uber_fares_sample.csv`, `diabetes.csv` | **Part A:** Uber Ride Price Prediction (Linear, Ridge, Lasso, R2, RMSE). **Part B:** Diabetes Univariate & Bivariate analysis. |
|
|
96
|
+
| **3** | Classification Analysis | `03_Classification_Analysis.ipynb` | Built-in Digits, `Social_Network_Ads.csv` | **Part A:** SVM for Handwritten Digits (0-9). **Part B:** KNN on Social Network Ads (Confusion Matrix, Precision, Recall). |
|
|
97
|
+
| **4** | Clustering Analysis | `04_Clustering_Analysis.ipynb` | `Iris.csv`, `cc_data_sample.csv` | **Part A:** K-Means with Elbow Method on Iris. **Part B:** K-Medoids (PAM) with Silhouette Method on Credit Card data. |
|
|
98
|
+
| **5** | Ensemble Learning | `05_Ensemble_Learning.ipynb` | `car_evaluation.csv`, `Iris.csv` | **Part A:** Random Forest Classifier for Car Safety. **Part B:** Multi-Ensemble Comparison (Voting, AdaBoost, GBM, XGBoost). |
|
|
99
|
+
| **6** | Reinforcement Learning | `06_Reinforcement_Learning.ipynb` | GridWorld, Taxi, Tic-Tac-Toe | **Part A:** Maze Exploration (Q-Learning). **Part B:** Taxi Problem (Taxi-v3). **Part C:** Tic-Tac-Toe Game Agent. |
|
|
100
|
+
| **7** | Data Formats | `07_Data_Loading_Storage.ipynb` | `sales_sample` (CSV, Excel, JSON) | Load 3 formats, quality check, deduplication, unified dataframe, derived metrics, Bar/Pie/Box plots. |
|
|
101
|
+
| **8** | Web APIs | `08_Interacting_With_Web_APIs.ipynb` | OpenWeatherMap API | Live/Mock weather pipeline, Temp/Humidity/Wind/Precip extraction, modeling, geospatial & correlation plots. |
|
|
102
|
+
| **9** | Data Cleaning | `09_Data_Cleaning_Preparation.ipynb` | `Telecom_Customer_Churn.csv` | 11 Tasks: Null imputation, Deduplication, Type conversions, Outlier capping, Tenure cohorts, Standardized split. |
|
|
103
|
+
| **10** | Data Wrangling | `10_Data_Wrangling.ipynb` | `RealEstate_Prices.csv` | 7 Tasks: Sanitize column headers, Demographic merge, Subsetting, One-hot encoding, Price/sqft metrics, Log transform. |
|
|
104
|
+
| **11** | Data Visualization | `11_Data_Visualization.ipynb` | `City_Air_Quality.csv` | 9 Matplotlib tasks: AQI threshold bands, Pollutant subplots (PM2.5, PM10, CO), Monthly bar, Box/Violin, Bubble chart. |
|
|
105
|
+
| **12** | Data Aggregation | `12_Data_Aggregation.ipynb` | `Retail_Sales_Data.csv` | 8 Tasks: Regional total sales, Bar/Pie distribution, Top region ranking, Region x Category matrix, Stacked/Grouped bars. |
|
|
106
|
+
| **13** | Time Series | `13_Time_Series_Analysis.ipynb` | `Stock_Prices.csv` | 8 Tasks: Datetime index, Price/Volume trends, 20/50 SMA & EMA, Seasonality decomposition, Correlation, ARIMA forecast. |
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## 🐍 Python Library API
|
|
111
|
+
|
|
112
|
+
You can also use this package programmatically inside any Python script:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
import cl1_solutions
|
|
116
|
+
|
|
117
|
+
# List all problem descriptions
|
|
118
|
+
problems = cl1_solutions.list_all_problems()
|
|
119
|
+
for p in problems:
|
|
120
|
+
print(p["id"], p["title"])
|
|
121
|
+
|
|
122
|
+
# Retrieve all notebooks and datasets to a custom folder
|
|
123
|
+
cl1_solutions.retrieve_all(dest_dir="./my_folder")
|
|
124
|
+
|
|
125
|
+
# Retrieve only Problem 6 (Reinforcement Learning)
|
|
126
|
+
cl1_solutions.copy_notebooks("./my_folder", problem_ids=["6"])
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 🚀 Publishing to PyPI (How-To Guide)
|
|
132
|
+
|
|
133
|
+
To publish this package to the Python Package Index (PyPI) under your account:
|
|
134
|
+
|
|
135
|
+
### 1. Build the Package
|
|
136
|
+
```bash
|
|
137
|
+
python -m build
|
|
138
|
+
```
|
|
139
|
+
This generates:
|
|
140
|
+
- Source distribution (`dist/cl1_solutions-1.0.0.tar.gz`)
|
|
141
|
+
- Binary wheel (`dist/cl1_solutions-1.0.0-py3-none-any.whl`)
|
|
142
|
+
|
|
143
|
+
### 2. Verify Archives
|
|
144
|
+
```bash
|
|
145
|
+
twine check dist/*
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 3. Upload to PyPI (Production)
|
|
149
|
+
```bash
|
|
150
|
+
twine upload dist/*
|
|
151
|
+
```
|
|
152
|
+
Enter your PyPI API token (`__token__` and your API token password) when prompted.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## 📝 License
|
|
157
|
+
|
|
158
|
+
Distributed under the **MIT License**. Feel free to use, modify, and distribute.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# CL1 Solutions (`cl1-solutions`)
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/cl1-solutions/)
|
|
4
|
+
[](https://pypi.org/project/cl1-solutions/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
> **All-in-One CLI & PyPI Package** to retrieve complete, ready-to-run Jupyter Notebook solutions (`.ipynb`) and datasets for all 13 Computational Lab 1 / Data Science & Machine Learning assignments in **one single command** (numbered cleanly from 1 to 13 with no separate sub-parts).
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## ⚡ Quick Start
|
|
12
|
+
|
|
13
|
+
### 1. Install via pip
|
|
14
|
+
|
|
15
|
+
Once published to PyPI:
|
|
16
|
+
```bash
|
|
17
|
+
pip install cl1-solutions
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or install locally from source:
|
|
21
|
+
```bash
|
|
22
|
+
pip install .
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
### 2. Retrieve All Solutions in One Command
|
|
28
|
+
|
|
29
|
+
To extract all 13 Jupyter Notebooks and all sample datasets into your project:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
cl1-get
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
*That's it!* All 13 notebooks and required datasets will be neatly extracted into `./cl1_solutions/`.
|
|
36
|
+
|
|
37
|
+
You can also specify a custom destination directory:
|
|
38
|
+
```bash
|
|
39
|
+
cl1-get all --dest ./my_cl1_notebooks
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 💻 CLI Commands & Usage
|
|
45
|
+
|
|
46
|
+
| Command | Action |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `cl1-get` | **Extract all 13 notebooks and all datasets** (default action) |
|
|
49
|
+
| `cl1-get list` | List all 13 problem statements, categories, and matching notebook files |
|
|
50
|
+
| `cl1-get 1` | Extract only the notebook for Problem 1 (`01_Feature_Transformation.ipynb`) |
|
|
51
|
+
| `cl1-get 6` | Extract only the notebook for Problem 6 (`06_Reinforcement_Learning.ipynb`) |
|
|
52
|
+
| `cl1-get 13` | Extract only the notebook for Problem 13 (`13_Time_Series_Analysis.ipynb`) |
|
|
53
|
+
| `cl1-get info 6` | View detailed description and task list for Problem 6 |
|
|
54
|
+
| `cl1-get data` | Extract only the datasets folder |
|
|
55
|
+
| `cl1-get pypi-help` | Print instructions for building and publishing to PyPI |
|
|
56
|
+
| `python -m cl1_solutions` | Python module execution alias for all CLI commands |
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 📚 Complete Catalog of Included Problem Statements (1 to 13)
|
|
61
|
+
|
|
62
|
+
Every single assignment from 1 to 13 has a dedicated, complete, and thoroughly documented `.ipynb` notebook:
|
|
63
|
+
|
|
64
|
+
| No. | Category / Topic | Notebook File | Datasets | Key Methods & Contents |
|
|
65
|
+
|---|---|---|---|---|
|
|
66
|
+
| **1** | Feature Transformation | `01_Feature_Transformation.ipynb` | `Wine.csv`, `Iris.csv` | **Part A:** PCA for Dimensionality Reduction on Wine. **Part B:** LDA on Iris dataset for flower classification. |
|
|
67
|
+
| **2** | Regression Analysis | `02_Regression_Analysis.ipynb` | `uber_fares_sample.csv`, `diabetes.csv` | **Part A:** Uber Ride Price Prediction (Linear, Ridge, Lasso, R2, RMSE). **Part B:** Diabetes Univariate & Bivariate analysis. |
|
|
68
|
+
| **3** | Classification Analysis | `03_Classification_Analysis.ipynb` | Built-in Digits, `Social_Network_Ads.csv` | **Part A:** SVM for Handwritten Digits (0-9). **Part B:** KNN on Social Network Ads (Confusion Matrix, Precision, Recall). |
|
|
69
|
+
| **4** | Clustering Analysis | `04_Clustering_Analysis.ipynb` | `Iris.csv`, `cc_data_sample.csv` | **Part A:** K-Means with Elbow Method on Iris. **Part B:** K-Medoids (PAM) with Silhouette Method on Credit Card data. |
|
|
70
|
+
| **5** | Ensemble Learning | `05_Ensemble_Learning.ipynb` | `car_evaluation.csv`, `Iris.csv` | **Part A:** Random Forest Classifier for Car Safety. **Part B:** Multi-Ensemble Comparison (Voting, AdaBoost, GBM, XGBoost). |
|
|
71
|
+
| **6** | Reinforcement Learning | `06_Reinforcement_Learning.ipynb` | GridWorld, Taxi, Tic-Tac-Toe | **Part A:** Maze Exploration (Q-Learning). **Part B:** Taxi Problem (Taxi-v3). **Part C:** Tic-Tac-Toe Game Agent. |
|
|
72
|
+
| **7** | Data Formats | `07_Data_Loading_Storage.ipynb` | `sales_sample` (CSV, Excel, JSON) | Load 3 formats, quality check, deduplication, unified dataframe, derived metrics, Bar/Pie/Box plots. |
|
|
73
|
+
| **8** | Web APIs | `08_Interacting_With_Web_APIs.ipynb` | OpenWeatherMap API | Live/Mock weather pipeline, Temp/Humidity/Wind/Precip extraction, modeling, geospatial & correlation plots. |
|
|
74
|
+
| **9** | Data Cleaning | `09_Data_Cleaning_Preparation.ipynb` | `Telecom_Customer_Churn.csv` | 11 Tasks: Null imputation, Deduplication, Type conversions, Outlier capping, Tenure cohorts, Standardized split. |
|
|
75
|
+
| **10** | Data Wrangling | `10_Data_Wrangling.ipynb` | `RealEstate_Prices.csv` | 7 Tasks: Sanitize column headers, Demographic merge, Subsetting, One-hot encoding, Price/sqft metrics, Log transform. |
|
|
76
|
+
| **11** | Data Visualization | `11_Data_Visualization.ipynb` | `City_Air_Quality.csv` | 9 Matplotlib tasks: AQI threshold bands, Pollutant subplots (PM2.5, PM10, CO), Monthly bar, Box/Violin, Bubble chart. |
|
|
77
|
+
| **12** | Data Aggregation | `12_Data_Aggregation.ipynb` | `Retail_Sales_Data.csv` | 8 Tasks: Regional total sales, Bar/Pie distribution, Top region ranking, Region x Category matrix, Stacked/Grouped bars. |
|
|
78
|
+
| **13** | Time Series | `13_Time_Series_Analysis.ipynb` | `Stock_Prices.csv` | 8 Tasks: Datetime index, Price/Volume trends, 20/50 SMA & EMA, Seasonality decomposition, Correlation, ARIMA forecast. |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 🐍 Python Library API
|
|
83
|
+
|
|
84
|
+
You can also use this package programmatically inside any Python script:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
import cl1_solutions
|
|
88
|
+
|
|
89
|
+
# List all problem descriptions
|
|
90
|
+
problems = cl1_solutions.list_all_problems()
|
|
91
|
+
for p in problems:
|
|
92
|
+
print(p["id"], p["title"])
|
|
93
|
+
|
|
94
|
+
# Retrieve all notebooks and datasets to a custom folder
|
|
95
|
+
cl1_solutions.retrieve_all(dest_dir="./my_folder")
|
|
96
|
+
|
|
97
|
+
# Retrieve only Problem 6 (Reinforcement Learning)
|
|
98
|
+
cl1_solutions.copy_notebooks("./my_folder", problem_ids=["6"])
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 🚀 Publishing to PyPI (How-To Guide)
|
|
104
|
+
|
|
105
|
+
To publish this package to the Python Package Index (PyPI) under your account:
|
|
106
|
+
|
|
107
|
+
### 1. Build the Package
|
|
108
|
+
```bash
|
|
109
|
+
python -m build
|
|
110
|
+
```
|
|
111
|
+
This generates:
|
|
112
|
+
- Source distribution (`dist/cl1_solutions-1.0.0.tar.gz`)
|
|
113
|
+
- Binary wheel (`dist/cl1_solutions-1.0.0-py3-none-any.whl`)
|
|
114
|
+
|
|
115
|
+
### 2. Verify Archives
|
|
116
|
+
```bash
|
|
117
|
+
twine check dist/*
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 3. Upload to PyPI (Production)
|
|
121
|
+
```bash
|
|
122
|
+
twine upload dist/*
|
|
123
|
+
```
|
|
124
|
+
Enter your PyPI API token (`__token__` and your API token password) when prompted.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 📝 License
|
|
129
|
+
|
|
130
|
+
Distributed under the **MIT License**. Feel free to use, modify, and distribute.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""
|
|
2
|
+
cl1_solutions: All-in-One Retrieval Package for Computational Lab 1 Problem Solutions.
|
|
3
|
+
Includes all 20 individual Jupyter Notebooks and sample datasets.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
__version__ = "1.0.0"
|
|
7
|
+
__author__ = "CL1 Contributor"
|
|
8
|
+
|
|
9
|
+
from .core import (
|
|
10
|
+
PROBLEMS_REGISTRY,
|
|
11
|
+
list_all_problems,
|
|
12
|
+
get_problem_by_id,
|
|
13
|
+
copy_notebooks,
|
|
14
|
+
copy_datasets,
|
|
15
|
+
retrieve_all
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"PROBLEMS_REGISTRY",
|
|
20
|
+
"list_all_problems",
|
|
21
|
+
"get_problem_by_id",
|
|
22
|
+
"copy_notebooks",
|
|
23
|
+
"copy_datasets",
|
|
24
|
+
"retrieve_all",
|
|
25
|
+
]
|
|
26
|
+
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import argparse
|
|
4
|
+
from .core import (
|
|
5
|
+
PROBLEMS_REGISTRY,
|
|
6
|
+
list_all_problems,
|
|
7
|
+
get_problem_by_id,
|
|
8
|
+
copy_notebooks,
|
|
9
|
+
copy_datasets,
|
|
10
|
+
retrieve_all
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
BANNER = r"""
|
|
14
|
+
____ _ _ ____ _
|
|
15
|
+
/ ___| | / | / ___| ___ _ __| |__ ___ _ __
|
|
16
|
+
| | | | | | \___ \ / _ \| '__| '_ \ / _ \ '__|
|
|
17
|
+
| |___| |___| | ___) | (_) | | | |_) | __/ |
|
|
18
|
+
\____|_____|_| |____/ \___/|_| |_.__/ \___|_|
|
|
19
|
+
=====================================================
|
|
20
|
+
Computational Lab 1: All-in-One Problem Solutions (1-13)
|
|
21
|
+
=====================================================
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
def print_table(items):
|
|
25
|
+
print(f"\n{'No.':<4} | {'Category':<24} | {'Notebook / Solution':<38}")
|
|
26
|
+
print("-" * 72)
|
|
27
|
+
for p in items:
|
|
28
|
+
print(f"{p['id']:<4} | {p['category']:<24} | {p['notebook']:<38}")
|
|
29
|
+
print("-" * 72)
|
|
30
|
+
|
|
31
|
+
def cmd_list():
|
|
32
|
+
print(BANNER)
|
|
33
|
+
print("Available Problem Statements & Jupyter Notebooks (1 to 13):\n")
|
|
34
|
+
print_table(PROBLEMS_REGISTRY)
|
|
35
|
+
print(f"\nTotal: {len(PROBLEMS_REGISTRY)} complete problem notebooks available.")
|
|
36
|
+
print("\nTo extract all notebooks and datasets to a folder, run:")
|
|
37
|
+
print(" cl1-get")
|
|
38
|
+
print("or:")
|
|
39
|
+
print(" cl1-get all --dest ./my_solutions\n")
|
|
40
|
+
|
|
41
|
+
def cmd_info(prob_id: str):
|
|
42
|
+
p = get_problem_by_id(prob_id)
|
|
43
|
+
if not p:
|
|
44
|
+
print(f"Error: Problem '{prob_id}' not found. Valid numbers are 1 to 13. Run 'cl1-get list' to view all.")
|
|
45
|
+
return
|
|
46
|
+
print(BANNER)
|
|
47
|
+
print(f"Problem No. : {p['id']}")
|
|
48
|
+
print(f"Category : {p['category']}")
|
|
49
|
+
print(f"Title : {p['title']}")
|
|
50
|
+
print(f"Notebook File : {p['notebook']}")
|
|
51
|
+
print(f"Datasets : {p['dataset']}")
|
|
52
|
+
print(f"Summary : {p['description']}")
|
|
53
|
+
print("\nTo retrieve this notebook, run:")
|
|
54
|
+
print(f" cl1-get {p['id']}\n")
|
|
55
|
+
|
|
56
|
+
def cmd_get_single(prob_id: str, dest: str):
|
|
57
|
+
p = get_problem_by_id(prob_id)
|
|
58
|
+
if not p:
|
|
59
|
+
print(f"Error: Problem '{prob_id}' not found. Valid numbers are 1 to 13.")
|
|
60
|
+
return
|
|
61
|
+
out_dir = os.path.abspath(dest)
|
|
62
|
+
copied = copy_notebooks(out_dir, [p['id']])
|
|
63
|
+
print(f"\nRetrieved Problem {p['id']} ({p['notebook']}):")
|
|
64
|
+
for f in copied:
|
|
65
|
+
print(f" -> Saved to: {os.path.join(out_dir, f)}")
|
|
66
|
+
|
|
67
|
+
# Also copy datasets if needed
|
|
68
|
+
data_dir = os.path.join(out_dir, "datasets")
|
|
69
|
+
copy_datasets(data_dir)
|
|
70
|
+
print(f" -> Datasets copied to: {data_dir}")
|
|
71
|
+
|
|
72
|
+
def cmd_get_all(dest: str, no_data: bool):
|
|
73
|
+
print(BANNER)
|
|
74
|
+
target_dir = os.path.abspath(dest)
|
|
75
|
+
print(f"Extracting all 13 solutions into: {target_dir} ...\n")
|
|
76
|
+
|
|
77
|
+
res = retrieve_all(target_dir, include_datasets=not no_data)
|
|
78
|
+
|
|
79
|
+
print(f"SUCCESS! Extracted {len(res['notebooks'])} Jupyter Notebooks (1 to 13):")
|
|
80
|
+
for nb in res['notebooks']:
|
|
81
|
+
print(f" [+] {nb}")
|
|
82
|
+
|
|
83
|
+
if res['datasets']:
|
|
84
|
+
print(f"\nExtracted {len(res['datasets'])} Datasets:")
|
|
85
|
+
for d in res['datasets']:
|
|
86
|
+
print(f" [*] datasets/{d}")
|
|
87
|
+
|
|
88
|
+
print(f"\nTarget Folder: {target_dir}")
|
|
89
|
+
print("\nNext Steps:")
|
|
90
|
+
print(f" 1. cd {dest}")
|
|
91
|
+
print(" 2. jupyter notebook (or open folder in VS Code / JupyterLab)")
|
|
92
|
+
print(" 3. Run the notebook for the problem statement you need!")
|
|
93
|
+
|
|
94
|
+
def cmd_pypi_help():
|
|
95
|
+
print(BANNER)
|
|
96
|
+
print("""
|
|
97
|
+
HOW TO PUBLISH THIS PACKAGE TO PyPI:
|
|
98
|
+
-----------------------------------
|
|
99
|
+
1. Build distribution archives:
|
|
100
|
+
python -m pip install --upgrade build twine
|
|
101
|
+
python -m build
|
|
102
|
+
|
|
103
|
+
2. Upload to PyPI:
|
|
104
|
+
python -m twine upload dist/*
|
|
105
|
+
(Enter your PyPI API token when prompted)
|
|
106
|
+
|
|
107
|
+
3. Install from any computer:
|
|
108
|
+
pip install cl1-solutions
|
|
109
|
+
|
|
110
|
+
4. Extract all files anytime with one command:
|
|
111
|
+
cl1-get
|
|
112
|
+
""")
|
|
113
|
+
|
|
114
|
+
def main():
|
|
115
|
+
parser = argparse.ArgumentParser(
|
|
116
|
+
description="Retrieve Jupyter Notebook solutions and datasets for all CL1 problem statements (1-13).",
|
|
117
|
+
prog="cl1-get"
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
subparsers = parser.add_subparsers(dest="command", help="Available subcommands")
|
|
121
|
+
|
|
122
|
+
# 'all' subcommand
|
|
123
|
+
all_parser = subparsers.add_parser("all", help="Retrieve all 13 notebooks and datasets (default)")
|
|
124
|
+
all_parser.add_argument("-d", "--dest", default="./cl1_solutions", help="Destination directory (default: ./cl1_solutions)")
|
|
125
|
+
all_parser.add_argument("--no-data", action="store_true", help="Do not include datasets folder")
|
|
126
|
+
|
|
127
|
+
# 'list' subcommand
|
|
128
|
+
subparsers.add_parser("list", help="List all 13 available problem statements")
|
|
129
|
+
|
|
130
|
+
# 'get' subcommand
|
|
131
|
+
get_parser = subparsers.add_parser("get", help="Retrieve specific problem notebook by number (1 to 13)")
|
|
132
|
+
get_parser.add_argument("problem_id", help="Problem Number (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)")
|
|
133
|
+
get_parser.add_argument("-d", "--dest", default="./cl1_solutions", help="Destination directory")
|
|
134
|
+
|
|
135
|
+
# 'info' subcommand
|
|
136
|
+
info_parser = subparsers.add_parser("info", help="View description of a problem statement")
|
|
137
|
+
info_parser.add_argument("problem_id", help="Problem Number (1 to 13)")
|
|
138
|
+
|
|
139
|
+
# 'data' subcommand
|
|
140
|
+
data_parser = subparsers.add_parser("data", help="Retrieve only datasets")
|
|
141
|
+
data_parser.add_argument("-d", "--dest", default="./datasets", help="Destination directory for datasets")
|
|
142
|
+
|
|
143
|
+
# 'pypi-help' subcommand
|
|
144
|
+
subparsers.add_parser("pypi-help", help="Instructions for uploading this package to PyPI")
|
|
145
|
+
|
|
146
|
+
# Optional root arguments for default shorthand usage: e.g. "cl1-get" or "cl1-get 6" or "cl1-get -d ./my_dir"
|
|
147
|
+
parser.add_argument("-d", "--dest", default="./cl1_solutions", help="Destination directory (default: ./cl1_solutions)")
|
|
148
|
+
parser.add_argument("--no-data", action="store_true", help="Do not copy datasets")
|
|
149
|
+
parser.add_argument("shortcut", nargs="?", default=None, help="Shortcut: 'all', 'list', or a problem number like '1', '6', '13'")
|
|
150
|
+
|
|
151
|
+
# Parse arguments
|
|
152
|
+
args = parser.parse_args()
|
|
153
|
+
|
|
154
|
+
if args.command == "list" or args.shortcut == "list":
|
|
155
|
+
cmd_list()
|
|
156
|
+
elif args.command == "info":
|
|
157
|
+
cmd_info(args.problem_id)
|
|
158
|
+
elif args.command == "data":
|
|
159
|
+
target = os.path.abspath(args.dest)
|
|
160
|
+
copied = copy_datasets(target)
|
|
161
|
+
print(f"Extracted {len(copied)} datasets to: {target}")
|
|
162
|
+
elif args.command == "pypi-help" or args.shortcut == "pypi-help":
|
|
163
|
+
cmd_pypi_help()
|
|
164
|
+
elif args.command == "get":
|
|
165
|
+
cmd_get_single(args.problem_id, args.dest)
|
|
166
|
+
elif args.shortcut and args.shortcut.lstrip("#") in [p['id'] for p in PROBLEMS_REGISTRY]:
|
|
167
|
+
cmd_get_single(args.shortcut, args.dest)
|
|
168
|
+
else:
|
|
169
|
+
# Default action: extract all!
|
|
170
|
+
dest = args.dest if hasattr(args, 'dest') else "./cl1_solutions"
|
|
171
|
+
no_data = args.no_data if hasattr(args, 'no_data') else False
|
|
172
|
+
cmd_get_all(dest, no_data)
|
|
173
|
+
|
|
174
|
+
if __name__ == "__main__":
|
|
175
|
+
main()
|