soham-py 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- soham_py-0.1.0/LICENSE +22 -0
- soham_py-0.1.0/PKG-INFO +233 -0
- soham_py-0.1.0/README.md +206 -0
- soham_py-0.1.0/pyproject.toml +48 -0
- soham_py-0.1.0/setup.cfg +4 -0
- soham_py-0.1.0/src/soham_py/__init__.py +102 -0
- soham_py-0.1.0/src/soham_py/core.py +137 -0
- soham_py-0.1.0/src/soham_py/practicals/__init__.py +0 -0
- soham_py-0.1.0/src/soham_py/practicals/dbms/__init__.py +1 -0
- soham_py-0.1.0/src/soham_py/practicals/dbms/practical1.txt +1 -0
- soham_py-0.1.0/src/soham_py/practicals/dbms/practical10.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/dbms/practical2.txt +1 -0
- soham_py-0.1.0/src/soham_py/practicals/dbms/practical3.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/dbms/practical4.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/dbms/practical5.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/dbms/practical6.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/dbms/practical7.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/dbms/practical8.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/dbms/practical9.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/ds/__init__.py +1 -0
- soham_py-0.1.0/src/soham_py/practicals/ds/practical1.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/ds/practical10.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/ds/practical2.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/ds/practical3.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/ds/practical4.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/ds/practical5.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/ds/practical6.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/ds/practical7.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/ds/practical8.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/ds/practical9.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/wt/__init__.py +1 -0
- soham_py-0.1.0/src/soham_py/practicals/wt/practical1.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/wt/practical10.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/wt/practical2.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/wt/practical3.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/wt/practical4.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/wt/practical5.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/wt/practical6.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/wt/practical7.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/wt/practical8.txt +0 -0
- soham_py-0.1.0/src/soham_py/practicals/wt/practical9.txt +0 -0
- soham_py-0.1.0/src/soham_py/saver.py +60 -0
- soham_py-0.1.0/src/soham_py/search.py +77 -0
- soham_py-0.1.0/src/soham_py/subjects.py +74 -0
- soham_py-0.1.0/src/soham_py.egg-info/PKG-INFO +233 -0
- soham_py-0.1.0/src/soham_py.egg-info/SOURCES.txt +51 -0
- soham_py-0.1.0/src/soham_py.egg-info/dependency_links.txt +1 -0
- soham_py-0.1.0/src/soham_py.egg-info/requires.txt +4 -0
- soham_py-0.1.0/src/soham_py.egg-info/top_level.txt +1 -0
- soham_py-0.1.0/tests/test_api.py +92 -0
- soham_py-0.1.0/tests/test_core.py +261 -0
- soham_py-0.1.0/tests/test_saver.py +168 -0
- soham_py-0.1.0/tests/test_search.py +213 -0
soham_py-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Soham Pandit
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
soham_py-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: soham-py
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: College practical programs stored as plain text — retrieve them with a simple Python import.
|
|
5
|
+
Author: Soham Pandit
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Soham117Pandit/soham-py
|
|
8
|
+
Project-URL: Issues, https://github.com/Soham117Pandit/soham-py/issues
|
|
9
|
+
Keywords: practicals,college,data-science,web-technology,dbms
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Education
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Education
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
25
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# SohamPy
|
|
29
|
+
|
|
30
|
+
**College practical programs stored as plain text — retrieve them with a simple Python import.**
|
|
31
|
+
|
|
32
|
+
SohamPy is a lightweight Python package that bundles college practical programs for three subjects as plain `.txt` files. Once installed, you can retrieve any practical from any computer using a simple import statement — no internet connection required after installation.
|
|
33
|
+
|
|
34
|
+
> **Important:** SohamPy stores and returns source code as **plain text**. It never executes the stored code.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Supported Subjects
|
|
39
|
+
|
|
40
|
+
| Key | Subject | Practicals |
|
|
41
|
+
|--------|------------------------------|------------|
|
|
42
|
+
| `ds` | Data Science | 10 |
|
|
43
|
+
| `wt` | Web Technology | 10 |
|
|
44
|
+
| `dbms` | Database Management Systems | 10 |
|
|
45
|
+
|
|
46
|
+
**Total: 30 practical files.**
|
|
47
|
+
|
|
48
|
+
> **Note:** SQL, MySQL, and MongoDB are topics within DBMS — they are not separate subjects.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install soham-py
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
After installation, the package works **completely offline**. Internet is only needed for the initial install and future updates.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Quick Start
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
import soham_py
|
|
66
|
+
|
|
67
|
+
# Retrieve a Data Science practical
|
|
68
|
+
print(soham_py.ds(1))
|
|
69
|
+
|
|
70
|
+
# Retrieve a Web Technology practical
|
|
71
|
+
print(soham_py.wt(1))
|
|
72
|
+
|
|
73
|
+
# Retrieve a DBMS practical
|
|
74
|
+
print(soham_py.dbms(1))
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Available Functions
|
|
80
|
+
|
|
81
|
+
### Retrieve a Practical
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
soham_py.ds(1) # Data Science practical 1
|
|
85
|
+
soham_py.wt(5) # Web Technology practical 5
|
|
86
|
+
soham_py.dbms(10) # DBMS practical 10
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Returns the complete contents of the `.txt` file as a Python string. Empty files return `""`.
|
|
90
|
+
|
|
91
|
+
### List Practicals
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
soham_py.list_practicals("ds")
|
|
95
|
+
# [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
|
96
|
+
|
|
97
|
+
soham_py.list_practicals("wt")
|
|
98
|
+
soham_py.list_practicals("dbms")
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Show Subjects
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
soham_py.subjects()
|
|
105
|
+
# [('dbms', 'Database Management Systems'),
|
|
106
|
+
# ('ds', 'Data Science'),
|
|
107
|
+
# ('wt', 'Web Technology')]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Search Practicals
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
soham_py.search("regression")
|
|
114
|
+
soham_py.search("database")
|
|
115
|
+
soham_py.search("HTML")
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
- Searches all three subjects.
|
|
119
|
+
- Case-insensitive.
|
|
120
|
+
- Skips empty files.
|
|
121
|
+
- Returns a list of `{"subject", "practical", "snippet"}` dicts.
|
|
122
|
+
- Returns `[]` when there are no matches.
|
|
123
|
+
- Raises `ValueError` for empty or whitespace-only queries.
|
|
124
|
+
|
|
125
|
+
### Save a Practical to a File
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
soham_py.save("ds", 1, "practical1.txt")
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
- Saves the practical contents to a local file.
|
|
132
|
+
- Uses UTF-8 encoding.
|
|
133
|
+
- Preserves the original text exactly.
|
|
134
|
+
- You can choose any output filename.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Subject Aliases
|
|
139
|
+
|
|
140
|
+
You can use alternative names for subjects:
|
|
141
|
+
|
|
142
|
+
| Alias | Resolves To |
|
|
143
|
+
|--------------------|-------------|
|
|
144
|
+
| `ds` | `ds` |
|
|
145
|
+
| `data_science` | `ds` |
|
|
146
|
+
| `wt` | `wt` |
|
|
147
|
+
| `web` | `wt` |
|
|
148
|
+
| `web_technology` | `wt` |
|
|
149
|
+
| `dbms` | `dbms` |
|
|
150
|
+
| `database` | `dbms` |
|
|
151
|
+
|
|
152
|
+
All aliases are **case-insensitive**.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Adding Your Practical Programs
|
|
157
|
+
|
|
158
|
+
All 30 practical files are **initially empty**. To add your code:
|
|
159
|
+
|
|
160
|
+
1. Find the package source in `src/soham_py/practicals/`.
|
|
161
|
+
2. Open the appropriate `.txt` file (e.g., `ds/practical1.txt`).
|
|
162
|
+
3. Paste your practical program as plain text.
|
|
163
|
+
4. Rebuild and reinstall the package.
|
|
164
|
+
|
|
165
|
+
```text
|
|
166
|
+
src/soham_py/practicals/
|
|
167
|
+
├── ds/
|
|
168
|
+
│ ├── practical1.txt ← Add your DS practical 1 code here
|
|
169
|
+
│ ├── practical2.txt
|
|
170
|
+
│ └── ...
|
|
171
|
+
├── wt/
|
|
172
|
+
│ ├── practical1.txt ← Add your WT practical 1 code here
|
|
173
|
+
│ └── ...
|
|
174
|
+
└── dbms/
|
|
175
|
+
├── practical1.txt ← Add your DBMS practical 1 code here
|
|
176
|
+
└── ...
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
> **Note:** After modifying practicals in a published package, you must create a new version and upgrade via `pip install --upgrade soham-py` for the changes to take effect on other computers.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Error Handling
|
|
184
|
+
|
|
185
|
+
| Situation | Error Raised |
|
|
186
|
+
|--------------------------|---------------------|
|
|
187
|
+
| Invalid subject name | `ValueError` |
|
|
188
|
+
| Invalid practical number | `ValueError` |
|
|
189
|
+
| Missing practical file | `FileNotFoundError` |
|
|
190
|
+
| Empty search query | `ValueError` |
|
|
191
|
+
| Empty practical file | Returns `""` (no error) |
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Development
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# Clone the repository
|
|
199
|
+
git clone https://github.com/soham-pandit/soham-py.git
|
|
200
|
+
cd soham-py
|
|
201
|
+
|
|
202
|
+
# Install in editable mode with dev dependencies
|
|
203
|
+
pip install -e ".[dev]"
|
|
204
|
+
|
|
205
|
+
# Run tests
|
|
206
|
+
pytest -v
|
|
207
|
+
|
|
208
|
+
# Build distributions
|
|
209
|
+
python -m build
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Contributing
|
|
215
|
+
|
|
216
|
+
1. Fork the repository.
|
|
217
|
+
2. Create a feature branch.
|
|
218
|
+
3. Make your changes.
|
|
219
|
+
4. Run the tests.
|
|
220
|
+
5. Submit a pull request.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## License
|
|
225
|
+
|
|
226
|
+
This project is licensed under the **MIT License** — see the [LICENSE](LICENSE) file for details.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Author
|
|
231
|
+
|
|
232
|
+
**Soham Pandit**
|
|
233
|
+
|
soham_py-0.1.0/README.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# SohamPy
|
|
2
|
+
|
|
3
|
+
**College practical programs stored as plain text — retrieve them with a simple Python import.**
|
|
4
|
+
|
|
5
|
+
SohamPy is a lightweight Python package that bundles college practical programs for three subjects as plain `.txt` files. Once installed, you can retrieve any practical from any computer using a simple import statement — no internet connection required after installation.
|
|
6
|
+
|
|
7
|
+
> **Important:** SohamPy stores and returns source code as **plain text**. It never executes the stored code.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Supported Subjects
|
|
12
|
+
|
|
13
|
+
| Key | Subject | Practicals |
|
|
14
|
+
|--------|------------------------------|------------|
|
|
15
|
+
| `ds` | Data Science | 10 |
|
|
16
|
+
| `wt` | Web Technology | 10 |
|
|
17
|
+
| `dbms` | Database Management Systems | 10 |
|
|
18
|
+
|
|
19
|
+
**Total: 30 practical files.**
|
|
20
|
+
|
|
21
|
+
> **Note:** SQL, MySQL, and MongoDB are topics within DBMS — they are not separate subjects.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install soham-py
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
After installation, the package works **completely offline**. Internet is only needed for the initial install and future updates.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
import soham_py
|
|
39
|
+
|
|
40
|
+
# Retrieve a Data Science practical
|
|
41
|
+
print(soham_py.ds(1))
|
|
42
|
+
|
|
43
|
+
# Retrieve a Web Technology practical
|
|
44
|
+
print(soham_py.wt(1))
|
|
45
|
+
|
|
46
|
+
# Retrieve a DBMS practical
|
|
47
|
+
print(soham_py.dbms(1))
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Available Functions
|
|
53
|
+
|
|
54
|
+
### Retrieve a Practical
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
soham_py.ds(1) # Data Science practical 1
|
|
58
|
+
soham_py.wt(5) # Web Technology practical 5
|
|
59
|
+
soham_py.dbms(10) # DBMS practical 10
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Returns the complete contents of the `.txt` file as a Python string. Empty files return `""`.
|
|
63
|
+
|
|
64
|
+
### List Practicals
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
soham_py.list_practicals("ds")
|
|
68
|
+
# [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
|
69
|
+
|
|
70
|
+
soham_py.list_practicals("wt")
|
|
71
|
+
soham_py.list_practicals("dbms")
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Show Subjects
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
soham_py.subjects()
|
|
78
|
+
# [('dbms', 'Database Management Systems'),
|
|
79
|
+
# ('ds', 'Data Science'),
|
|
80
|
+
# ('wt', 'Web Technology')]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Search Practicals
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
soham_py.search("regression")
|
|
87
|
+
soham_py.search("database")
|
|
88
|
+
soham_py.search("HTML")
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
- Searches all three subjects.
|
|
92
|
+
- Case-insensitive.
|
|
93
|
+
- Skips empty files.
|
|
94
|
+
- Returns a list of `{"subject", "practical", "snippet"}` dicts.
|
|
95
|
+
- Returns `[]` when there are no matches.
|
|
96
|
+
- Raises `ValueError` for empty or whitespace-only queries.
|
|
97
|
+
|
|
98
|
+
### Save a Practical to a File
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
soham_py.save("ds", 1, "practical1.txt")
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- Saves the practical contents to a local file.
|
|
105
|
+
- Uses UTF-8 encoding.
|
|
106
|
+
- Preserves the original text exactly.
|
|
107
|
+
- You can choose any output filename.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Subject Aliases
|
|
112
|
+
|
|
113
|
+
You can use alternative names for subjects:
|
|
114
|
+
|
|
115
|
+
| Alias | Resolves To |
|
|
116
|
+
|--------------------|-------------|
|
|
117
|
+
| `ds` | `ds` |
|
|
118
|
+
| `data_science` | `ds` |
|
|
119
|
+
| `wt` | `wt` |
|
|
120
|
+
| `web` | `wt` |
|
|
121
|
+
| `web_technology` | `wt` |
|
|
122
|
+
| `dbms` | `dbms` |
|
|
123
|
+
| `database` | `dbms` |
|
|
124
|
+
|
|
125
|
+
All aliases are **case-insensitive**.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Adding Your Practical Programs
|
|
130
|
+
|
|
131
|
+
All 30 practical files are **initially empty**. To add your code:
|
|
132
|
+
|
|
133
|
+
1. Find the package source in `src/soham_py/practicals/`.
|
|
134
|
+
2. Open the appropriate `.txt` file (e.g., `ds/practical1.txt`).
|
|
135
|
+
3. Paste your practical program as plain text.
|
|
136
|
+
4. Rebuild and reinstall the package.
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
src/soham_py/practicals/
|
|
140
|
+
├── ds/
|
|
141
|
+
│ ├── practical1.txt ← Add your DS practical 1 code here
|
|
142
|
+
│ ├── practical2.txt
|
|
143
|
+
│ └── ...
|
|
144
|
+
├── wt/
|
|
145
|
+
│ ├── practical1.txt ← Add your WT practical 1 code here
|
|
146
|
+
│ └── ...
|
|
147
|
+
└── dbms/
|
|
148
|
+
├── practical1.txt ← Add your DBMS practical 1 code here
|
|
149
|
+
└── ...
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
> **Note:** After modifying practicals in a published package, you must create a new version and upgrade via `pip install --upgrade soham-py` for the changes to take effect on other computers.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Error Handling
|
|
157
|
+
|
|
158
|
+
| Situation | Error Raised |
|
|
159
|
+
|--------------------------|---------------------|
|
|
160
|
+
| Invalid subject name | `ValueError` |
|
|
161
|
+
| Invalid practical number | `ValueError` |
|
|
162
|
+
| Missing practical file | `FileNotFoundError` |
|
|
163
|
+
| Empty search query | `ValueError` |
|
|
164
|
+
| Empty practical file | Returns `""` (no error) |
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Development
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Clone the repository
|
|
172
|
+
git clone https://github.com/soham-pandit/soham-py.git
|
|
173
|
+
cd soham-py
|
|
174
|
+
|
|
175
|
+
# Install in editable mode with dev dependencies
|
|
176
|
+
pip install -e ".[dev]"
|
|
177
|
+
|
|
178
|
+
# Run tests
|
|
179
|
+
pytest -v
|
|
180
|
+
|
|
181
|
+
# Build distributions
|
|
182
|
+
python -m build
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Contributing
|
|
188
|
+
|
|
189
|
+
1. Fork the repository.
|
|
190
|
+
2. Create a feature branch.
|
|
191
|
+
3. Make your changes.
|
|
192
|
+
4. Run the tests.
|
|
193
|
+
5. Submit a pull request.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## License
|
|
198
|
+
|
|
199
|
+
This project is licensed under the **MIT License** — see the [LICENSE](LICENSE) file for details.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Author
|
|
204
|
+
|
|
205
|
+
**Soham Pandit**
|
|
206
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "soham-py"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "College practical programs stored as plain text — retrieve them with a simple Python import."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Soham Pandit"},
|
|
14
|
+
]
|
|
15
|
+
keywords = ["practicals", "college", "data-science", "web-technology", "dbms"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Education",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.9",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Topic :: Education",
|
|
26
|
+
"Operating System :: OS Independent",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
dev = [
|
|
31
|
+
"pytest>=7.0",
|
|
32
|
+
"build>=1.0",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://github.com/Soham117Pandit/soham-py"
|
|
37
|
+
Issues = "https://github.com/Soham117Pandit/soham-py/issues"
|
|
38
|
+
|
|
39
|
+
[tool.setuptools.packages.find]
|
|
40
|
+
where = ["src"]
|
|
41
|
+
|
|
42
|
+
[tool.setuptools.package-data]
|
|
43
|
+
"soham_py.practicals.ds" = ["*.txt"]
|
|
44
|
+
"soham_py.practicals.wt" = ["*.txt"]
|
|
45
|
+
"soham_py.practicals.dbms" = ["*.txt"]
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
testpaths = ["tests"]
|
soham_py-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"""SohamPy — College practical programs as importable plain text.
|
|
2
|
+
|
|
3
|
+
A lightweight Python package that bundles college practical programs
|
|
4
|
+
for three subjects (DS, WT, DBMS) as plain ``.txt`` files and lets
|
|
5
|
+
you retrieve them with a simple import.
|
|
6
|
+
|
|
7
|
+
**No stored code is ever executed.**
|
|
8
|
+
|
|
9
|
+
Quick start::
|
|
10
|
+
|
|
11
|
+
import soham_py
|
|
12
|
+
|
|
13
|
+
print(soham_py.ds(1))
|
|
14
|
+
print(soham_py.wt(1))
|
|
15
|
+
print(soham_py.dbms(1))
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
from typing import Dict, List, Tuple
|
|
21
|
+
|
|
22
|
+
from .core import get_practical, list_practicals
|
|
23
|
+
from .search import search
|
|
24
|
+
from .saver import save
|
|
25
|
+
from .subjects import get_subjects
|
|
26
|
+
|
|
27
|
+
__version__ = "0.1.0"
|
|
28
|
+
__author__ = "Soham Pandit"
|
|
29
|
+
__all__ = [
|
|
30
|
+
"ds",
|
|
31
|
+
"wt",
|
|
32
|
+
"dbms",
|
|
33
|
+
"list_practicals",
|
|
34
|
+
"subjects",
|
|
35
|
+
"search",
|
|
36
|
+
"save",
|
|
37
|
+
"get_practical",
|
|
38
|
+
"__version__",
|
|
39
|
+
"__author__",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# ── Convenience functions ───────────────────────────────────────────
|
|
44
|
+
|
|
45
|
+
def ds(number: int) -> str:
|
|
46
|
+
"""Return the contents of a Data Science practical.
|
|
47
|
+
|
|
48
|
+
Parameters
|
|
49
|
+
----------
|
|
50
|
+
number : int
|
|
51
|
+
Practical number (1–10).
|
|
52
|
+
|
|
53
|
+
Returns
|
|
54
|
+
-------
|
|
55
|
+
str
|
|
56
|
+
Plain-text contents of the practical file.
|
|
57
|
+
"""
|
|
58
|
+
return get_practical("ds", number)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def wt(number: int) -> str:
|
|
62
|
+
"""Return the contents of a Web Technology practical.
|
|
63
|
+
|
|
64
|
+
Parameters
|
|
65
|
+
----------
|
|
66
|
+
number : int
|
|
67
|
+
Practical number (1–10).
|
|
68
|
+
|
|
69
|
+
Returns
|
|
70
|
+
-------
|
|
71
|
+
str
|
|
72
|
+
Plain-text contents of the practical file.
|
|
73
|
+
"""
|
|
74
|
+
return get_practical("wt", number)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def dbms(number: int) -> str:
|
|
78
|
+
"""Return the contents of a DBMS practical.
|
|
79
|
+
|
|
80
|
+
Parameters
|
|
81
|
+
----------
|
|
82
|
+
number : int
|
|
83
|
+
Practical number (1–10).
|
|
84
|
+
|
|
85
|
+
Returns
|
|
86
|
+
-------
|
|
87
|
+
str
|
|
88
|
+
Plain-text contents of the practical file.
|
|
89
|
+
"""
|
|
90
|
+
return get_practical("dbms", number)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def subjects() -> List[Tuple[str, str]]:
|
|
94
|
+
"""Return the three primary subjects and their descriptions.
|
|
95
|
+
|
|
96
|
+
Returns
|
|
97
|
+
-------
|
|
98
|
+
list of tuple
|
|
99
|
+
``[(key, description), ...]`` sorted alphabetically.
|
|
100
|
+
"""
|
|
101
|
+
return get_subjects()
|
|
102
|
+
|