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 flake8 E231 #6534

Merged
merged 1 commit into from
Jan 3, 2025
Merged

Fix flake8 E231 #6534

merged 1 commit into from
Jan 3, 2025

Conversation

MetRonnie
Copy link
Member

For some reason, Flake8 was not detecting some problems on python 3.9.

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • No dependency changes
  • Tests are not needed
  • No changelog entry needed
  • No docs needed
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@MetRonnie MetRonnie added this to the 8.4.1 milestone Dec 27, 2024
@MetRonnie MetRonnie requested a review from wxtim December 27, 2024 16:51
@MetRonnie MetRonnie self-assigned this Dec 27, 2024
@MetRonnie MetRonnie changed the title Fix flake8 Fix flake8 E231 Dec 27, 2024
@@ -130,7 +128,8 @@ jobs:
run: etc/bin/shellchecker

- name: MyPy
run: mypy
# specify --python-version to avoid errors regarding site-packages
run: mypy --python-version 3.8
Copy link
Member

Choose a reason for hiding this comment

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

3.7?

Copy link
Member Author

@MetRonnie MetRonnie Jan 3, 2025

Choose a reason for hiding this comment

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

$ mypy --python-version=3.7
[...]/python3.12/site-packages/matplotlib/pyplot.py:246: error: Assignment expressions are only supported in Python 3.8 and greater  [syntax]
Found 1 error in 1 file (errors prevented further checking)

We could split off mypy into its own job on python 3.7. But seeing as we run tests on python 3.7 they should already catch any 3.7-incompatible annotations

Copy link
Member

Choose a reason for hiding this comment

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

Assignment expressions are only supported in Python 3.8 and greater

I think mypy has reported a legit error here that the tests failed to spot! Thankfully this issue only applies to the developer main loop plugins so is of little consequence. Would introducing an upper pin on matplotlib clear the error?

Copy link
Member Author

@MetRonnie MetRonnie Jan 3, 2025

Choose a reason for hiding this comment

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

This version of matplotlib would not install on Python 3.7 so there's no legit error here. It's just that Mypy can't work in Python 3.7 mode when it comes across 3.7-incompatible code in 3rd-party libraries: python/mypy#9972

Copy link
Member Author

Choose a reason for hiding this comment

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

See also #5736

Copy link
Member Author

Choose a reason for hiding this comment

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

Wait I just realised that since we moved to linting in its own job on GH Actions, we're not installing matplotlib during that job so this error is not raised anymore!

Copy link
Member

Choose a reason for hiding this comment

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

Ach dammit, we should probably install the all group, one for another day...

@oliver-sanders oliver-sanders modified the milestones: 8.4.1, 8.4.0 Jan 3, 2025
@oliver-sanders
Copy link
Member

(re-running the failed test)

@MetRonnie MetRonnie removed the request for review from wxtim January 3, 2025 15:29
@MetRonnie MetRonnie merged commit 71f1e9e into cylc:master Jan 3, 2025
27 checks passed
@MetRonnie MetRonnie deleted the flake8 branch January 3, 2025 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants