You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement ShadeClient class for per-instance configuration #2
While global config is convenient, multi-tenant applications (e.g. a SaaS acting on behalf of multiple merchants) need isolated client instances that carry their own credentials. ShadeClient should accept the same parameters as the global config and bind them to a single instance, which is then passed to resource methods.
Proposed Steps:
Create src/shade/client.py with a ShadeClient dataclass/class.
Global config works fine when there is one tenant. It breaks once one process serves many tenants, because their credentials share the same module state. So ShadeClient should stand on its own as a config object that resource methods use per call, with the global config only as a fallback.
What I will do
Add src/shade/client.py with a ShadeClient dataclass holding api_key, environment, api_base, timeout, max_retries.
Give each resource class an optional client kwarg. Order per call is the passed client first, then global config, then raise AuthenticationError if both are missing. No instance changes the global, so two clients stay independent.
Add a ShadeClient.from_env() classmethod that reads SHADE_API_KEY and SHADE_ENVIRONMENT.
Tests, one for each acceptance criterion
ShadeClient(api_key="sk_test_xxx") makes an isolated client.
A resource call through that client uses its key, not the global.
Two clients with different keys run at the same time without affecting each other.
from_env() reads SHADE_API_KEY correctly.
Missing api_key with global also None raises AuthenticationError.
About me
I do Python backend work with Flask. I am comfortable with dataclasses and handling how config is read from the environment.
Activity
Whiznificent commentedon Jun 19, 2026
gm maintainer i will like to work on this issue
Whiznificent commentedon Jun 19, 2026
gm maintainer i can fix this issue and have the pr submitted to you by tomorrow asap
daveades commentedon Jul 27, 2026
Hi @codebestia, I'd like to work on this issue.
How I understand it
Global config works fine when there is one tenant. It breaks once one process serves many tenants, because their credentials share the same module state. So
ShadeClientshould stand on its own as a config object that resource methods use per call, with the global config only as a fallback.What I will do
src/shade/client.pywith aShadeClientdataclass holdingapi_key,environment,api_base,timeout,max_retries.clientkwarg. Order per call is the passed client first, then global config, then raiseAuthenticationErrorif both are missing. No instance changes the global, so two clients stay independent.ShadeClient.from_env()classmethod that readsSHADE_API_KEYandSHADE_ENVIRONMENT.Tests, one for each acceptance criterion
ShadeClient(api_key="sk_test_xxx")makes an isolated client.from_env()readsSHADE_API_KEYcorrectly.api_keywith global alsoNoneraisesAuthenticationError.About me
I do Python backend work with Flask. I am comfortable with dataclasses and handling how config is read from the environment.
I can open a PR in 1 to 2 days.
grantfox-oss commentedon Jul 27, 2026
🦊 GrantFox — @daveades has been assigned to this issue as part of the Official Campaign | FWC26 campaign!
Next steps:
Closes #2)Good luck! Track your progress on GrantFox.
feat(client): implement ShadeClient for per-instance configuration
Merge pull request #55 from daveades/feat/2-shade-client
grantfox-oss commentedon Jul 30, 2026
🎉 This issue has been marked as completed on GrantFox as part of the Official Campaign | FWC26 campaign!
@daveades's PR #55 was approved and merged by @codebestia.
🏆 @daveades: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (188 total points). Track your full progress on GrantFox.
👏 Great work, @daveades! Keep contributing to ShadeProtocol.