1

I have never worked with pip before and I am trying to figure out if there is any way to have a particular file in a pip package I created never be overwritten when introduced to new package versions.

To better explain, let's say I have a json file, data.json, within the package itself. Let's also say that the contents of this json file can be updated by someone using this package. A new version of the package just came out, and this user decides to install it with the expectation that the information within the json file to not have been impacted by the update.

Question: In this context, does pip offer any tools that would have data.json be not overwritten by new versions of the package?

I have been looking at the pip documentation for quite some time and it is a bit overwhelming. I have encountered metadata for the setup.py script such as packaging_data that allows files such as this json file to be included within the package; but to what I understand it does not accomplish what I need.

I have also pondered making it the responsibility of the user to provide a file path for data.json to be saved and read/written from, but I then run into the same issue: how can the package remember the file path they provided?

I believe it maybe good to note that this package is built exclusively with Python 3. I may have not been able to explain this the best so if you are confused please let me know.

0 Answers0