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

Type annotation of config module #1248

Open
oesteban opened this issue Apr 10, 2024 · 4 comments
Open

Type annotation of config module #1248

oesteban opened this issue Apr 10, 2024 · 4 comments
Labels
documentation effort:low Estimated low effort task impact:high Estimated high impact task

Comments

@oesteban
Copy link
Member

In general, it would be best practice to annotate, but it is of particular interest to the config module, as it will make the documentation of settings way more transparent and clear.

Any takers?

cc/ @celprov @mckenziephagen @teresamg @ZviBaratz

@oesteban oesteban added documentation impact:high Estimated high impact task effort:low Estimated low effort task labels Apr 10, 2024
@celprov
Copy link
Collaborator

celprov commented Apr 10, 2024

I'm afraid I don't understand what is needed.

@oesteban
Copy link
Member Author

Here's a gentle explanation about type annotation: https://blog.logrocket.com/understanding-type-annotation-python/.

In practice, this is about adding type hints to each of the configurable variables. For example, instead of:

x = 5.0

you can annotate this and say:

x: float = 5.0

which explicitly says this variable should be a float.

Type annotation also works for functions:

def hello(name):
    print(f'Hi {name}')

becomes:

def hello(name : str) -> None:
    print(f'Hi {name}')

which explicitly tells you the function accepts a string through the argument name and returns a None.

@ZviBaratz
Copy link
Contributor

If it's not too urgent, I wouldn't mind trying to take it on sometime in the next couple of weeks.

@oesteban
Copy link
Member Author

@ZviBaratz - two weeks is excellent timing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation effort:low Estimated low effort task impact:high Estimated high impact task
Projects
None yet
Development

No branches or pull requests

3 participants