Skip to content

Conversation

@rihp
Copy link
Contributor

@rihp rihp commented Nov 10, 2022

Initially we had a ClientConfig base class with a list of Environments, and a list of interfaces,

@dataclass(slots=True, kw_only=True)
class ClientConfig:
    envs: List[Env] = field(default_factory=list)
    interfaces: List[InterfaceImplementations] = field(default_factory=list)
    resolver: IUriResolver

Both of these fields are now being changed to a Dictionary for simpler client configuration.

@dataclass(slots=True, kw_only=True)
class ClientConfig:
    envs: Dict[Uri, Env: Dict[str, Any]] = field(default_factory=dict) 
    interfaces: Dict[Uri, List[Uri]]
    resolver: IUriResolver

This changes break some of the client functionality, working on those fixes now


Status update 10/nov/2022:

Was able to get all tests from Client package passing but broke some other packages like msgpack and core at build time.
I'm fixing those up next

Status update 11/nov/2022:

  • env refactor is building properly after all changes!
  • interfaces and interfacer implementations have been refactor working and merged into this branch!

@rihp
Copy link
Contributor Author

rihp commented Nov 11, 2022

The build is now passing, all green after the Env interface refactor 😎

now will look at the interfaces refactor

@rihp
Copy link
Contributor Author

rihp commented Nov 11, 2022

Included now the Interface Implementations refactor on this branch..!
there is still this Type error showing up on vscode, yet it's building properly!
image

@rihp rihp marked this pull request as ready for review November 11, 2022 10:41
@rihp rihp changed the title Rihp/fix/test env Refactor Env and Interfaces from Client config Nov 11, 2022
@rihp rihp changed the title Refactor Env and Interfaces from Client config Refactor Env and Interfaces from ClientConfig base class Nov 11, 2022
if isinstance(key, str):
dictionary[key] = sanitize(val)
else:
elif key.uri:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with this codebase, but why do we want to check whether the key.uri exists here? This msgpack package should be independent of any of the polywrap specific semantics, so referencing "uri" doesn't quite make sense here to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't be done like this, I will update it.

def get_env_from_uri_history(
uri_history: List[Uri], client: Client
) -> Union[Env, None]:
) -> Union[Dict[str, Any], None]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use the Env type here? It helps me better understand what this code is doing.

Copy link
Contributor

@Niraj-Kamdar Niraj-Kamdar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will make the requested changes and some refactor

if isinstance(key, str):
dictionary[key] = sanitize(val)
else:
elif key.uri:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't be done like this, I will update it.

@Niraj-Kamdar Niraj-Kamdar merged commit 0f46d50 into main Nov 13, 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.

4 participants