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

Set global defaults #129

Open
1 of 4 tasks
gadicc opened this issue Apr 12, 2021 · 3 comments
Open
1 of 4 tasks

Set global defaults #129

gadicc opened this issue Apr 12, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@gadicc
Copy link
Owner

gadicc commented Apr 12, 2021

Feature Request

Wanted Feature

A recommended method to set global defaults.

Use Cases

Currently we can override defaults per request.
But's a bit weird for things like the queue, which affects all past and future requests too.

Potential Example Usage

// with run-time validation
yahooFinance.setConfig({ ... });

// perhaps to be clearer about what's a default for future requests
yahooFinance.setDefault({});

Timeline

  • API (feat(setGlobalConfig): add setGlobalConfig function #133) - thanks @PythonCreator27
  • Update docs that mention _opts
  • Docs to explain difference between global options and global defaults? (e.g. queue opts are global opts, but maybe we have some fetch opts that are defaults used for each request and can be overriden)
  • Change behaviour in yf.* funcs that any overrides should be just for that call, and should throw an error if trying to override a global option (like the queue, this isn't really make sense, as there is only one queue for all requests). NB: this WOULD be a breaking change but since the queue code is still only in devel and has not been released, we're all good!
@gadicc gadicc added the enhancement New feature or request label Apr 12, 2021
@advaiyalad
Copy link
Contributor

@gadicc I absolutely agree. It would just involve setting properties on _opts, right? If so, I can send a PR soon.

@advaiyalad
Copy link
Contributor

I think that setConfig makes more sense, as it is more clear about what is being set. Maybe setGlobalConfig would be better?

@advaiyalad
Copy link
Contributor

Would it make more sense to override the default config, or just merge them? I would go with merging, as it is usually a more predictable behavior. What do you think, @gadicc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants