adds util for checking kwargs, and uses it to check init()#198
Conversation
|
here's example output with the traceback -- note the |
jhamon
left a comment
There was a problem hiding this comment.
I see what you mean about the problem of sensitive information in the stacktrace. I found this old package, which is currently archived, which implemented a decorator-based approach to scrubbing sensitive information from stacktraces. Maybe you could look around to find a similar project that isn't dead or else lift the relevant bits of source for us to directly copy. It doesn't look like that much code, and it's MIT licensed so fair game.
I think we can still move forward with this change because the problem of secrets in stacktraces is not a new issue. Any kind of error that results in a thrown exception would already have this problem if the person is initializing with method params (instead of environment variables, which should not appear). And stacktrace secret-scrubbing could be handled as a follow-up item.
As for where else this util should get used... I'm not sure. Most of the bug reports I have seen along these lines were problems with the init call. I think once people get started, they're more likely to take an iterative approach if something isn't working the way they expect due to them passing the wrong stuff. But when they run into this on their very first line of code with Pinecone, they seem to just throw up their hands in frustration.
|
I've modified this specifically to omit the traceback for this particular check because the risk of leaking an API Key in a bad |
Problem
Per #196 a typo in init's kwargs results in a default that might not be expected.
Solution
Utils now includes check_kwargs, which takes a caller + the given kwargs, and fails with a traceback if they don't match.
Open Questions
cc @jhamon @austin-denoble @rohanshah18
initin particular i question its value.Type of Change
Test Plan
pinecone.init(not_a_kwarg='foo')should fail