Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for valid python implementation #3

Open
untzag opened this issue May 19, 2022 · 0 comments
Open

Check for valid python implementation #3

untzag opened this issue May 19, 2022 · 0 comments

Comments

@untzag
Copy link
Member

untzag commented May 19, 2022

I'm thinking yaq-traits assert-python <entrypoint>

The only think I'm really looking for is that it has all of the methods that the protocol declares.

simple implementation:

import entrypoints
def assert_python(entrypoint):
    cls = entrypoints.get_group_named("console_scripts")[entrypoint].__self__
    for msg in cls._avro_protocol["messages"]:
        assert hasattr(cls, msg)

this of course is specific to python implemented daemons, but serves as a reference that the daemon is implemented according to what it claims

A more advanced version of this could check type hints against the request/response fields of the protocol, but that gets complicated (and type hints are not at all required)

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

No branches or pull requests

1 participant