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

Add type annotations to fmf code #185

Open
happz opened this issue Oct 17, 2022 · 1 comment
Open

Add type annotations to fmf code #185

happz opened this issue Oct 17, 2022 · 1 comment

Comments

@happz
Copy link
Collaborator

happz commented Oct 17, 2022

No description provided.

@i386x
Copy link

i386x commented Oct 3, 2023

Following our discussion from this years' March: The main problem here is get method which in general can return any type (more precisely in case of fmf: atomic types like float, int, str, maybe datetime, and None and compound types list and dict over them and over themselves). In languages like C/C++ get method return type will be some kind of union wrapped inside a struct but in Python we are using Any.

One solution to get rid off Any can be the API change: Instead of get, provide get_field_a, get_field_b, etc. to provide access to particular fmf fields; such methods can be annotated much more easily. Furthermore, as fmf format is described using JSON schema, we can use the schema to generate these methods together with their annotations instead of doing boring manual work but this step requires additional tooling. I am also aware that this means a lot of changes in the existing tmt codebase and other tools which are using fmf.

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

2 participants