dulab 1.0.1__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.
dulab-1.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Prateek Yadav
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.
dulab-1.0.1/PKG-INFO ADDED
@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: dulab
3
+ Version: 1.0.1
4
+ Summary: Operating Systems and Data Structures lab practicals in C++: save programs to a roll-number folder on your Desktop, and run the Linux command practicals in a new terminal
5
+ Author: Prateek Yadav
6
+ License-Expression: MIT
7
+ Keywords: operating systems,data structures,lab,practicals,linux commands,students
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: C++
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Education
13
+ Classifier: Topic :: Education
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Dynamic: license-file
18
+
19
+ # dulab
20
+
21
+ Lab practicals for **Operating Systems (DSC08)** and **Data Structures**.
22
+
23
+ - **Programs:** pick one from the menu and type your roll number. The program is
24
+ saved to a folder named after your roll number on your Desktop, ready to compile.
25
+ - **Linux command practicals (OS 2 and 3):** a new terminal window opens and runs
26
+ every command, one after another, with sample files to work on.
27
+
28
+ All programs are in C++.
29
+
30
+ ```
31
+ Desktop/
32
+ └── 23CS045/
33
+ ├── os08_fcfs.cpp
34
+ ├── os11_pthread_sum.cpp
35
+ ├── ds06_binary_search_tree.cpp
36
+ └── ...
37
+ ```
38
+
39
+ ## Install
40
+
41
+ ```bash
42
+ pip install dulab
43
+ ```
44
+
45
+ Requires Python 3.8 or newer. To compile the programs you need `g++`
46
+ (on Ubuntu: `sudo apt install build-essential`).
47
+
48
+ ## Use
49
+
50
+ ```bash
51
+ dulab
52
+ ```
53
+
54
+ ```
55
+ ================================================================
56
+ DULAB v1.0.1 OS and DS lab practicals
57
+ ================================================================
58
+
59
+ 1. Operating Systems (DSC08) - C++ programs + Linux commands
60
+ 2. Data Structures - C++ programs
61
+ Q. Quit
62
+
63
+ Choose a subject (1, 2, Q): 1
64
+
65
+ OPERATING SYSTEMS (DSC08) (C++)
66
+ 2. Linux commands: information, file and directory management [opens a terminal]
67
+ 3. Linux commands: process control, communication, protection [opens a terminal]
68
+ 4. fork(): same code, different code, parent waits
69
+ ...
70
+ 12. First-fit, best-fit and worst-fit allocation
71
+
72
+ Choose (2-12, A, B, Q): 8
73
+ Enter your roll number: 23CS045
74
+ Saved: /home/you/Desktop/23CS045/os08_fcfs.cpp
75
+
76
+ To compile and run:
77
+ cd "/home/you/Desktop/23CS045"
78
+ g++ os08_fcfs.cpp -o os08_fcfs
79
+ ./os08_fcfs
80
+ ```
81
+
82
+ If Windows says `'dulab' is not recognized`, run `python -m dulab` instead.
83
+
84
+ ### Shortcuts
85
+
86
+ | Command | What it does |
87
+ |---|---|
88
+ | `dulab` | Interactive menu |
89
+ | `dulab --list` | List every practical |
90
+ | `dulab os8 -r 23CS045` | Save OS practical 8 for roll number 23CS045 |
91
+ | `dulab ds -r 23CS045` | Save all DS programs (`os` for all OS, `all` for both) |
92
+ | `dulab os2` | Open a terminal and run all of OS practical 2 |
93
+ | `dulab os3ii` | Run only part (ii) of OS practical 3 |
94
+ | `dulab os2 --here` | Run the commands in the current window |
95
+ | `dulab --show ds4` | Print a program's code |
96
+ | `dulab ... --dir PATH` | Save somewhere other than the Desktop |
97
+ | `dulab ... -f` | Overwrite existing files without asking |
98
+
99
+ ## Practicals
100
+
101
+ **Operating Systems (DSC08)** (practical 1, the OS simulator, is not included)
102
+
103
+ | No. | Practical | Output |
104
+ |---|---|---|
105
+ | 2 | Linux commands: wc, clear, cal, who, date, pwd / cat, cp, rm, mv, cmp, comm, diff, find, grep, awk / cd, mkdir, rmdir, ls | terminal |
106
+ | 3 | Linux commands: fork, getpid, ps, kill, sleep / redirection, pipes / chmod, chown, chgrp | terminal |
107
+ | 4 | fork(): same program same code, same program different code, parent waits for child | 3 programs |
108
+ | 5 | Kernel version, CPU type and CPU information | program |
109
+ | 6 | Configured, free and used memory | program |
110
+ | 7 | Copy a file using system calls | program |
111
+ | 8 | FCFS scheduling | program |
112
+ | 9 | SJF scheduling (non-preemptive) | program |
113
+ | 10 | Non-preemptive priority scheduling | program |
114
+ | 11 | Sum of n numbers using Pthreads | program |
115
+ | 12 | First-fit, best-fit and worst-fit allocation | program |
116
+
117
+ **Data Structures**
118
+
119
+ | No. | Practical |
120
+ |---|---|
121
+ | 1 | Singly linked list ADT |
122
+ | 2 | Doubly linked list ADT |
123
+ | 3 | Circular linked list ADT |
124
+ | 4 | Stack ADT: evaluate prefix and postfix expressions |
125
+ | 5 | Queue ADT |
126
+ | 6 | Binary search tree: insert, delete, search, traversals |
127
+ | 7 | AVL tree: insert and search |
128
+
129
+ ## Linux commands on Windows and macOS
130
+
131
+ - **Windows:** the commands run in WSL. If you don't have it, open PowerShell as
132
+ Administrator, run `wsl --install`, restart, and finish the Ubuntu setup.
133
+ - **macOS:** the commands open in Terminal.app. A few options differ slightly from Linux.
134
+ - **No desktop (e.g. over SSH):** dulab offers to run the commands in the current window.
135
+
136
+ ## Use from Python
137
+
138
+ ```python
139
+ import dulab
140
+
141
+ print(dulab.get_code("os8"))
142
+ for item in dulab.SUBJECTS["ds"]["items"]:
143
+ print(item["id"], item["title"])
144
+ ```
145
+
146
+ ## License
147
+
148
+ MIT
dulab-1.0.1/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # dulab
2
+
3
+ Lab practicals for **Operating Systems (DSC08)** and **Data Structures**.
4
+
5
+ - **Programs:** pick one from the menu and type your roll number. The program is
6
+ saved to a folder named after your roll number on your Desktop, ready to compile.
7
+ - **Linux command practicals (OS 2 and 3):** a new terminal window opens and runs
8
+ every command, one after another, with sample files to work on.
9
+
10
+ All programs are in C++.
11
+
12
+ ```
13
+ Desktop/
14
+ └── 23CS045/
15
+ ├── os08_fcfs.cpp
16
+ ├── os11_pthread_sum.cpp
17
+ ├── ds06_binary_search_tree.cpp
18
+ └── ...
19
+ ```
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ pip install dulab
25
+ ```
26
+
27
+ Requires Python 3.8 or newer. To compile the programs you need `g++`
28
+ (on Ubuntu: `sudo apt install build-essential`).
29
+
30
+ ## Use
31
+
32
+ ```bash
33
+ dulab
34
+ ```
35
+
36
+ ```
37
+ ================================================================
38
+ DULAB v1.0.1 OS and DS lab practicals
39
+ ================================================================
40
+
41
+ 1. Operating Systems (DSC08) - C++ programs + Linux commands
42
+ 2. Data Structures - C++ programs
43
+ Q. Quit
44
+
45
+ Choose a subject (1, 2, Q): 1
46
+
47
+ OPERATING SYSTEMS (DSC08) (C++)
48
+ 2. Linux commands: information, file and directory management [opens a terminal]
49
+ 3. Linux commands: process control, communication, protection [opens a terminal]
50
+ 4. fork(): same code, different code, parent waits
51
+ ...
52
+ 12. First-fit, best-fit and worst-fit allocation
53
+
54
+ Choose (2-12, A, B, Q): 8
55
+ Enter your roll number: 23CS045
56
+ Saved: /home/you/Desktop/23CS045/os08_fcfs.cpp
57
+
58
+ To compile and run:
59
+ cd "/home/you/Desktop/23CS045"
60
+ g++ os08_fcfs.cpp -o os08_fcfs
61
+ ./os08_fcfs
62
+ ```
63
+
64
+ If Windows says `'dulab' is not recognized`, run `python -m dulab` instead.
65
+
66
+ ### Shortcuts
67
+
68
+ | Command | What it does |
69
+ |---|---|
70
+ | `dulab` | Interactive menu |
71
+ | `dulab --list` | List every practical |
72
+ | `dulab os8 -r 23CS045` | Save OS practical 8 for roll number 23CS045 |
73
+ | `dulab ds -r 23CS045` | Save all DS programs (`os` for all OS, `all` for both) |
74
+ | `dulab os2` | Open a terminal and run all of OS practical 2 |
75
+ | `dulab os3ii` | Run only part (ii) of OS practical 3 |
76
+ | `dulab os2 --here` | Run the commands in the current window |
77
+ | `dulab --show ds4` | Print a program's code |
78
+ | `dulab ... --dir PATH` | Save somewhere other than the Desktop |
79
+ | `dulab ... -f` | Overwrite existing files without asking |
80
+
81
+ ## Practicals
82
+
83
+ **Operating Systems (DSC08)** (practical 1, the OS simulator, is not included)
84
+
85
+ | No. | Practical | Output |
86
+ |---|---|---|
87
+ | 2 | Linux commands: wc, clear, cal, who, date, pwd / cat, cp, rm, mv, cmp, comm, diff, find, grep, awk / cd, mkdir, rmdir, ls | terminal |
88
+ | 3 | Linux commands: fork, getpid, ps, kill, sleep / redirection, pipes / chmod, chown, chgrp | terminal |
89
+ | 4 | fork(): same program same code, same program different code, parent waits for child | 3 programs |
90
+ | 5 | Kernel version, CPU type and CPU information | program |
91
+ | 6 | Configured, free and used memory | program |
92
+ | 7 | Copy a file using system calls | program |
93
+ | 8 | FCFS scheduling | program |
94
+ | 9 | SJF scheduling (non-preemptive) | program |
95
+ | 10 | Non-preemptive priority scheduling | program |
96
+ | 11 | Sum of n numbers using Pthreads | program |
97
+ | 12 | First-fit, best-fit and worst-fit allocation | program |
98
+
99
+ **Data Structures**
100
+
101
+ | No. | Practical |
102
+ |---|---|
103
+ | 1 | Singly linked list ADT |
104
+ | 2 | Doubly linked list ADT |
105
+ | 3 | Circular linked list ADT |
106
+ | 4 | Stack ADT: evaluate prefix and postfix expressions |
107
+ | 5 | Queue ADT |
108
+ | 6 | Binary search tree: insert, delete, search, traversals |
109
+ | 7 | AVL tree: insert and search |
110
+
111
+ ## Linux commands on Windows and macOS
112
+
113
+ - **Windows:** the commands run in WSL. If you don't have it, open PowerShell as
114
+ Administrator, run `wsl --install`, restart, and finish the Ubuntu setup.
115
+ - **macOS:** the commands open in Terminal.app. A few options differ slightly from Linux.
116
+ - **No desktop (e.g. over SSH):** dulab offers to run the commands in the current window.
117
+
118
+ ## Use from Python
119
+
120
+ ```python
121
+ import dulab
122
+
123
+ print(dulab.get_code("os8"))
124
+ for item in dulab.SUBJECTS["ds"]["items"]:
125
+ print(item["id"], item["title"])
126
+ ```
127
+
128
+ ## License
129
+
130
+ MIT
@@ -0,0 +1,31 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "dulab"
7
+ dynamic = ["version"]
8
+ description = "Operating Systems and Data Structures lab practicals in C++: save programs to a roll-number folder on your Desktop, and run the Linux command practicals in a new terminal"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "Prateek Yadav" }]
14
+ keywords = ["operating systems", "data structures", "lab", "practicals", "linux commands", "students"]
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: C++",
18
+ "Operating System :: OS Independent",
19
+ "Environment :: Console",
20
+ "Intended Audience :: Education",
21
+ "Topic :: Education",
22
+ ]
23
+
24
+ [project.scripts]
25
+ dulab = "dulab.cli:main"
26
+
27
+ [tool.setuptools.packages.find]
28
+ where = ["src"]
29
+
30
+ [tool.setuptools.dynamic]
31
+ version = { attr = "dulab.__version__" }
dulab-1.0.1/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,67 @@
1
+ """dulab - Operating Systems and Data Structures lab practicals in C++.
2
+
3
+ Run ``dulab`` (or ``python -m dulab``) for the menu.
4
+
5
+ From Python:
6
+
7
+ >>> import dulab
8
+ >>> print(dulab.get_code("os8")) # FCFS scheduling program
9
+ """
10
+
11
+ from .commands import PARTS, QUESTION_PARTS
12
+ from .ds_programs import DS_PROGRAMS
13
+ from .os_programs import OS_PROGRAMS
14
+
15
+ __version__ = "1.0.1"
16
+ __all__ = ["SUBJECTS", "get", "get_code", "__version__"]
17
+
18
+ OS_COMMANDS = [
19
+ {
20
+ "id": "os2",
21
+ "subject": "os",
22
+ "number": 2,
23
+ "kind": "commands",
24
+ "title": "Linux commands: information, file and directory management",
25
+ "aim": "Execute various LINUX commands for: (i) Information Maintenance: wc, clear, cal, who, "
26
+ "date, pwd; (ii) File Management: cat, cp, rm, mv, cmp, comm, diff, find, grep, awk; "
27
+ "(iii) Directory Management: cd, mkdir, rmdir, ls.",
28
+ "parts": QUESTION_PARTS["2"],
29
+ },
30
+ {
31
+ "id": "os3",
32
+ "subject": "os",
33
+ "number": 3,
34
+ "kind": "commands",
35
+ "title": "Linux commands: process control, communication, protection",
36
+ "aim": "Execute various LINUX commands for: (i) Process Control: fork, getpid, ps, kill, sleep; "
37
+ "(ii) Communication: input-output redirection, pipe; "
38
+ "(iii) Protection Management: chmod, chown, chgrp.",
39
+ "parts": QUESTION_PARTS["3"],
40
+ },
41
+ ]
42
+
43
+ OS_ITEMS = sorted(OS_COMMANDS + OS_PROGRAMS, key=lambda item: item["number"])
44
+ DS_ITEMS = list(DS_PROGRAMS)
45
+
46
+ SUBJECTS = {
47
+ "os": {"name": "Operating Systems (DSC08)", "language": "C++", "items": OS_ITEMS},
48
+ "ds": {"name": "Data Structures", "language": "C++", "items": DS_ITEMS},
49
+ }
50
+
51
+
52
+ def get(item_id):
53
+ """Return the practical with id like 'os8' or 'ds3'."""
54
+ key = str(item_id).strip().lower()
55
+ for subject in SUBJECTS.values():
56
+ for item in subject["items"]:
57
+ if item["id"] == key:
58
+ return item
59
+ raise ValueError("No practical called %r. Try os2-os12 or ds1-ds7." % item_id)
60
+
61
+
62
+ def get_code(item_id):
63
+ """Return the source code of a program practical as one string."""
64
+ item = get(item_id)
65
+ if item["kind"] != "code":
66
+ raise ValueError("%s is a Linux commands practical, not a program." % item["id"])
67
+ return "\n".join(f["code"] for f in item["files"])
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ raise SystemExit(main())