r/ProgrammerTIL • u/FindMeThisSonggg • Apr 24 '20
Python A simple Python OS.
So, I'm 12, I was bored one day and started to create this little Python app, I know it's not a real operating system, but It's a rather interesting Idea, here is the GitHub for the versions old & new: "https://github.com/Honesttt/SamiOS-Collection" Hope you guys enjoy. Requirements: Windows 10, Python 3.8.2 (Other Releases not debugged or proved to work.). Find my profile for some news about updates and releases. (We're on Alpha 8 currently.)
52
Upvotes
80
u/FloRup Apr 24 '20
Just my 2 cents after looking at the github page.
Normally github is for source code. Uploading rar files is ok but source code would be better so people can see what your code is like without downloading a sketchy rar file and you would not need the NO MALWARE! notice in the description :-)
20
u/[deleted] Apr 24 '20 edited Apr 24 '20
- please do put the code into zip files, have a look into a git tutorial and initialize the repo correctly. If you need any help feel free to pm me
- add a description, best as a readme.md file github display's it automaticly... some screenshots from your os would be also quit helpfull.(google "markdown" if you want to know how to do that.....
- as a next step code wise... try to use functions instead of duplicating text/code.
Great work :) i started my coding carrier nearly the same way :P!
6
u/DaMastaCoda Apr 24 '20
Since you're using version control, you don't need a separate folder for each version. Git already manages versions and you can go back to previous commits. If it's too daunting, editors like vscode give a simple commit gui
2
u/Prothon Apr 24 '20
I've forked and sent you a Pull Request on how projects are typically laid out. Look over it to see an example of how we do it professionally.
12
u/Dwight-D Apr 24 '20
So there's a lot of stuff to critique here but I understand that this is just you messing around and learning the ropes which is really cool. You've already gotten a lot of feedback on your versioning and project layout so I'll give you some pointers on your actual code. Now, I don't mean to say there is anything wrong with your work. I just want to give you some tips on ways you can improve.
Instead of calling
exec()on your additional python scripts and running them as new, separate processes, what you probably want to do is just import them. You can either import them as modules and then call functions from them, or you can just import them as scripts and execute the whole script itself when you import. If your other scripts are written the same way as your boot script, then their entire contents will be executed when you import them.When you do this, you can wrap the import in a
try/exceptclause for error handling. If some error occurs in try, for example the module isn't found, then the code in theexceptclause will execute, and you can output the error message there.This way, you don't need to check for the presence of the files manually. Also, it won't matter unless they are actually going to be used (although you may still want to check this up front - it's completely up to you). However, your code will become a lot cleaner and more safe. And this can be used for other kinds of errors too.
Finally, you may want to look into functions and using them to break your code into separate, logical blocks. This will make it flow more nicely, you will be able to reuse some of your logic, and it will be easier to read for yourself and others. An example of your code with functions:
Good work! This is a really good start. If you keep this up I'm sure you will have a brilliant future.
3
u/Antoinebot Apr 24 '20
Though using python for systems programming makes me itch, this seems pretty interesting. I'll have a better look a little when I get up.
RemindMe! 1pm
2
u/Jonnyogood Apr 25 '20
1
u/Kaisogen Apr 24 '20
You should learn how to use Branches, Releases, Git in general. You don't need to upload multiple versions of the same code, since Github does this automatically for you. Whenever you're done updating the code for a specific version, go ahead and create a release for it. It'll automatically allow you to upload a binary, and creates a zip and tar.gz for that version.
1
u/10kKarmaForNoReason May 19 '20
Im 14 :) im going to try to remake this in c#
1
u/PabloDons Apr 25 '20
Learning how to do GitHub and git like the professionals is no fun at all and frankly not that important. It's nice that you made folders instead of a rar-archive though so I can look at the code without downloading.
I just wanna see what comes of your OS. I have high hopes. You could even make your own programming language with that. Can't wait for next update!
0
u/[deleted] Apr 24 '20
[deleted] — view deleted comment