Open Jashcraf opened 1 year ago
FWIW, the way I did prysms sample data is invariant to where the code is run
The gist of why I did the dynamic download thing is because the sample files are ~10MB, and prysm's source was at the time ~100kb, and I did not want to pollute the source distribution that goes on PyPI.
If your material files are essential, then the dynamic download wouldn't really make much sense (but would allow you to decouple the updating of material data from software versioning, if you wanted to).
What maybe is, or likely is your problem, is a difference in operating system / file system between your local development and the continuous integration (Ubuntu, from a test log).
When you slice up to -12 on line 7 of materials.py, that is potentially error-prone; you could get a trailing slash or not, depending on silly things like non-printing control characters, or double slashes on some platforms, etc. It would be better to write that as Path(__file__).parent/'material_data')
. You could also do .parent.absolute()
if you want to replicate the absolute portion of that logic, though I think __file__
is always absolute. With os.path
, you would want to replace fullpth = matfilepath+'material_data/'+file
by fullpth = path.join(matfilepath,'material_data',file)
. This will let os.path take care of all of the slashes for you.
Basically, don't try to manipulate paths as strings; use a path library (and path lib is the "modern" one that is like 10+ years newer than os.path and less crusty)
Recently added
poke.materials
which loads index data in c38ffe6. However the test on GH actions broke because I was supplying it the wrong path? Even though it works locally.This is what we call in the industry a "skill issue". Maybe this can be @kenjim21's next project
@kenjim21 what do you think of helping me have a better filepath management system that enables better unit tests?