Utility for making and updating a data fetcher component of your project.
pip install unscrewed
First prepare a registry.yaml
file, like the one in
unscrewed/tests/testreg_registry.yaml
. Put it in your package, say in the
your_package
directory (that contains the __init__.py
file). Maybe call
it registry.yaml
.
In some module, say your_package/data.py
import pkg_resources
import unscrewed
_config_file = pkg_resources.resource_filename("your_package", "registry.yaml")
fetcher = unscrewed.Fetcher(_config_file)
Say you have a file my_data_file.nii
configured in your registry.yaml
file above.
Now you can fetch it like this:
from your_package.data import fetcher
fname = fetcher('my_data_file.nii')