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

Implement download #1

Merged
merged 5 commits into from
Oct 27, 2023
Merged

Implement download #1

merged 5 commits into from
Oct 27, 2023

Conversation

maximusunc
Copy link
Collaborator

No description provided.

@@ -1,11 +1,59 @@
"""Download tests."""
import glob
Copy link
Member

@sierra-moxon sierra-moxon Oct 24, 2023

Choose a reason for hiding this comment

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

I've been using a file storage package called pystow - it handles compression/uncompression, storing everything in a consistent folder location that is programmatically retrievable, retrieving from URLs/FTP, refreshing the file when it changes - or not - etc. e.g. https://github.com/geneontology/gopreprocess/blob/d258d475dfe65886d39cc795e1fae78c2bab8d36/src/utils/download.py#L44

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That looked interesting, so I just tried it out. It looks like it uses urllib underneath and on a Mac, I get an SSL certificate verification failed error. And then I was looking at their documentation and wasn't seeing an option for ensure_zip, without knowing the specific files we want to download (ensure_open_zip opens a specific file in the zip). We want to download the whole thing so we can parse out the tests we want to run. Do you know how we might use pystow for our specific use-case?

Copy link
Member

@sierra-moxon sierra-moxon Oct 24, 2023

Choose a reason for hiding this comment

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

yeah no worries, its awesome that you tried it out! :)
https://stackoverflow.com/questions/52805115/certificate-verify-failed-unable-to-get-local-issuer-certificate -- that's the Mac fix SO that has worked for me.

Definitely would still need some software to iterate through the downloaded files (or even to iterate through all files in a source URL - e.g. a folder on an FTP site), but instead of keeping track of the path amongst methods, you can always retrieve the path that pystow stores the files by querying its metadata (and then managing the download URLs/etc in a conf file).

pystow does manage zip/unzip and refresh nicely. here's a example of the file structure it creates for me:

SMoxon@SMoxon-M82 .data % ls
ALLIANCE		MGI_GPI			SEMMEDDB		monarch
GAF_OUTPUT		MOUSE			SEMMEDDB_DOMAIN		oaklib
GO			ORTHO			SEMMEDDB_RANGE		pub
HUMAN			README.md		bioregistry		pykeen
HUMAN_ISO		README_testing.md	gilda
MGI			RGD			goa_files
SMoxon@SMoxon-M82 .data % cd RGD
SMoxon@SMoxon-M82 RGD % ls
rgd-src.gaf	rgd-src.gaf.gz	rgd.gaf
SMoxon@SMoxon-M82 RGD % 

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did a little more playing around with this. I got the SSL certificate error fixed from that SO above, but there doesn't seem to be a method in pystow to download and unzip an entire zip file. The only options are to download the zip but leave it unzipped, or download it and unzip but only save a specific file inside, which doesn't quite meet our needs.

Copy link
Contributor

@RichardBruskiewich RichardBruskiewich left a comment

Choose a reason for hiding this comment

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

I haven't yet completely reviewed this (and previous) PR code but I'd rather say "onward ho" at this moment and anticipate additional rapid iterations within the coming days and weeks.

@maximusunc maximusunc merged commit d81f81f into main Oct 27, 2023
2 checks passed
@maximusunc maximusunc deleted the implement_download branch October 27, 2023 20:06
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.

3 participants