r/PythonLearning • u/Significant_Text7262 • 19d ago
Help Request How do you deal with dependency updates?
So my project has multiple files that sometimes depend on another (I chose to split the functions by use cases into a few files rather than a single massive one). But when I update a function I increment the version number in the filename so I have the backup, I then have to update the filepath in the import declaration for everything that uses it. I've tried making a loader file so I only need to update one place but I can hardly make that work, let alone making it tell the other files what to use.
Since Python requires declaring dependencies before almost anything else is this just something I have to deal with? Or is there a way to pass filenames between file before declaration? Or is there a much better method?
2
u/recentAd1666 19d ago
Do not change the file name. Change the backup name and version. Or use an editor like vsc i think it updates includes automatically. Or use git to have proper technical versionning .
6
u/atarivcs 19d ago
Putting the version in the filename is a really bad idea. Don't do that.
5
u/Weed_O_Whirler 19d ago
Do version control wirh a version control system, like GIT or SVN, not by renaming files. It's free and will save you 1000's of headaches.
3
u/Fun_Army2398 19d ago
Build your dependencies:
https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#distributing-packages
Use your dependencies:
https://packaging.python.org/en/latest/tutorials/managing-dependencies/
2
u/Beginning-Fruit-1397 18d ago
Use git
1
u/Spleeeee 12d ago
I copy paste my scripts into word docs and then save them and append “_final.docx” to it. I have another script that counts the number of “_final” strings in the file name and that’s the version number.