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

Fix linting: disable mypy --install-types #628

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ ignore-words-list = alers
[mypy]
exclude = ^\.git/|^__pycache__/|^docs/source/conf.py$|^old/|^build/|^dist/|\.tox
python_version = 3.9
install_types = True
Copy link
Contributor

@cclauss cclauss Feb 17, 2024

Choose a reason for hiding this comment

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

Suggested change
install_types = True
install_types = True
non_interactive = True

--install-types prompts for confirmation, breaking the CI.

As discussed in the mypy docs, this is exactly why the --non-interactive option was added so let's use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Potentially. Although I think we'd ideally not have mypy install any type hint packages. I'm still puzzled why it even tries. That might indicate that something else is wrong.

Copy link
Contributor

@cclauss cclauss Feb 17, 2024

Choose a reason for hiding this comment

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

You can either tell mypy everything (constant human effort to align type hints) or allow it to guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, but we already have the type hint packages in .[types], and they only change when our dependencies do. Here, it tries to install types-requests, which is already getting installed (via .[all]), yet somehow mypy can't find it...

Copy link
Contributor

@cclauss cclauss Feb 17, 2024

Choose a reason for hiding this comment

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

What happens if you modify line 69 to more exactly match https://pypi.org/project/types-requests ?

- types-requests>=2.25.0,<3.0.0
+ types-requests>=2.31.0.20240125,<3.0.0.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what you mean. The version dependency on line 69 of setup.cfg matches the one on line 30 for requests (so that it should install matching versions), and we can see that it does install the latest PyPI version here.

Quoting for future reference since the Actions logs expire stupidly quickly:

Run pip install .[all]
<...>
Collecting requests<3.0.0,>=2.25.0 (from internetarchive==3.6.0)
  Downloading requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
<...>
Collecting types-requests<3.0.0,>=2.25.0 (from internetarchive==3.6.0)
  Downloading types_requests-2.31.0.20240125-py3-none-any.whl.metadata (1.8 kB)
<...>
Downloading requests-2.31.0-py3-none-any.whl (62 kB)
<...>
Downloading types_requests-2.31.0.20240125-py3-none-any.whl (14 kB)
<...>
Installing collected packages: <...>, types-requests, <...>, requests, <...>
Successfully installed <...> requests-2.31.0 <...> types-requests-2.31.0.20240125 <...>

pretty = True
scripts_are_modules = True
show_error_codes = True
Expand Down
Loading