Skip to content

Conversation

@rihp
Copy link
Contributor

@rihp rihp commented Nov 11, 2022

Closes: #5
Continuing from #38

This PR would implement the a new client config builder package, according to the recent changes of the JS Polywrap Client v0.10

JS PR that implements this: polywrap/wrap-cli#1367

@rihp rihp changed the title Rihp/feat/clientconfigbuilder Feature: Client Config Builder Nov 11, 2022
rihp added 4 commits November 11, 2022 16:48
…ig_builder_set_many_envs - AttributeError: 'ClientConfigBuilder' object has no attribute 'config'
@rihp
Copy link
Contributor Author

rihp commented Nov 12, 2022

with the current set up getting the following error: FAILED AttributeError: 'ClientConfigBuilder' object has no attribute 'config'

this is probably due to some syntax errors.

this is how set up the various classes right now.

from abc import ABC, abstractmethod

@dataclass(slots=True, kw_only=True) 
class ClientConfig:
    """
    This Abstract class is used to configure the polywrap client before it executes a call
    The ClientConfig class is created and modified with the ClientConfigBuilder module
    """
    envs: Dict[Uri, Dict[str, Any]]
    interfaces: Dict[Uri, List[Uri]]
    resolver: IUriResolver

class IClientConfigBuilder(ABC):
   @abstractmethod
    def build() -> ClientConfig:
        """Returns a sanitized config object from the builder's config."""
        pass

class BaseClientConfigBuilder(IClientConfigBuilder):
    """A concrete class of the Client Config Builder, which uses the IClientConfigBuilder Abstract Base Class"""
    # config: ClientConfig

    def __init__(self):
        self.config.envs = {} 
        self.config.interfaces = {}
        self.config.resolver = None
    ...

class ClientConfigBuilder(BaseClientConfigBuilder):
   ...

Another alternative I could try calling is self.build().envs instead of self.config,envs for example

@rihp
Copy link
Contributor Author

rihp commented Nov 18, 2022

The above error has been solved yesterday and now working further in the implementation of wrappers as an attribute of the ClientConfig too, along with all of the methods necessary to modify the ClientConfig (add_interfaces, set_resolver, etc)

just hace to do some cleanup and do a PR with WIP

@rihp
Copy link
Contributor Author

rihp commented Nov 18, 2022

closing pr in favor of #52

@rihp rihp closed this Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create client config builder package

2 participants