Skip to content

Commit b3a0d33

Browse files
committed
Convert Config classes to public API
These were converted into private classes during the 4.0 migration, as we were only supporting keyword arguments for the client configuration. However, that led to a poor user experience, as we had to use `**kwargs`, instead of listing all the configuration elements in the client constructor. (IDEs become painfully slow once we list all keyword arguments, as there are too many of them) The solution to this problem is to make the Config classes public API and provide helper methods over them to convert those classes to dictionaries so that they can be passed in to the client code. ```python config = Config() config.cluster_name = "dev2" client = HazelcastClient(**config.to_dict()) ``` We provide full type hints for config elements.
1 parent 497694c commit b3a0d33

17 files changed

+885
-295
lines changed

hazelcast/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import typing
55

66
from hazelcast.cluster import ClusterService, _InternalClusterService
7-
from hazelcast.config import _Config
7+
from hazelcast.config import Config
88
from hazelcast.connection import ConnectionManager, DefaultAddressProvider
99
from hazelcast.core import DistributedObjectEvent, DistributedObjectInfo
1010
from hazelcast.cp import CPSubsystem, ProxySessionManager
@@ -357,7 +357,7 @@ class SomeClassSerializer(StreamSerializer):
357357
_CLIENT_ID = AtomicInteger()
358358

359359
def __init__(self, **kwargs):
360-
config = _Config.from_dict(kwargs)
360+
config = Config.from_dict(kwargs)
361361
self._config = config
362362
self._context = _ClientContext()
363363
client_id = HazelcastClient._CLIENT_ID.get_and_increment()

0 commit comments

Comments
 (0)