Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Replace black+usort with ruff #66

Merged
merged 1 commit into from
Mar 26, 2024

Conversation

asullivan-blze
Copy link
Contributor

What and why?

Implements Ruff to take over code formatting, linting, and import ordering from black and usort.

Resolves #65.

How was this tested?

Exercising the altered Makefile commands to verify functionality.

Checklist

  • [n/a] Have you updated the VERSION file (if applicable)?

Implements Ruff to take over code formatting, linting, and import ordering from black and usort.

Resolves #65.
@asullivan-blze asullivan-blze added the enhancement New feature or request label Mar 25, 2024
@asullivan-blze asullivan-blze merged commit 1eb9040 into main Mar 26, 2024
2 checks passed
@asullivan-blze asullivan-blze deleted the asullivan-svreng-256-implement-ruff branch March 26, 2024 21:19
asullivan-blze added a commit that referenced this pull request Apr 3, 2024
`distutils` was removed in Python 3.12, which means `distutils.util.strtobool` got
removed along with it. The guidance from PEP-632--which laid the foundation to
deprecate `distutils`--was to reimplement the `strtobool` (or other functions not
directly addressed by the text of the PEP.

This PR does just that, using CPython 3.11's `distutils` as a reference, and uses
the implementation of `strtobool` along with its test to form the basis for the
function within a utility module.

Additionally, this PR:
- Adds Ruff import ordering. This was missed from #66, since the isort-like behavior
is only enabled if the `I` set of rules is enabled; here, we simply extend the
default set via `lint.extend-select`.
- Adds `pytest` as a dev dependency, and adds pytest into the Makefile and GitHub
Actions workflows as appropriate.

Finally, the version is bumped to 0.8.16, so we can have a clear marker of which
version supports Python 3.12. That said, 0.8.15 is still compatible on CLI workers
with boardwalkd running 0.8.16.

Resolves #67.

Backblaze internal tracking: SVRENG-267
asullivan-blze added a commit that referenced this pull request Apr 3, 2024
* Reimplement strtobool for Python 3.12 compatibility

`distutils` was removed in Python 3.12, which means `distutils.util.strtobool` got
removed along with it. The guidance from PEP-632--which laid the foundation to
deprecate `distutils`--was to reimplement the `strtobool` (or other functions not
directly addressed by the text of the PEP.

This PR does just that, using CPython 3.11's `distutils` as a reference, and uses
the implementation of `strtobool` along with its test to form the basis for the
function within a utility module.

Additionally, this PR:
- Adds Ruff import ordering. This was missed from #66, since the isort-like behavior
is only enabled if the `I` set of rules is enabled; here, we simply extend the
default set via `lint.extend-select`.
- Adds `pytest` as a dev dependency, and adds pytest into the Makefile and GitHub
Actions workflows as appropriate.

Finally, the version is bumped to 0.8.16, so we can have a clear marker of which
version supports Python 3.12. That said, 0.8.15 is still compatible on CLI workers
with boardwalkd running 0.8.16.

Resolves #67.

Backblaze internal tracking: SVRENG-267

* Correct the checklist item relating to version string updates.

The VERSION file is no longer used.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Figure out what's wrong with usort and GitHub Actions
2 participants