Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay example data dir creation, add fallback for unwriteable $HOME #583

Merged
merged 3 commits into from
Oct 21, 2023

Conversation

fbdtemme
Copy link
Contributor

@fbdtemme fbdtemme commented Oct 19, 2023

Libpysal will try to create the data directory for storing example data at import time, even if no example objects are used.
We are running a tool in a singularity containers and have libpysal as a subdependency. We do not want to mount the user home directory in the container since this can damage reproducibility (eg python module picked up under ~/.local etc).

libpysal causes a failure due to "read-only" OSError exceptions when creating the pysal data directory during the import when running in singularity.

This PR simply moves creation of the data dir to the moment when it is actually needed because an example dataset is used.
This avoids the issue we are having mentioned above. Additionaly this also adds a fallback in get_data_home to use a temporary directory instead of the users home dir if that directory cannot be created. This is the same behavior as eg. the matplotlib MPLCONFIGDIR default.

@sjsrey sjsrey self-assigned this Oct 21, 2023
Copy link
Member

@sjsrey sjsrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks!

@sjsrey sjsrey merged commit 243597c into pysal:main Oct 21, 2023
2 of 8 checks passed
@ambarrio ambarrio mentioned this pull request Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants