[Improvement] Letting the developer initialize subscriber_key, publish_key and uuid for PNConfiguration during initialization#227
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
This looks safe, and backward compatible. It's pythonic and supports user initializing the config easily at instantiation. Allows end-user code reduction. I wonder if there is a way to use **kwargs to support member assignment at init() |
| def __init__(self, | ||
| subscriber_key: str | None = None, | ||
| publish_key: str | None = None, | ||
| uuid: str | None = None): |
There was a problem hiding this comment.
@JanluOfficial, could you let us know if the following changes work for you?
- Renaming
subscriber_keytosubscribe_keyfor consistency with the existing attribute name - Changing
str | NonetoOptional[str]to maintain Python 3.9 compatibility
There was a problem hiding this comment.
These changes will work. subscriber_key was actually just a spelling mistake that I didn't notice. I'm going to implement them once I get home today. Sorry for the late reply.
There was a problem hiding this comment.
No worries. You don’t need to implement these changes. I’ll release them from #228 and let you know once the new version is available
|
@JanluOfficial this issue is addressed in 10.6.0 |
This commit changes the
__init__method ofPNConfiguration()to optionally allow the developer to set subscriber_key, publish_key and uuid during initialization instead of setting them post-init. This lets developers initialize theirPNConfigurationin one line, as opposed to the 4 lines it took previously, as shown currently by the official pubnub documentation.