Skip to content

Require Python 3.11 and modernize CI with Ruff and mypy - #396

Merged
shcheklein merged 2 commits into
mainfrom
ci-ruff-runners
Nov 20, 2026
Merged

shcheklein merged 2 commits into
mainfrom
ci-ruff-runners

Conversation

@shcheklein

@shcheklein shcheklein commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

All 15 jobs passed on Python 3.11–3.15 across Ubuntu, macOS, and
Windows. Ruff, mypy, and the docs build passed on the same commit.
Branch test run · Lint and types · Docs build

Changes

  • Require Python 3.11 or newer, drop the resources backport, and use the
    standard library in the PyInstaller hook test.
  • Test Python 3.11 through 3.15 on the latest Ubuntu, macOS, and Windows
    runners. Add a manual trigger so changes to the test workflow can be
    verified on the pull request branch. Use Python 3.12 to build docs and
    distributions.
  • Replace Black and Flake8 with Ruff locally and in CI. Inherit the Ruff
    defaults and enable import sorting, Python upgrades, typing checks, and
    the existing 89-column lint limit. The formatter retains 79 columns.
    Ruff infers Python 3.11 from the package metadata. Run mypy on the
    library, including unannotated function bodies, for the same minimum.
  • Use the standard library to flatten test results. The parallel upload
    test now retries incomplete Drive listings and compares the returned IDs
    to the IDs of the uploaded files.

This CI change targets main independently of the auth migration in #395.
It supersedes #390 and #397.
The Python minimum is a breaking change for users on 3.8, 3.9, and 3.10.

Verification

Local Ruff checks, formatting, pre-commit hooks, and mypy pass. The Sphinx
docs, wheel, and source distribution build. The frozen PyInstaller app
found Drive's discovery document on Python 3.15.

The automatic PR test workflow reads its matrix from main. Its six failures
are the old 3.9 and 3.10 jobs. Ubuntu 26.04 cannot provision Python 3.9,
and pip rejects the package on the other five jobs because it requires
Python 3.11 or newer. Automatic test run

@shcheklein shcheklein changed the title ci: replace Black and Flake8 with Ruff and fix the hosted runners Require Python 3.11 and modernize CI with Ruff and mypy Nov 20, 2026
@shcheklein
shcheklein requested a balanced review from Copilot November 20, 2026 02:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block the Python baseline, tooling, and CI modernization.

No open issues 🎉

What changed in this PR

Modernizes PyDrive2’s Python baseline, development tools, and CI independently of the authentication migration in #395.

Changes:

  • Require Python 3.11+, test Python 3.11–3.15, and use Python 3.12 for documentation and distribution builds.
  • Replace Black and Flake8 with Ruff, add mypy checks, and document the development commands.
  • Modernize library code and examples, use standard-library resources, and strengthen parallel-upload verification.
File Description
README.rst Document the Python 3.11 minimum.
pyproject.toml Update Python support, dependencies, and Ruff/mypy configuration.
pydrive2/​test/​test_util.py Flatten results with itertools.chain and modernize formatting.
pydrive2/​test/​test_oauth.py Sort imports.
pydrive2/​test/​test_fs.py Modernize imports, comprehensions, and context managers.
pydrive2/​test/​test_filelist.py Simplify result collection and string formatting.
pydrive2/​test/​test_file.py Retry incomplete listings, verify uploaded IDs, and use pathlib.
pydrive2/​test/​test_drive.py Sort imports.
pydrive2/​test/​test_apiattr.py Sort imports.
pydrive2/​settings.py Simplify YAML loader selection and error formatting.
pydrive2/​fs/​spec.py Add cache type annotations and simplify expressions.
pydrive2/​files.py Add typing-compatible guards and simplify existing code.
pydrive2/​drive.py Consolidate and sort imports.
pydrive2/​auth.py Annotate class variables and modernize error formatting.
pydrive2/​apiattr.py Combine equivalent change-detection conditions.
pydrive2/​__pyinstaller/​test_hook-googleapiclient.py Verify the Drive discovery document using standard-library resources.
pydrive2/​__pyinstaller/​hook-googleapiclient.py Sort hook imports.
examples/​using_folders.py Use f-string output.
examples/​Upload-and-autoconvert-to-Google-Drive-Format-Example/​upload.py Correct argument validation and modernize exit/query syntax.
examples/​strip_bom_example.py Simplify example output formatting.
docs/​conf.py Sort imports and remove the obsolete encoding header.
CONTRIBUTING.rst Document tool installation, Ruff, and mypy commands.
.pre-commit-config.yaml Replace Black/Flake8 hooks with Ruff hooks.
.github/​workflows/​test.yml Expand the Python matrix and add manual execution.
.github/​workflows/​publish.yml Update actions and build distributions with Python 3.12.
.github/​workflows/​pre-commit.yml Run Ruff checks and add a mypy job.
.github/​workflows/​docs.yml Update actions and build documentation with Python 3.12.
.flake8 Remove the superseded Flake8 configuration.

Review effort: Balanced

@shcheklein
shcheklein merged commit 8664553 into main Nov 20, 2026
28 of 34 checks passed
@shcheklein
shcheklein deleted the ci-ruff-runners branch November 20, 2026 04:17

This branch was previously deployed

1 inactive deployment
internal — 68a8aaa6 Deployed Nov 20, 2026 by shcheklein via authorize #553
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