Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
getting organized
#1
So I'm not really looking for a coding solution but more along the lines as advice. I have been working on a personal assistant for my self and I'm at the point where the project is getting to be a lot of code. So my question is what's the proper and professional way of organizing projects? Is it better to group functions in different .py files so for example I have functions that deal with lights should I make a .py file name it lights and put all the light functions in that file and then import the lights file to a main file and do the same thing with functions that control my google calendar? or should I put everything in one big .py file and call it a day.
Reply
#2
No, you should definitely split things up into modules (and packages if appropriate). It makes the code easier to navigate and think about. As for which modules you should have, well, that's difficult to answer. Things that are related should be grouped together, but I think there's definitely freedom of choice in what those groupings are. It would be useful to see your codebase if you want more specific advice.
Reply
#3
There's a good article on organization here: https://docs.python-guide.org/writing/structure/
Reply
#4
alright thank you for your advice guys
Reply
#5
I normally use folders on my windows 10 machine. I would have a main folder named "Coding Projects", then split it down to each sub categories, like "Sunflower Bot" or "Sunflower Juice Counter", etc. Dance
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020