Skip to content

Apply ruff/pyupgrade rules UP031 and UP032 - #261

Merged
mattip merged 2 commits into
python-cffi:mainfrom
DimitriPapadopoulos:UP031-UP032
Oct 27, 2026
Merged

mattip merged 2 commits into
python-cffi:mainfrom
DimitriPapadopoulos:UP031-UP032

Conversation

@DimitriPapadopoulos

@DimitriPapadopoulos DimitriPapadopoulos commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

These are automatic fixes using:
* `--select UP031 --fix --unsafe-fixes`
* `--select UP032 --fix`
These are manual fixes
@DimitriPapadopoulos
DimitriPapadopoulos marked this pull request as ready for review October 25, 2026 15:26
}
""" % (source, ' '.join(setters)))
}}
""".format(source, ' '.join(setters)))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I read up to here, but am not sure about some of these. Is this really better than what we had?

@DimitriPapadopoulos DimitriPapadopoulos Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It depends from the point of view. These ruff rules update the code to use current Python constructs: f-strings - and format() where f-strings don't work well. I think the idea is that compliance with ruff rules results in more standard and efficient source code. Python has evolved from a simple script language with "one - and preferably only one - obvious way to do it" to a complex language. Standard formatting and linting brings back some simplicity, in the spirit of more recent languages such as Go or Rust that have learned from the "Perl-ification" of Python.

@mattip mattip left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OK, LGTM.

@mattip
mattip merged commit 07f386b into python-cffi:main Oct 27, 2026
74 of 76 checks passed
@DimitriPapadopoulos
DimitriPapadopoulos deleted the UP031-UP032 branch October 27, 2026 16:34
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.

2 participants