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

CI: Pylint 3.x #3110

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

CI: Pylint 3.x #3110

wants to merge 10 commits into from

Conversation

pajod
Copy link
Contributor

@pajod pajod commented Dec 8, 2023

Included:

  • pylint 3.0.0 workarounds (because 3.x is what we want for Python 3.12)
  • removing references to ancient Debian releases (updating which is not helpful as long as the versions distributed remain the same)

Removed:

Not included:

  • Arbiter.SIG_NAMES (stdlib since 3.5 provides signal.Signals Enum) and related comments

Suggested order: Merge #3148 or equivalent first, possibly eradicating the identifier clash in a simpler manner.

Copy link
Collaborator

@tilgovi tilgovi left a comment

Choose a reason for hiding this comment

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

Would it be possible to just extract the changes to the Python version support and skip the rest, please? I'm not seeing the(pylint comments, inotify import changes, or signal import renaming as relevant to the PR description.

.github/workflows/tox.yml Outdated Show resolved Hide resolved
gunicorn/arbiter.py Outdated Show resolved Hide resolved
gunicorn/reloader.py Outdated Show resolved Hide resolved
@cclauss
Copy link
Contributor

cclauss commented Dec 28, 2023

This branch has git conflicts that must be resolved

@tilgovi
Copy link
Collaborator

tilgovi commented Dec 28, 2023

@pajod I'm happy to review the linting-related changes in this PR or separate, your choice. Let's just get the pypy version fixed up and I think we're good to go.

@pajod pajod changed the title CI: add CPython 3.12 and PyPy3.10, stop promising untested versions CI: Python 3.12 fixes Dec 28, 2023
@pajod pajod marked this pull request as draft December 28, 2023 20:51
@iM-GeeKy
Copy link

Is there a timeline when this will be merged?

@pajod pajod changed the title CI: Python 3.12 fixes CI: Pylint 3.x Apr 22, 2024
@pajod pajod force-pushed the patch-py12 branch 2 times, most recently from 3b665a4 to f950046 Compare April 22, 2024 01:47
@pajod pajod marked this pull request as ready for review April 22, 2024 01:56
@pajod pajod force-pushed the patch-py12 branch 3 times, most recently from 4f21dea to c613240 Compare July 31, 2024 16:26
@pajod
Copy link
Contributor Author

pajod commented Aug 7, 2024

@tilgovi Care to give this another look? Updated a bit after extracting #3131 into a separate PR.

@benoitc
Copy link
Owner

benoitc commented Aug 10, 2024

@pajod why a change to the reloadedr is part of this change?

@pajod
Copy link
Contributor Author

pajod commented Aug 12, 2024

@benoitc 2nd attempt for comment marked "outdated" above. I want newer pylint versions to stop suggesting that inotify might be undefined in the separate conditional, without suppressing that (generally useful!) detection too much:

gunicorn/reloader.py:69:22: E0601: Using variable 'inotify' before assignment (used-before-assignment)
gunicorn/reloader.py:79:28: E0606: Possibly using variable 'Inotify' before assignment (possibly-used-before-assignment)

The previous version you commented on moved the alternate reloader implementation to an extra file, so the imports are seen as unconditional (within that file) to static analysis.

Most recent rebased version is the simple solution without extra file again by duplicating the import: much smaller diff for typically similar cost.

@cclauss
Copy link
Contributor

cclauss commented Aug 12, 2024

To fix those two pylint errors, you can change


to read
inotify = None

if sys.platform.startswith('linux'):
try:
import inotify.constants as _
from inotify.adapters import Inotify
import inotify.constants
has_inotify = True
except ImportError:
pass
Copy link
Contributor

@cclauss cclauss Aug 12, 2024

Choose a reason for hiding this comment

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

The other changes are not needed to placate pylint.

Suggested change
pass
inotify = None

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Almost, because we have two conditionals (the remainder of the sys.platform branch must be covered aswell) and import two things. But while mypy hates this, pylint seems OK with being tricked by the two-line version, see https://github.com/benoitc/gunicorn/pull/3110/files#diff-f807d81a0dfb3d826a7b566e4902c676f12447b6d5c442d4c291edca727b6cb5

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

Successfully merging this pull request may close these issues.

5 participants