When I'm developing a project, and a script script.py
needs access to some data file data.txt
, I will usually write something like this:
path = Path(__file__).parent.parent / "resources" / "text" / "data.txt"
I then commit data.txt
to source control, and when people clone the repo, everything will work. This works nicely until the project matures to the point that I want to write a setup.py
to let people just install it straight from the repo with pip. At this point, I can't figure out how to tell setup.py
to just put the resources
folder in the "same place" in the package as it is in my repository. I've looked into package_data
, data_files
and MANIFEST.in
but I haven't been able to get any solution working. How can I do this?