-
Notifications
You must be signed in to change notification settings - Fork 4
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
Options makeover #45
Options makeover #45
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Merge commit '66d027db269166b87477fbcd64ebf39d2e5c0ce2' #Conflicts: # R/tar-terra-rast.R # R/tar-terra-vect.R
I'm wondering if we could maybe use some of the I'm happy for you to merge this currently if you're happy with it and we can add a separate issue about adding more comprehensive tests for setting/getting options? Also happy to start the work on that issue if you'd like a break from it :) |
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've taken the approach of not setting any options on package load, but rather storing defaults for individual options in the relevant functions.
I think the package should not set options on load so this is a good decision IMO.
If no options are set by the user, it falls back on defaults stored within each
tar_*()
function.
In #19 I wondered whether it would be easier to maintain if they were all set in the options get function, but this is probably a better solution: there may be special cases handled in specific tar_*()
functions that can't be handled more generally
No, I think I'll add tests before this gets merged. I want to make sure that options set globally actually get used correctly in a targets pipeline. I also keep going back and forth on whether running |
I keep going back and forth on this. After taking a long break from this PR, I'm now thinking it makes more sense for Also, using Going to study how options are done in |
Edited the PR description up top and now I think this is ready to review |
Tests should start passing again once |
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.
Refactor to address #34. I've taken the approach of not setting any options on package load, but rather storing defaults for individual options in the relevant functions.
This PR does two main things:
tar_resources_custom_format()
function in the development version oftargets
to pass options to write functions in custom formats.eval(substitute())
and works with distributedcrew
workers.targets
to be installed from GitHub for now. Eventually will change version requirement to >=1.6.1 and remove the Remotes field from DESCRIPTION.geotargets_option_get()
andgeotargets_option_set()
work.geotargets_option_set()
is now just a wrapper aroundoptions()
with some guardrails.geotargets_options_get()
looks ingetOption()
and then inSys.getenv()
for options, otherwise returns NULL. It also checks if the option name is valid withrlang::arg_match0()
tar_*()
functions