How to maintain generic scripts in multiple python projects efficiently

hi everyone,

I have 5-6 python projects and there are few python scripts using used commonly in all the projects. I wanted to created a separate project to store all the generic scripts. Let’s say i have 5 generic scripts in generic project and i want to use those generic scripts in all 6 projects. Also making changes in any script in generic project should not have an impact to all 6 projects… I wanted to make changes in generic scripts in generic project and deploy to other projects one after the another… Can anyone please suggest a best way to implement this.
Any help on this would really help a lot

This seems to me something for a version control system. For example, your common scripts’ versions are managed in a git repository, while the different projects submodule specific branches of it.

Hi !

First, if you want to deploy changes independently in your various projects, you’ll have to use a separate Python environment for each project (Conda environment or virtual environment for example). (if all your projects rely on a same environment, any change in this environment will obviously affect all the projects at once)

Then, as mentioned by @franklinvp , you’ll need some way to version your generic scripts, so that you can track which version is deployed in each project. That implies bundling the scripts in a package, that you can then install and upgrade in the various environments. Here is the reference documentation for packaging Python code:

Also, as mentioned in the first reply, using a version control system like Git is highly recommended as soon as you need to keep track of the changes between versions. It’s not strictly necessary though.

Thank you @franklinvp @WeisLeDocto for the suggestions… Let me try packaging and version controlling options