I have this git repo structure:
.gitignore
JSONs/subdirA/some.json
JSONs/subdirB/other.json
MyPackage/__init__.py
MyPackage/myModule.py
How do I properly pack the JSONs folder into MyPackage/JSONs, without moving it there permanently (mostly because customers use this git repo directly for non-python usage, and the folder at the top of the repo is easy/intuitive... But now I also want to release this same dir into my PyPi package)?
I've tried adding it to the MANIFEST.in and then playing with data_files in setup.py as well as package_data... But to no avail. Maybe some .pyc or cached build files got the best of me... But I haven't figured it out from all the other (not quite) duplicate questions as they don't specifically call out their directory structure and desired final location.
I've tried resorting to os.walk and shutil.copy before the call to setup and then deleting that directory after setup... While it seems to work locally, when pushing to our local devpi package server, something goes wrong. Is my goal totally off the radar for setuptools/pip ideals??? Or am I just missing some key understanding? Please enlighten me!
JSONsdirectory is insideMyPackage? Then the rest is pretty standard (here for example). Do not usedata_files, useMANIFEST.inandpackage_data. - sinorocpackage_dirto rewrite the path to theJSONsdirectory. Something likepackage_dir = {'MyPackage.JSONs': 'JSONs'}, assuming yoursetup.pyis in the same directory as.gitignore(the root directory). -- docs.python.org/3/distutils/… - sinorocpackage_dira try now. The confusing thing about the page you linked earlier is, the data files are inside the package already, while in my case they're not. So my earlier attempts were leaving theJSONsfolder in eithersys.prefixorsite-packagesdepending on what I was trying. - nmz787package_dir, it will transform./JSONsintoMyPackage/JSONs, when it does the build, i.e. in the wheel it has the new path, but in the sdist it still has the old structure. - sinoroc