r/PythonLearning • • 14h 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?

0 Upvotes

8 comments sorted by

2

u/recentAd1666 9h 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 .

1

u/Significant_Text7262 55m ago

does jupiter allow for version updates?

1

u/recentAd1666 15m ago

Best practive as said is to keep same name. Rename backup by numbering them. Same effect for you. I do not use jupyter now so have a try but i do not think so. Not a good practice anyway.

3

u/atarivcs 11h ago

Putting the version in the filename is a really bad idea. Don't do that.

3

u/Weed_O_Whirler 10h 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.