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

Improve download zip #2727

Merged
merged 13 commits into from
Jun 14, 2022
Merged

Improve download zip #2727

merged 13 commits into from
Jun 14, 2022

Conversation

akaszynski
Copy link
Member

@akaszynski akaszynski commented Jun 1, 2022

Work on this was inspired by some issues with _retreive_file, particularly that when downloading and decompressing a zip, the contents of that zip file are placed directly into the downloads directory. This doesn't seem like an issue at first, but it can become one if two different archives were to contain identically named files that would be overwritten.

As you can imagine, this did involve a bit of a rework of our existing download internals:

  • The existing _retreive_file function does double duty, downloading single files and downloading and unzipping zip archive files. This makes it a bit hard to follow and it's been split into _retreive_file and _retreive_zip.
  • Various examples and download functions had to be rewritten to account for the various directory changes.
  • To avoid having to manually clear out the cache, this PR adds in a _verify_cache_integrity function that's called when initializing pyvista. This ensures that caches that are out-of-date are automatically cleared.

Bonus

Improve unit test stability by disabling download example on mac in 15e2488.

@github-actions github-actions bot added documentation Anything related to the documentation/website bug Uh-oh! Something isn't working as expected. labels Jun 1, 2022
@codecov
Copy link

codecov bot commented Jun 1, 2022

Codecov Report

Merging #2727 (0cd8856) into main (db62644) will increase coverage by 0.02%.
The diff coverage is 93.02%.

@@            Coverage Diff             @@
##             main    #2727      +/-   ##
==========================================
+ Coverage   93.83%   93.85%   +0.02%     
==========================================
  Files          76       76              
  Lines       16168    16263      +95     
==========================================
+ Hits        15171    15264      +93     
- Misses        997      999       +2     

Copy link
Contributor

@MatthewFlamm MatthewFlamm left a comment

Choose a reason for hiding this comment

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

I don't see any changes to tests/plotting/test-*, but a change in a image cache file. What is the reason?

pyvista/examples/downloads.py Show resolved Hide resolved
pyvista/examples/downloads.py Outdated Show resolved Hide resolved
pyvista/utilities/helpers.py Outdated Show resolved Hide resolved
@akaszynski
Copy link
Member Author

I don't see any changes to tests/plotting/test-*, but a change in a image cache file. What is the reason?

When the VRML example added a image cache test but forgot to add the image. I've moved this to #2765.

@akaszynski
Copy link
Member Author

@MatthewFlamm, please let me know if I've addressed your concerns in this PR.

Copy link
Contributor

@MatthewFlamm MatthewFlamm left a comment

Choose a reason for hiding this comment

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

This looks good to me. I think this is much better. Thanks for implementing using the vtk-data/Data structure. This gives me an additional idea which I'll submit an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Uh-oh! Something isn't working as expected. documentation Anything related to the documentation/website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants