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

Start adding static type checking #567

Merged
merged 8 commits into from
Jul 21, 2023
Merged

Start adding static type checking #567

merged 8 commits into from
Jul 21, 2023

Conversation

PGijsbers
Copy link
Collaborator

As part of a larger effort to improve developer experience (#566), I started adding mypy to the dev tool chain.
This PR adds a minimal configuration that checks as I am following the using mypy with an existing codebase recommendations.
This PR adds mypy only for amlb.utils.

The mypy configuration globally ignores the "attr-defined" error, because of the amlb.utils.core.Namespace class which uses dynamically created attributes (technically not even that, but it is mimicked with __getattr__). I tried to narrow down the filtering of this error by just the Namespace class (either through configuration, or by redefining Namespace as Any for type checking purposes), but unfortunately I could not get that to work - so a global ignore it is. Reducing (or removing) the use of Namespace is something I'd like to refactor anyway, hopefully it will be enough so that we can remove the global ignore (possibly by adding specific line-level ignores if need be).

@PGijsbers PGijsbers added quality Something needs to be tested, keep the app functional automation Something could be automated labels Jul 19, 2023
@PGijsbers PGijsbers merged commit f256365 into master Jul 21, 2023
@PGijsbers PGijsbers deleted the dev/mypy branch July 21, 2023 12:10
github-actions bot pushed a commit to eddiebergman/automlbenchmark that referenced this pull request Jul 21, 2023
* Remove commented out code

* Specify mypy python version

* Address mypy errors

* Fix mypy errors

* Fix mypy errors

* Add type annotations

* Add type checking requirements

* Add ignore for [attr-defined], raised by normal Namespace use
github-actions bot pushed a commit to eddiebergman/automlbenchmark that referenced this pull request Jul 21, 2023
* Remove commented out code

* Specify mypy python version

* Address mypy errors

* Fix mypy errors

* Fix mypy errors

* Add type annotations

* Add type checking requirements

* Add ignore for [attr-defined], raised by normal Namespace use
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation Something could be automated quality Something needs to be tested, keep the app functional
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant