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

Make mypy checks opt-out instead of opt-in, fix several type issues #3027

Merged
merged 20 commits into from
Oct 26, 2023

Conversation

lostella
Copy link
Contributor

@lostella lostella commented Oct 24, 2023

Description of changes:

  • Fix several type issues through the package
  • Mark many other failing checks as "ignore", either because there's too much code to go through otherwise (rotbaum), or because it would be impractical to ensure checks passing
  • Update setup.py to use an opt-out mechanism for type checking, instead of opt-in
  • Remove all .typesafe files, add a .typeunsafe file to gluonts.nursery to opt it out
  • Marking as BREAKING because some code moved from gluonts.torch.distributions to gluonts.torch.model.mqf2

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Please tag this pr with at least one of these labels to make our release process faster: BREAKING, new feature, bug fix, other change, dev setup

@lostella lostella added this to the v0.14 milestone Oct 24, 2023
@lostella
Copy link
Contributor Author

lostella commented Oct 24, 2023

Todos:

  • get rid of a circular import I introduced (may need to break some import path there, but for good reasons)
  • solve mypy complaints about "duplicate modules" (see following, also here)
src/gluonts/torch/model/deep_npts/__init__.py: error: Duplicate module named "gluonts.torch.model.deep_npts" (also at "/home/runner/work/gluonts/gluonts/src/gluonts/torch/model/deep_npts/__init__.py")
src/gluonts/torch/model/deep_npts/__init__.py: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#mapping-file-paths-to-modules for more info
src/gluonts/torch/model/deep_npts/__init__.py: note: Common resolutions include: a) using `--exclude` to avoid checking one of them, b) adding `__init__.py` somewhere, c) using `--explicit-package-bases` or adjusting MYPYPATH
  • make the type-checking mechanism opt-out, and opt-out problematic packages in gluonts.nursery

@lostella lostella added the BREAKING This is a breaking change (one of pr required labels) label Oct 24, 2023
@shchur shchur marked this pull request as ready for review October 25, 2023 11:56
@shchur shchur self-requested a review October 25, 2023 11:56
src/gluonts/model/forecast.py Show resolved Hide resolved
src/gluonts/torch/model/lightning_util.py Outdated Show resolved Hide resolved
src/gluonts/torch/model/wavenet/estimator.py Outdated Show resolved Hide resolved
src/gluonts/torch/model/wavenet/module.py Show resolved Hide resolved
@lostella lostella requested review from shchur and jaheba October 25, 2023 19:02
@lostella lostella changed the title Fix type checking issues in gluonts.torch Make mypy checks opt-out instead of opt-in, fix several type issues Oct 25, 2023
@lostella lostella added bug fix (one of pr required labels) enhancement New feature or request and removed bug fix (one of pr required labels) labels Oct 25, 2023
jaheba
jaheba previously approved these changes Oct 26, 2023
@lostella lostella merged commit 76f5fe4 into awslabs:dev Oct 26, 2023
19 checks passed
@lostella lostella deleted the torch-mypy branch October 26, 2023 07:52
@lostella lostella added the pending v0.14.x backport This contains a fix to be backported to the v0.14.x branch label Oct 26, 2023
ddelange added a commit to ddelange/gluonts that referenced this pull request Oct 26, 2023
* 'dev' of https://github.com/awslabs/gluonts:
  Make `mypy` checks opt-out instead of opt-in, fix several type issues (awslabs#3027)
lostella added a commit to lostella/gluonts that referenced this pull request Oct 27, 2023
lostella added a commit that referenced this pull request Oct 27, 2023
* Fix WaveNet inputs (#3022)

* Fix version range for lightning (#3023)

* Allow VCS install using GLUONTS_FALLBACK_VERSION (#3028)

* Make `mypy` checks opt-out instead of opt-in, fix several type issues (#3027)

Co-authored-by: Oleksandr Shchur <[email protected]>

* No API docs for nursery. (#3030)

* Fix: #3030. (#3031)

* Add support for Pydantic v1 and v2. (#3026)

---------

Co-authored-by: Oleksandr Shchur <[email protected]>
Co-authored-by: ddelange <[email protected]>
Co-authored-by: Jasper <[email protected]>
@lostella lostella removed the pending v0.14.x backport This contains a fix to be backported to the v0.14.x branch label Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BREAKING This is a breaking change (one of pr required labels) enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants