-
Notifications
You must be signed in to change notification settings - Fork 92
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
Download meshes for tutorials #1037
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1037 +/- ##
=======================================
Coverage 93.61% 93.61%
=======================================
Files 39 39
Lines 5893 5893
=======================================
Hits 5517 5517
Misses 376 376 ☔ View full report in Codecov by Sentry. |
import Downloads #hide | ||
meshfile = "periodic-rve.msh" #src | ||
#jl meshfile = "periodic-rve.msh" | ||
#md meshfile = "periodic-rve-coarse.msh" #hide | ||
#nb meshfile = "periodic-rve-coarse.msh" | ||
isfile(meshfile) || Downloads.download( #hide | ||
string("https://raw.githubusercontent.com/Ferrite-FEM/Ferrite.jl/gh-pages/assets/", meshfile), #hide | ||
meshfile) #hide | ||
grid = togrid(meshfile) #src | ||
#nb grid = togrid(meshfile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be easier to add docs for the download file (i.e. docs/download_resources) instead of moving the download logic into the tutorial files? I think having a central point where the external resources are defined for the download is easier to maintain in the long run than splitting it apart like this,.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about it, but for a user who copies the tutorial, it is nice to be able to copy the code and run directly I suppose?
Or did you mean to include via literate, so that the shown case (in cases we actually show the downloads in the docs) will include (part of) the code in docs/download_resources
? (ref)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think having a central point where the external resources are defined for the download is easier to maintain in the long run than splitting it apart like this,.
These are tutorials that should be able to be runnable by someone reading them so whatever is done it should be visible from the source code itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One solution would be to add a non-exported function
asset_url(file) = string("https://raw.githubusercontent.com/Ferrite-FEM/Ferrite.jl/gh-pages/assets/", file)
to Ferrite itself, which would at least allow using
isfile(meshfile) || Downloads.download(Ferrite.asset_url(meshfile), meshfile)
above, which looks prettier at least, and would allow changing the location of the assets easily in the future. But feels ugly to add such things to the base package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, this is only used in two places, so I suggest to do it this "distributed" way for now, to solve #1033. Would be great with a nice solution including a "central point" in the future though.
Solve #1033