pyOS-kernel 0.1.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.
@@ -0,0 +1,323 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyOS-kernel
3
+ Version: 0.1.0
4
+ Summary: Build complete operating systems using Python - compiles to Assembly and Machine Code
5
+ Author-email: i87kxxz <i87kxxz@users.noreply.github.com>
6
+ Maintainer-email: i87kxxz <i87kxxz@users.noreply.github.com>
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/i87kxxz/pyOS
9
+ Project-URL: Documentation, https://github.com/i87kxxz/pyOS#readme
10
+ Project-URL: Repository, https://github.com/i87kxxz/pyOS
11
+ Project-URL: Issues, https://github.com/i87kxxz/pyOS/issues
12
+ Keywords: operating-system,os,kernel,assembly,x86,bootloader,low-level,systems-programming,qemu,nasm
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Education
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Assembly
25
+ Classifier: Topic :: Software Development :: Compilers
26
+ Classifier: Topic :: System :: Operating System Kernels
27
+ Classifier: Topic :: Education
28
+ Requires-Python: >=3.8
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: click>=8.0.0
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
34
+ Requires-Dist: black>=23.0.0; extra == "dev"
35
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
36
+ Dynamic: license-file
37
+
38
+ # 🖥️ pyOS
39
+
40
+ **Build complete operating systems using Python.** Write your OS kernel in Python, and pyOS compiles it to Assembly and Machine Code that runs on real hardware.
41
+
42
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
43
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
44
+
45
+ <p align="center">
46
+ <img src="https://raw.githubusercontent.com/pyos/pyos/main/docs/screenshot.png" alt="pyOS Screenshot" width="600">
47
+ </p>
48
+
49
+ ## ✨ Features
50
+
51
+ - 🐍 **Write OS in Pure Python** - No Assembly knowledge required
52
+ - ⚡ **Compiles to Native Code** - Python → Assembly → Machine Code
53
+ - 🎨 **VGA Text Mode** - Full color support (16 colors)
54
+ - ⌨️ **Keyboard Support** - PS/2 keyboard driver included
55
+ - 🧠 **Memory Management** - GDT, heap allocation, stack management
56
+ - 🔧 **QEMU Integration** - Test your OS instantly
57
+ - 📦 **Easy Installation** - `pip install pyOS`
58
+
59
+ ## 🚀 Quick Start
60
+
61
+ ### Installation
62
+
63
+ ```bash
64
+ pip install pyOS
65
+ ```
66
+
67
+ **Requirements:** NASM and QEMU
68
+ ```bash
69
+ # Windows (with chocolatey)
70
+ choco install nasm qemu
71
+
72
+ # Linux
73
+ sudo apt install nasm qemu-system-x86
74
+
75
+ # macOS
76
+ brew install nasm qemu
77
+ ```
78
+
79
+ ### Hello World OS
80
+
81
+ ```python
82
+ from pyos import Kernel, Screen
83
+
84
+ kernel = Kernel(arch="x86")
85
+
86
+ @kernel.on_boot
87
+ def main():
88
+ Screen.clear()
89
+ Screen.set_color("green", "black")
90
+ Screen.print("Hello World!")
91
+ Screen.print("Welcome to my OS!", row=1)
92
+
93
+ kernel.build("myos.iso")
94
+ ```
95
+
96
+ ### Run Your OS
97
+
98
+ ```bash
99
+ qemu-system-i386 -fda myos.iso
100
+ ```
101
+
102
+ ## 📖 Documentation
103
+
104
+ ### Kernel
105
+
106
+ ```python
107
+ from pyos import Kernel
108
+
109
+ # Create a kernel targeting x86 architecture
110
+ kernel = Kernel(
111
+ arch="x86", # or "x86_64"
112
+ stack_size=16384, # 16KB stack
113
+ heap_size=1048576, # 1MB heap
114
+ )
115
+
116
+ # Register boot functions with priority (lower = runs first)
117
+ @kernel.on_boot(priority=0)
118
+ def early_boot():
119
+ pass
120
+
121
+ @kernel.on_boot(priority=1)
122
+ def late_boot():
123
+ pass
124
+ ```
125
+
126
+ ### Screen (VGA Text Mode)
127
+
128
+ ```python
129
+ from pyos import Screen
130
+
131
+ # Clear screen
132
+ Screen.clear()
133
+
134
+ # Set default colors
135
+ Screen.set_color("white", "blue")
136
+
137
+ # Print text
138
+ Screen.print("Hello!")
139
+ Screen.print("At position", row=5, col=10)
140
+ Screen.print("Colored text", color="red", background="black")
141
+
142
+ # Available colors:
143
+ # black, blue, green, cyan, red, magenta, brown, light_gray,
144
+ # dark_gray, light_blue, light_green, light_cyan, light_red,
145
+ # light_magenta, yellow, white
146
+ ```
147
+
148
+ ### Building & Running
149
+
150
+ ```python
151
+ # Build ISO image
152
+ kernel.build("myos.iso")
153
+
154
+ # Or build raw binary
155
+ kernel.build("myos.bin", format="bin")
156
+
157
+ # Generate Assembly only (for inspection)
158
+ asm_code = kernel.compile()
159
+ ```
160
+
161
+ ## 🎯 Examples
162
+
163
+ ### Multi-Stage Boot
164
+
165
+ ```python
166
+ from pyos import Kernel, Screen
167
+
168
+ kernel = Kernel(arch="x86")
169
+
170
+ @kernel.on_boot(priority=0)
171
+ def init():
172
+ Screen.clear()
173
+ Screen.print("Initializing...", color="cyan")
174
+
175
+ @kernel.on_boot(priority=1)
176
+ def load_drivers():
177
+ Screen.print("[OK] Drivers loaded", row=1, color="green")
178
+
179
+ @kernel.on_boot(priority=2)
180
+ def ready():
181
+ Screen.print("System Ready!", row=3, color="yellow")
182
+
183
+ kernel.build("myos.iso")
184
+ ```
185
+
186
+ ### Colorful UI
187
+
188
+ ```python
189
+ from pyos import Kernel, Screen
190
+
191
+ kernel = Kernel(arch="x86")
192
+
193
+ @kernel.on_boot
194
+ def main():
195
+ Screen.clear()
196
+
197
+ # Draw a header
198
+ Screen.set_color("white", "blue")
199
+ Screen.print("=" * 40, row=0)
200
+ Screen.print(" My Operating System v1.0", row=1)
201
+ Screen.print("=" * 40, row=2)
202
+
203
+ # System info
204
+ Screen.set_color("green", "black")
205
+ Screen.print("[OK] CPU initialized", row=4)
206
+ Screen.print("[OK] Memory ready", row=5)
207
+
208
+ # Footer
209
+ Screen.set_color("yellow", "black")
210
+ Screen.print("Press any key to continue...", row=10)
211
+
212
+ kernel.build("myos.iso")
213
+ ```
214
+
215
+ ## 🏗️ Architecture
216
+
217
+ ```
218
+ ┌─────────────────────────────────────────────────────────┐
219
+ │ Your Python Code │
220
+ │ @kernel.on_boot │
221
+ │ def main(): │
222
+ │ Screen.print("Hello!") │
223
+ └─────────────────────────────────────────────────────────┘
224
+
225
+
226
+ ┌─────────────────────────────────────────────────────────┐
227
+ │ pyOS Compiler │
228
+ │ • Parses Python code │
229
+ │ • Captures screen/keyboard operations │
230
+ │ • Generates x86 Assembly │
231
+ └─────────────────────────────────────────────────────────┘
232
+
233
+
234
+ ┌─────────────────────────────────────────────────────────┐
235
+ │ NASM Assembler │
236
+ │ • Converts Assembly to Machine Code │
237
+ └─────────────────────────────────────────────────────────┘
238
+
239
+
240
+ ┌─────────────────────────────────────────────────────────┐
241
+ │ Bootable Image │
242
+ │ • Bootloader (512 bytes) │
243
+ │ • Kernel binary │
244
+ │ • Runs on QEMU or real hardware │
245
+ └─────────────────────────────────────────────────────────┘
246
+ ```
247
+
248
+ ## 📁 Project Structure
249
+
250
+ ```
251
+ pyOS/
252
+ ├── pyos/
253
+ │ ├── __init__.py
254
+ │ ├── kernel.py # Kernel class and decorators
255
+ │ ├── builder.py # ISO/binary builder
256
+ │ ├── emulator.py # QEMU integration
257
+ │ ├── cli.py # Command-line interface
258
+ │ ├── compiler/
259
+ │ │ ├── codegen.py # Python → Assembly
260
+ │ │ └── assembler.py # Assembly → Machine Code
261
+ │ ├── drivers/
262
+ │ │ ├── screen.py # VGA text mode driver
263
+ │ │ └── keyboard.py # PS/2 keyboard driver
264
+ │ ├── memory/
265
+ │ │ ├── manager.py # Memory allocation
266
+ │ │ └── gdt.py # Global Descriptor Table
267
+ │ └── boot/
268
+ │ └── bootloader.asm # x86 bootloader
269
+ └── examples/
270
+ ├── hello_world.py
271
+ ├── keyboard_input.py
272
+ └── advanced_os.py
273
+ ```
274
+
275
+ ## 🛠️ CLI Commands
276
+
277
+ ```bash
278
+ # Create new project
279
+ pyos new myos
280
+
281
+ # Build OS
282
+ pyos build main.py -o myos.iso
283
+
284
+ # Run in QEMU
285
+ pyos run myos.iso
286
+
287
+ # Debug mode
288
+ pyos debug myos.iso
289
+
290
+ # Generate Assembly only
291
+ pyos asm main.py -o kernel.asm
292
+
293
+ # Check dependencies
294
+ pyos check
295
+ ```
296
+
297
+ ## 🤝 Contributing
298
+
299
+ Contributions are welcome! Feel free to:
300
+
301
+ - 🐛 Report bugs
302
+ - 💡 Suggest features
303
+ - 🔧 Submit pull requests
304
+
305
+ ## 📄 License
306
+
307
+ MIT License - feel free to use in your own projects!
308
+
309
+ ## 🙏 Acknowledgments
310
+
311
+ - NASM - The Netwide Assembler
312
+ - QEMU - Open source machine emulator
313
+ - OSDev Wiki - Invaluable OS development resources
314
+
315
+ ---
316
+
317
+ <p align="center">
318
+ Made with ❤️ for OS enthusiasts
319
+ </p>
320
+
321
+ <p align="center">
322
+ <b>Build your dream OS with Python!</b>
323
+ </p>
@@ -0,0 +1,27 @@
1
+ pyos/__init__.py,sha256=P2MqqVmonsM2S9c3GOqzl370Ul6ZoIL3-w0nQZTggW8,459
2
+ pyos/builder.py,sha256=p1MHZ-QoU3gQ-mImknapC9WNFn7pzCAZPyAYmsaNBRQ,5412
3
+ pyos/cli.py,sha256=8pUmbzSTDwbr1wRHCUC2vqtiVNOGHR6-0ZOtl6FM_-M,7521
4
+ pyos/emulator.py,sha256=u2rEBziFJvTrZQI6d6BeSMWfpxbBmSjYIsjFjQ5hv_A,5434
5
+ pyos/kernel.py,sha256=8kVOPKWIXp_8hUFl_Y6u_yQeJmwcixAxC5DAjgbAVo8,8931
6
+ pyos/boot/__init__.py,sha256=Jd_e8ztI4DwDUVEH10iiIHDUTxCUYlQ2D548Ad3g4us,32
7
+ pyos/boot/bootloader.asm,sha256=Rf_KcevAqpT_Px5rm0qrUgjhzMi7szYinvzPWfSkwvM,3534
8
+ pyos/compiler/__init__.py,sha256=nmcpo9oa-cd_WzL0uCHvaeUWukvTF-rMm3cw5-Y5m8M,162
9
+ pyos/compiler/assembler.py,sha256=aOFTIFfZ2-CkjsmeJI0WO9s4vWB-Ts8HRKwgdybsLMU,5134
10
+ pyos/compiler/codegen.py,sha256=crza0SokcwvY3pVJAZUBGGg4uZvZWBIEwkQ60rZDfbE,8593
11
+ pyos/drivers/__init__.py,sha256=_ZW-c4NYHDWNvREj5BJGq3nWvVUtP4zVGUWID9msL_w,131
12
+ pyos/drivers/keyboard.py,sha256=-ltrQ8VxYBH7hPNihCxgyJb6tx4tTuZdH7KvkKv2PnI,8520
13
+ pyos/drivers/screen.py,sha256=yvPC07o4klMHPam2VN7999C6nk6sdIKM0hbuzsAvR0Y,8704
14
+ pyos/interrupts/__init__.py,sha256=EC21EKa6XCmRrJL9azRQrsMAhEEgp2SS5t8vvfCJsKQ,159
15
+ pyos/interrupts/handler.py,sha256=-XY3HNLFlXxZf--tdZnvuB61Wenc9roVbCWc9Q6QteA,6456
16
+ pyos/interrupts/idt.py,sha256=6J-4SxhqzUZSR-Q6SqHNKy2x4cU4G0aEHW9EOOA4KbE,4690
17
+ pyos/memory/__init__.py,sha256=g-7t6ztrCdYtE2KxBqTcuFBB6oMPe4Xem76jr1zVRao,118
18
+ pyos/memory/gdt.py,sha256=R1mmyt4lcSq-G9fN0gwmRBWOb3PVIVqLdNn2j80Akf4,8412
19
+ pyos/memory/manager.py,sha256=2UawE5LvWIosbk_h70H5q25gzTaqElBxmViAiovgRCA,11847
20
+ pyos/syscalls/__init__.py,sha256=vPtHCkE-9yZS3Op2u5teP_J9k6NV96tsAaQYTIAFJLI,86
21
+ pyos/syscalls/handler.py,sha256=7HYlzX64oUUz2DhUrtRtpmfYd0nPn1wzu0JEPnTLh78,4719
22
+ pyos_kernel-0.1.0.dist-info/licenses/LICENSE,sha256=XanxucmD5Sb1mMoelkg66NsWqDsAUzApuE2fPqssA68,1085
23
+ pyos_kernel-0.1.0.dist-info/METADATA,sha256=n6rTSBQgTVoY9e5bfF9i6z9rAXrOQz2C8iRduEQPyVQ,10012
24
+ pyos_kernel-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
+ pyos_kernel-0.1.0.dist-info/entry_points.txt,sha256=bCWpd4JCtfWsguYLePsFiofwIItTCrd9kfR2_FU7ZIs,39
26
+ pyos_kernel-0.1.0.dist-info/top_level.txt,sha256=j2y0qyM9tjs3KP_Ji628-v-5nhxyFiMNeQFCP8cJK1E,5
27
+ pyos_kernel-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pyos = pyos.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 i87kxxz
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.
@@ -0,0 +1 @@
1
+ pyos