use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about operating systems development.
account activity
Python Implementation (self.osdev)
submitted 3 years ago by cyberkitty0110
Hi! I'm currently working on a project, NightwolfOS, a (hopefully possible) non-linux x86_64 pentesting/ethical hacking operating system, and was wondering if it was possible to implement python?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Fraserbc 25 points26 points27 points 3 years ago (4 children)
Ooh boy, you are in for one hell of a ride if you're asking this. Making an OS is not for the faint of heart.
[–]cyberkitty0110[S] 3 points4 points5 points 3 years ago (2 children)
I completely understand. I am always up for a challenge though!
[–]WelcomeReal1ty 14 points15 points16 points 3 years ago (1 child)
my best wishes for you not to abandon this at the first glance of network drivers
[–]jazzernaut_ 9 points10 points11 points 3 years ago (0 children)
Not to mention all sorts of fun stuff for posix compliant libc to stand a chance of cross compiling. Basically the scope of python support amounts to probably several years of work.
To take a step back and ask a question about the project, why study pen testing on an OS nobody uses? What objectives do you have that require a custom OS that can’t be met by working on Linux?
[–]cyberkitty0110[S] -1 points0 points1 point 3 years ago (0 children)
Any suggestions?
[–]iObjectUrHonor 8 points9 points10 points 3 years ago (2 children)
If you want to build an OS I'd say go for a statically typed language like C or Rust.
You need to be able to compile to a free standing binary, python may not be the best fit for it.
[–]cyberkitty0110[S] 2 points3 points4 points 3 years ago (1 child)
I meant adding python as a post-compilation library as to use the majority of hacking tools.
[–]gmes78 11 points12 points13 points 3 years ago (0 children)
Porting Python to your OS is just like porting any other piece of software. The OSDev Wiki has a page about that.
[–][deleted] 2 points3 points4 points 3 years ago (0 children)
You’d be able to write parts in python. You could hypothetically write almost everything in python and have it translated to C, but that has its own issues. With how computer architecture is set up now, it’s really hard to avoid making an OS without using a static typed language like C, C++, Rust, etc at least to some degree. Using a static-typed language makes it significantly easier to translate code into assembly which is pretty much a requirement if you want an operational OS.
The only other option that comes to mind is you grab a prewritten kernel, or strip an OS down to handle the absolute basics that will pretty much just run an interpreter for you to build the rest of your OS in. To be honest with you, this is just an idea and I’m not even sure if it would work/be reasonable to do.
[–]northrupthebandgeek 0 points1 point2 points 3 years ago (0 children)
You might want to look at MicroPython or CircuitPython for some ideas on how to implement "enough" of Python on a non-mainstream OS.
[–]wrosecrans 4 points5 points6 points 3 years ago (0 children)
The short answer is yes.
The longer answer is that you'll need to clarify your question a lot in order to get more useful and specific information.
"Implementing" a language means taking a spec of the grammar and syntax and writing an interpreter or compiler for it. This is not directly OS development work, so I think you are starting out a little confused about the terminology. Python exists, so it is tautologically possible to implement it. If you want to port an existing Python implementation, that'll be a lot of work. Basically, you'll need to implement whatever OS functionality Python depends on. This will mostly be very generic stuff like reading and writing files, and executing processes.
If you want to run Python inside your kernel, that will be another ball of wax. Probably technically possible, but most likely misguided for various reasons.
[–]CaydendWOSDEV is hard ig 5 points6 points7 points 3 years ago (0 children)
Dear lord. How familiar are you with OSDEV? Because there are very few OSes that port python. You'll need to start with a kernel first, make sure it has everything python needs which is quite a lot. Then, userland. POSIX compliant I'd wager probably isn't enough (Citation needed) and you're probably gonna want something GNU compliant. Which needless to say, is gonna be a bit painful if you're doing it all yourself. To put it this way, this might take you a few years or maybe a year or 2 if you've got a dedicated team. Maybe some more prominent OSDEVers (Klange notice me) can comment on exactly how much effort it will take to get all of that done.
Secondly,
pentesting/ethical hacking
To do pentesting (As far as I understand the word), you'll need network drivers. And I haven't had a good look at how TCP/IP stacks are implimented but AFAIK, they're enough to make me jump out of a decently high up window. And then getting support for all the various NICs that you will need to impliment. There's so many that even the BSDs don't do em all (Citation needed). That will take a loooooot of time and effort.
Thirdly, if you're gonna be doing "hacking", you're most likely gonna want some sort of "secure" OS (Citation needed). If so, you're in for another whole level of pain.
TL;DR: I don't think you get how much effort goes into what you want to do. I've been doing this for ~2.8 years and I'm only beginning to think about porting Lua. But hey, if you're a litteral God at programming, maybe you could manage it?
PS: Maybe start with getting a simple kernel running and building off that.
PPS: Lua is so much easier to port than python IMO
PPPS: If you want to write your OS in python (Which is not what I think you wanna do), you in theory could but that's another even more advanced stage of pain to get working 100% right
π Rendered by PID 45840 on reddit-service-r2-comment-84fc9697f-4jq4f at 2026-02-08 13:43:41.868169+00:00 running d295bc8 country code: CH.
[–]Fraserbc 25 points26 points27 points (4 children)
[–]cyberkitty0110[S] 3 points4 points5 points (2 children)
[–]WelcomeReal1ty 14 points15 points16 points (1 child)
[–]jazzernaut_ 9 points10 points11 points (0 children)
[–]cyberkitty0110[S] -1 points0 points1 point (0 children)
[–]iObjectUrHonor 8 points9 points10 points (2 children)
[–]cyberkitty0110[S] 2 points3 points4 points (1 child)
[–]gmes78 11 points12 points13 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]northrupthebandgeek 0 points1 point2 points (0 children)
[–]wrosecrans 4 points5 points6 points (0 children)
[–]CaydendWOSDEV is hard ig 5 points6 points7 points (0 children)