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

add flake8 python version check script and CI check #431

Merged
merged 4 commits into from
Nov 30, 2023

Conversation

r-downing
Copy link
Contributor

@r-downing r-downing commented Nov 30, 2023

from #365

Made a quick standalone python script. Uses curl (so no need to pip install requests or anything else) to get pypy json info for flake8. Grabs the requires-python = ... line from pyproject.toml and compares the two, will throw an error if they don't match.

Note - chose to get bugbear version from pyproject.toml rather than fetching bugbear json because then the test would fail until a bugbear update was uploaded to pypi.

Not sure about naming or folder placement - just stuck it in a scripts folder.

Testing:

Made it run on push, and changed the python version in pyproject.toml to see it fail. Sample error output

error output:
Run python scripts/flake8_py_version_check.py
Traceback (most recent call last):
  File "/home/runner/work/flake8-bugbear/flake8-bugbear/scripts/flake8_py_version_check.py", line 3[4](https://github.com/r-downing/flake8-bugbear/actions/runs/7041812391/job/19164955564#step:3:5), in <module>
    main()
  File "/home/runner/work/flake[8](https://github.com/r-downing/flake8-bugbear/actions/runs/7041812391/job/19164955564#step:3:9)-bugbear/flake8-bugbear/scripts/flake8_py_version_check.py", line 2[9](https://github.com/r-downing/flake8-bugbear/actions/runs/7041812391/job/19164955564#step:3:10), in main
    flake8_requires == flake8_bugbear_requires
AssertionError: python version requirements don't match: (flake8_requires='>=3.8.1' != flake8_bugbear_requires='>=3.8.0')

Fixes #365

Copy link
Collaborator

@cooperlees cooperlees left a comment

Choose a reason for hiding this comment

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

Thanks. I like not having to check and be able to be lazy. This is all good to me but offered some suggestions. If you don't want to spend time doing them, that's fine, just say so and I'll do them one day.

  • I don't like to block merging on nit picks / nice to haves :)
    • especially on simple scripts like this :)

scripts/flake8_py_version_check.py Outdated Show resolved Hide resolved
.github/workflows/flake8_py_version_check.yml Show resolved Hide resolved
scripts/flake8_py_version_check.py Outdated Show resolved Hide resolved
Comment on lines +29 to +32
assert flake8_requires == flake8_bugbear_requires, (
f"python version requirements don't match: ({flake8_requires=} !="
f" {flake8_bugbear_requires=})"
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thankyou for the verbose assert failing message :)

@cooperlees cooperlees merged commit 09f44c3 into PyCQA:main Nov 30, 2023
6 checks passed
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.

Move to >= 3.8.1 like flake8 + maybe add a CI check somehow
2 participants