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

Enable MYPY for tests and fix typing bugs #527

Merged
merged 26 commits into from
Nov 13, 2020
Merged

Enable MYPY for tests and fix typing bugs #527

merged 26 commits into from
Nov 13, 2020

Conversation

Skylion007
Copy link
Contributor

Motivation and Context

Caught quite a few typing bugs by using mypy and typeguard on the test suite. I was considering enabling TypeGuard for Habitat-Lab, but it seemed a bit to strict and I couldn't remove all the cyclic dependencies easily.

This does fix quite a few typing bugs though. The other option is that we could keep typeguard, but only enable it for the habitat-sim package.

I also enabled a few new mypy options that caught quite a few typing bugs especially with ObservationTransformers.

Improved testing

How Has This Been Tested

Pytest

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Nov 10, 2020
@Skylion007 Skylion007 merged commit f89d53e into master Nov 13, 2020
@Skylion007 Skylion007 deleted the typeguard_test branch November 13, 2020 15:57

import attr
import numpy as np
import torch
Copy link
Contributor

Choose a reason for hiding this comment

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

@Skylion007, this is the only line dependent on PyTorch in Hab-Lab core. Is there a way we can guard it under TYPE_CHECKING?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

dannymcy pushed a commit to dannymcy/habitat-lab that referenced this pull request Jul 8, 2024
* Tell user to upgrade habitat_sim

* run black

* typefixes

* Fix typing errors

* Fix pytest

* Fix another typing error

* Fix typing even more

* Fix do_pause testing

* Loosen typing

* Fix another obs_transformer typing error

* Relax typing

* Fix one last tuple error

* Fix utils typing

* Add longer timeout

* Fix int division

* Fix episode_id

* Fix cyclic import and typing

* Remove more type_checking guards

* Remove another typeguard

* Disable typeguard for now

* Fix mypy static testing bugs

* Undo unreachable remove

* Remove duplicate

* Remove typeguard

* Simplify registry typing
HHYHRHY pushed a commit to SgtVincent/habitat-lab that referenced this pull request Aug 31, 2024
* Tell user to upgrade habitat_sim

* run black

* typefixes

* Fix typing errors

* Fix pytest

* Fix another typing error

* Fix typing even more

* Fix do_pause testing

* Loosen typing

* Fix another obs_transformer typing error

* Relax typing

* Fix one last tuple error

* Fix utils typing

* Add longer timeout

* Fix int division

* Fix episode_id

* Fix cyclic import and typing

* Remove more type_checking guards

* Remove another typeguard

* Disable typeguard for now

* Fix mypy static testing bugs

* Undo unreachable remove

* Remove duplicate

* Remove typeguard

* Simplify registry typing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants