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

Become compatible with flake8 5.0.0 #259

Merged
merged 5 commits into from
Aug 2, 2022
Merged

Become compatible with flake8 5.0.0 #259

merged 5 commits into from
Aug 2, 2022

Conversation

AlexWaygood
Copy link
Collaborator

Fixes #257

@AlexWaygood AlexWaygood marked this pull request as ready for review July 31, 2022 23:19
Comment on lines +50 to +57
warnings.warn(
(
"flake8-pyi will drop support for running with flake8 < 5.0.0 "
"in a future version. This will not happen until November 2022 "
"at the earliest."
),
category=FutureWarning,
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I manually verified that this warning is emitted if the plugin is run in an environment with flake8==4.x installed. Other than that, the test suite still passes for me locally with flake8==4.x installed.

@AlexWaygood
Copy link
Collaborator Author

Thanks both for the reviews!

@AlexWaygood AlexWaygood merged commit 769f831 into master Aug 2, 2022
@AlexWaygood AlexWaygood deleted the flake8v5 branch August 2, 2022 18:38
@sobolevn
Copy link
Member

sobolevn commented Oct 5, 2022

I understand that I am late to the party, but please reconsider this.

flake8 has enough problems alredy:

  • It does not play well with importlib-metadata and does not want to do anything about it for 2 years
  • It is almost impossible to use correct version resolution for flake8 / importlib-metadata / other packages that require importlib-metadata
  • Most likely it will mean that we will have to drop python3.7 support as well

Here's what we do for now:

  1. https://github.com/wemake-services/wemake-python-styleguide/blob/60023c9ca95e56197a8af318d7fb88f7a84d9ad5/pyproject.toml#L50-L53
  2. https://github.com/wemake-services/wemake-python-styleguide/blob/60023c9ca95e56197a8af318d7fb88f7a84d9ad5/pyproject.toml#L58
  3. But it is still not enough: https://github.com/wemake-services/wemake-python-styleguide/actions/runs/3180761218/jobs/5184717583#step:6:34

@AlexWaygood
Copy link
Collaborator Author

AlexWaygood commented Oct 5, 2022

Hey @sobolevn! Sorry to hear this has been causing pain :(

Very happy to be flexible here. I understand there's a bit of an importlib_metadata/flake8 incompatibility problem at the moment, and I don't think any of us want to aggravate that.

Could you be specific about what exactly is causing problems from flake8-pyi's end here, and what you'd like to see changed? Then we can see what we can do to fix it :)

@sobolevn
Copy link
Member

sobolevn commented Oct 5, 2022

Requiring flake8>=5.0 will cause importlib-metadata conflicts for all projects using python3.7 and other deps that require recent importlib-metadata versions. Like sphinx, pytest-randomly, and many others that pin importlib-metadata for >=4.3

Definition: https://github.com/PyCQA/flake8/blob/b220ee957aca37ae5919509f6f25dd571a836d52/setup.cfg#L44

@AlexWaygood
Copy link
Collaborator Author

Cool. So would it "fix" it for you if we extended the period before we drop support for flake8<5? Or would you prefer it if we dropped the FutureWarning altogether?

I'd prefer the first option ideally, but either could be doable :)

@sobolevn
Copy link
Member

sobolevn commented Oct 5, 2022

I think that dropping older versions of flake8 is fine when 3.7 is dropped.

@AlexWaygood
Copy link
Collaborator Author

@sobolevn, I've filed #293, to delay removing support for running with flake8 <5 until Python 3.7 is EOL :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flake8-pyi <22.8.1 is broken using flake8 >=5.0.0
4 participants