r/learnpython • u/Extreme_Sympathy_868 • May 05 '26
I built a script that initializes Python Projects - Please give me feedback
I have a Github repo that has a Python script in it. I've used this script to automate the initial steps of creating a Pyhton project. Those are:
Create a project folder
Create a virtual environment
Update the packet manager - I am using pip
Install requirements
Save installed requirements for sharing
Here is the GitHub link to this repo: Mohamork/PythonProjectInitializer: A script that reduces the initial steps of creating a Python project
18
5
u/corey_sheerer May 05 '26
Not bad to experiment, but this is already a best practice to use environment management (UV is dominating, but I used to really kike poetry as well)
0
May 05 '26
[deleted]
4
u/Extreme_Sympathy_868 May 05 '26
It is just practice my friend.
2
u/guitarot May 05 '26
I'd suggest letting the user choose the package environment (pip, uv, etc), and then your script could automate any of them.
0
May 06 '26
[deleted]
2
u/Extreme_Sympathy_868 May 06 '26
Wasn't useless at all. I already knew about uv but I've left it out just because I was learning the basics. Now I fully understand why uv is the better packet manager for modern software development. Thanks.
32
u/zanfar May 05 '26
Modern projects should not be using
os.pathorrequirements.txt. Usepathlibandpyproject.tomlinstead.pip freezeshould be avoided as a way to identify dependencies as well.except: passis a huge red flag.This requires me to edit the script every time I make a project in a different location?
Avoid string concatenation, especially unnecessary concatenation or path concatenation.
pkg = (sum(1 for _ in f))? Why? Why? and Why?Code "commented" out as a docstring, and included in a production release, is a yellow flag.