Skip to content

Copier update: pyrefly - #71

Merged
ejfine merged 14 commits into
mainfrom
cop-pyrefly
Aug 24, 2026
Merged

ejfine merged 14 commits into
mainfrom
cop-pyrefly

Conversation

@ejfine

@ejfine ejfine commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Why is this change necessary?

Update do use pyrefly

How does this change address the issue?

Two distinct parts.

1. Template sync — the bulk of the diff, applied from copier-base-template. Mostly generated; the files it owns are listed in .config/.copier-managed-files.json.

2. Making the codebase pass pyrefly — 45 errors, in five groups:

Count Error kind Root cause Fix
11 bad-assignment, bad-argument-type, bad-return lxml-stubs 0.5.1 declares attributes with PEP 484 type comments (text = ... # type: Optional[str]), which pyrefly does not read, so it inferred _Element.text as Ellipsis swapped to types-lxml
14 explicit-any dict[str, Any] on the XML payload dicts threaded through the step classes pydantic.JsonValue, object, or dropped annotations
10 implicit-reexport src/pyalab/steps/__init__.py re-exported without declaring intent added __all__
3 bad-argument-type steps/*.py imported the package absolutely (from pyalab.plate import ...) while the rest of src used relative imports, so one class resolved under two module names and read as two nominal types made those imports relative
3 implicit-bool, implicitly-defined-attribute, unused-type-ignore one-offs explicit is not None loop, declared private attr, deleted a stale pyright ignore

Result: pyrefly reports 0 errors, with 3 suppressions (see below).

Two naming fixes came out of reading the code closely, both pure renames with no type or behavior change:

  • _add_location_group's well_info → multi_selection. Three Step methods took a well_info parameter; two received a single well ({Item1, Item2}) while this one received a list of selection payloads that merely contain a wells list. It serializes under the XML key MultiSelection, so it is now named for that.
  • the corresponding source_info / target_info locals → source_selection / target_selection.

Separately, 3 pre-existing PLR0917 ruff violations are fixed. Each already carried a deliberate # noqa: PLR0913; PLR0917 is that rule's sibling for positional argument count and was never suppressed. All three genuinely cannot go keyword-only (a Sphinx callback signature, and two parametrized tests), so the existing noqa was extended with reasoning.

What side effects does this change have?

  • New dev dependency, with transitives. lxml-stubs → types-lxml pulls in types-html5lib, types-webencodings, cssselect, soupsieve, beautifulsoup4. All dev-only; runtime dependencies are unchanged. Worth noting lxml-stubs 0.5.1 is the latest release and dates from 2024-01-10, whereas types-lxml is actively maintained.
  • Type checker coverage shifts. pyright no longer sees src. If you rely on pyright diagnostics in the editor for library code, that is now pyrefly's job.
  • Config paths moved into .config/. Anything invoking these tools directly needs the new paths; pre-commit run <hook-id> handles it already.
  • 3 pyrefly suppressions, all in tests, all same-line with reasoning. They sit on kwargs dicts spread into a pydantic constructor where entries are omitted so the constructor defaults get exercised, making the value type heterogeneous by construction. dict[str, object] is rejected on the unpack and a TypedDict cannot be built from a comprehension, so neither alternative works. src/ itself contains no Any and no suppressions.
  • No public API change and no change to generated XML.

How is this change tested?

Existing CI

ejfine added 12 commits August 22, 2026 10:10
Resolves the remaining explicit-any errors, leaving pyrefly at 0.

src is now free of Any entirely:
- the XML payload dicts threaded through the step classes become
  dict[str, JsonValue], which is what they actually are on their way
  to json.dumps
- WORKING_DIRECTION_KWARGS and volume_info drop their annotations so
  the type is inferred rather than asserted
- model_post_init's discarded parameter widens to object

The three remaining sites are test-only. They build a dict of kwargs to
spread into a pydantic constructor, omitting entries so the constructor
defaults get exercised, so the value type is heterogeneous by
construction. dict[str, object] is rejected on the unpack and a TypedDict
cannot be built from a comprehension, so these carry an inline pyrefly
suppression instead.
The dependency swap to types-lxml changed pyproject.toml and uv.lock,
which are part of the devcontainer build context.
The parameter is a list of selection payloads, each containing a Wells
list alongside the deck section, spacing and working direction --- not
the single well that the identically named parameters on
_add_mix_group and _create_heights_value_tuple receive. It is
serialized under the MultiSelection key, so name it for that.
…election

Each of these locals has exactly one use, as the multi_selection
argument to _add_location_group. Naming them for what they are keeps
the two halves of that call consistent.
…mage

hadolint v2.15.1, which the template update pins, adds DL3066: a
username may not be resolvable by the host system, so a UID is
preferred. v2.14.0 did not report this.

root is UID 0, so the build is unchanged. This switch is build-time
only --- the final USER remains ${NB_USER} at UID 1000, which is what
repo2docker requires of the image's primary user.
@coderabbitai

coderabbitai Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 131 files, which is 31 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 46c99b3c-bf7a-44fa-8301-dd8ff3c314ed

📥 Commits

Reviewing files that changed from the base of the PR and between 3e36b19 and 5398e07.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (131)
  • .claude/.beads/.gitignore
  • .claude/.beads/config.yaml
  • .claude/CLAUDE.md
  • .claude/commands/add-command.md
  • .claude/commands/commit.md
  • .claude/commands/create-adr.md
  • .claude/commands/create-issues.md
  • .claude/commands/gap.md
  • .claude/commands/green.md
  • .claude/commands/issue.md
  • .claude/commands/polish.md
  • .claude/commands/red.md
  • .claude/commands/refactor.md
  • .claude/commands/research.md
  • .claude/commands/simplify.md
  • .claude/commands/spike.md
  • .claude/commands/summarize.md
  • .claude/commands/tdd-review.md
  • .claude/commands/tdd.md
  • .claude/helpers/merge-claude-settings.sh
  • .claude/hooks/bash-chain-guard.js
  • .claude/hooks/caveman-activate.js
  • .claude/hooks/caveman-config.js
  • .claude/hooks/caveman-mode-tracker.js
  • .claude/settings/basics.jsonc
  • .claude/settings/hooks.jsonc
  • .claude/settings/models.jsonc
  • .claude/settings/permissions/additional-dirs.jsonc
  • .claude/settings/permissions/bash.jsonc
  • .claude/settings/permissions/read.jsonc
  • .claude/settings/permissions/write.jsonc
  • .claude/skills/address-pr-comments/SKILL.md
  • .claude/skills/address-pr-comments/check-footer.py
  • .claude/skills/address-pr-comments/commit-link.py
  • .claude/skills/address-pr-comments/fetch-pr-comments.py
  • .claude/skills/address-pr-comments/post-reply.py
  • .claude/skills/address-pr-comments/utils.py
  • .claude/skills/address-pr-comments/verify-env.py
  • .claude/skills/caveman/SKILL.md
  • .claude/skills/fix-mutants/SKILL.md
  • .claude/skills/fix-mutants/check-results.py
  • .claude/skills/fix-mutants/group-by-line.py
  • .claude/skills/fix-mutants/list-survived.py
  • .claude/skills/fix-mutants/run-mutmut.py
  • .claude/skills/fix-mutants/show-mutant.py
  • .claude/skills/fix-mutants/utils.py
  • .claude/skills/fix-mutants/verify-mutant.py
  • .coderabbit.yaml
  • .config/.copier-answers.yml
  • .config/.copier-managed-files.json
  • .config/.coveragerc
  • .config/.prettierrc
  • .config/_typos.toml
  • .config/pylintrc.toml
  • .config/pyrefly.mutmut.toml
  • .config/pyrefly.toml
  • .config/ruff-non-src.toml
  • .config/ruff.toml
  • .devcontainer/Dockerfile
  • .devcontainer/code-artifact-auth.sh
  • .devcontainer/create-aws-profile.sh
  • .devcontainer/devcontainer.json
  • .devcontainer/docker-compose.yml
  • .devcontainer/initialize-command.sh
  • .devcontainer/install-ci-tooling.py
  • .devcontainer/manual-setup-deps.py
  • .devcontainer/on-create-command-boilerplate.sh
  • .devcontainer/on-create-command.sh
  • .devcontainer/post-start-command.sh
  • .devcontainer/windows-host-helper.sh
  • .github/.codecov.yml
  • .github/CODE_OF_CONDUCT.md
  • .github/CONTRIBUTING.md
  • .github/ISSUE_TEMPLATE/bug-report.yml
  • .github/ISSUE_TEMPLATE/config.yml
  • .github/ISSUE_TEMPLATE/feature-request.yml
  • .github/ISSUE_TEMPLATE/tech-debt.yml
  • .github/actions/check-skip-duplicates/action.yml
  • .github/actions/ecr-auth/action.yml
  • .github/actions/install_deps/action.yml
  • .github/actions/update-devcontainer-hash/action.yml
  • .github/dependabot.yml
  • .github/pull_request_template.md
  • .github/workflows/ci.yaml
  • .github/workflows/confirm-on-tagged-copier-template.yaml
  • .github/workflows/extract_project_version.py
  • .github/workflows/get-values.yaml
  • .github/workflows/git_tag.py
  • .github/workflows/hash_git_files.py
  • .github/workflows/pre-commit.yaml
  • .github/workflows/publish.yaml
  • .github/workflows/publish_to_staging.yaml
  • .github/workflows/release.yaml
  • .gitignore
  • .pre-commit-config.yaml
  • .python-version
  • .readthedocs.yaml
  • AGENTS.md
  • CHANGELOG.md
  • CLAUDE.md
  • Dockerfile
  • LICENSE
  • README.md
  • biome.jsonc
  • docs/Makefile
  • docs/_static/.gitkeep
  • docs/conf.py
  • docs/index.rst
  • docs/make.bat
  • docs/requirements.txt
  • pyproject.toml
  • pyrightconfig.json
  • pytest.ini
  • scripts/delete_false_positive_rej.py
  • sh.bat
  • src/pyalab/integra_xml.py
  • src/pyalab/program.py
  • src/pyalab/steps/__init__.py
  • src/pyalab/steps/base.py
  • src/pyalab/steps/builders.py
  • src/pyalab/steps/multi_dispense.py
  • src/pyalab/steps/params.py
  • src/pyalab/steps/set_volume.py
  • src/pyalab/steps/transfer.py
  • tests/__init__.py
  • tests/conftest.py
  • tests/unit/__init__.py
  • tests/unit/conftest.py
  • tests/unit/method_steps/test_multi_dispense.py
  • tests/unit/method_steps/test_simple_transfer.py
  • ty.toml

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/pyalab/integra_xml.py 100.00% <100.00%> (ø)
src/pyalab/program.py 100.00% <100.00%> (ø)
src/pyalab/steps/__init__.py 100.00% <100.00%> (ø)
src/pyalab/steps/base.py 100.00% <100.00%> (ø)
src/pyalab/steps/builders.py 100.00% <100.00%> (ø)
src/pyalab/steps/multi_dispense.py 100.00% <100.00%> (ø)
src/pyalab/steps/params.py 100.00% <100.00%> (ø)
src/pyalab/steps/set_volume.py 100.00% <100.00%> (ø)
src/pyalab/steps/transfer.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Pull request overview

Updates the repository’s Copier templates and migrates source type checking from Pyright to Pyrefly.

Changes:

  • Adds Pyrefly configuration and resolves typing errors.
  • Updates template-managed CI, release, development, and agent tooling.
  • Adds mutation-testing utilities and dependency updates.

Template-managed fixes should be applied to the owning base or Python-package template and re-synced.

Reviewed changes

Copilot reviewed 129 out of 132 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ty.toml Removes obsolete type-checker configuration.
tests/unit/method_steps/test_simple_transfer.py Updates lint and Pyrefly suppressions.
tests/unit/method_steps/test_multi_dispense.py Updates lint and Pyrefly suppressions.
tests/unit/conftest.py Adds template ownership notice.
tests/unit/__init__.py Establishes the unit-test package.
tests/conftest.py Registers assertion rewriting.
tests/__init__.py Establishes the test package.
src/pyalab/steps/transfer.py Refines payload types and naming.
src/pyalab/steps/set_volume.py Removes unnecessary Any annotation.
src/pyalab/steps/params.py Uses relative imports.
src/pyalab/steps/multi_dispense.py Refines payload types and naming.
src/pyalab/steps/builders.py Uses JsonValue and relative imports.
src/pyalab/steps/base.py Adds Pyrefly-compatible state and payload types.
src/pyalab/steps/__init__.py Declares intentional exports.
src/pyalab/program.py Removes stale suppression and Any.
src/pyalab/integra_xml.py Expands filtering for branch coverage.
sh.bat Adds template ownership notice.
scripts/delete_false_positive_rej.py Adds template ownership notice.
README.md Documents release and Copier workflows.
pytest.ini Points coverage at the relocated configuration.
pyrightconfig.json Restricts Pyright to consumer-style test checking.
pyproject.toml Updates typing, testing, and mutation dependencies.
LICENSE Adds template ownership notice.
docs/requirements.txt Adds template ownership notice.
docs/Makefile Adds template ownership notice.
docs/make.bat Adds template ownership notice.
docs/index.rst Adds template ownership notice.
docs/conf.py Updates callback lint suppression.
docs/_static/.gitkeep Adds template ownership notice.
Dockerfile Uses numeric root UID.
CLAUDE.md Removes superseded root configuration.
CHANGELOG.md Adds template ownership notice.
biome.jsonc Adds template ownership notice.
AGENTS.md Expands development and review guidance.
.readthedocs.yaml Adds template ownership notice.
.python-version Updates generated formatting.
.pre-commit-config.yaml Adds Pyrefly and updates hooks/config paths.
.gitignore Ignores mutation output.
.github/workflows/release.yaml Adds the consolidated release workflow.
.github/workflows/publish.yaml Updates actions and tag handling.
.github/workflows/publish_to_staging.yaml Updates action versions.
.github/workflows/pre-commit.yaml Reworks pre-commit caching.
.github/workflows/hash_git_files.py Normalizes line endings while hashing.
.github/workflows/git_tag.py Separates version extraction from tagging.
.github/workflows/get-values.yaml Safely handles merge messages.
.github/workflows/extract_project_version.py Adds reusable version extraction.
.github/workflows/confirm-on-tagged-copier-template.yaml Updates checkout action.
.github/workflows/ci.yaml Builds and stores release artifacts.
.github/pull_request_template.md Adds template ownership notice.
.github/ISSUE_TEMPLATE/tech-debt.yml Adds template ownership notice.
.github/ISSUE_TEMPLATE/feature-request.yml Adds template ownership notice.
.github/ISSUE_TEMPLATE/config.yml Adds template ownership notice.
.github/ISSUE_TEMPLATE/bug-report.yml Adds template ownership notice.
.github/dependabot.yml Adds template ownership notice.
.github/CONTRIBUTING.md Corrects links and adds ownership notice.
.github/CODE_OF_CONDUCT.md Adds template ownership notice.
.github/actions/update-devcontainer-hash/action.yml Updates checkout action.
.github/actions/install_deps/action.yml Modernizes Python, Node, and pnpm setup.
.github/actions/ecr-auth/action.yml Updates AWS actions.
.github/actions/check-skip-duplicates/action.yml Adds template ownership notice.
.github/.codecov.yml Adds template ownership notice.
.devcontainer/windows-host-helper.sh Adds template ownership notice.
.devcontainer/post-start-command.sh Adds template ownership notice.
.devcontainer/on-create-command.sh Allows uv-managed Python installation.
.devcontainer/on-create-command-boilerplate.sh Adds template ownership notice.
.devcontainer/manual-setup-deps.py Adds template ownership notice.
.devcontainer/install-ci-tooling.py Updates development tool versions.
.devcontainer/initialize-command.sh Adds template ownership notice.
.devcontainer/Dockerfile Adds template ownership notice.
.devcontainer/docker-compose.yml Adds template ownership notice.
.devcontainer/devcontainer.json Configures Pyrefly and updates extensions.
.devcontainer/create-aws-profile.sh Adds template ownership notice.
.devcontainer/code-artifact-auth.sh Adds template ownership notice.
.config/ruff.toml Relocates cache and expands coverage-oriented rules.
.config/ruff-non-src.toml Adds template ownership notice.
.config/pyrefly.toml Configures project-wide Pyrefly checking.
.config/pyrefly.mutmut.toml Configures mutation type checking.
.config/pylintrc.toml Adds ownership and spelling directives.
.config/.prettierrc Adds shared formatting configuration.
.config/.coveragerc Updates Pyrefly terminology and ownership.
.config/.copier-managed-files.json Records template file ownership.
.config/.copier-answers.yml Advances the Copier template version.
.config/_typos.toml Updates spell-check configuration.
.coderabbit.yaml Updates review guidance for Pyrefly and Copier.
.claude/skills/fix-mutants/verify-mutant.py Adds single-mutant verification.
.claude/skills/fix-mutants/utils.py Adds shared mutation utilities.
.claude/skills/fix-mutants/SKILL.md Defines the mutation-testing workflow.
.claude/skills/fix-mutants/show-mutant.py Adds mutant inspection output.
.claude/skills/fix-mutants/run-mutmut.py Adds mutation-suite execution.
.claude/skills/fix-mutants/list-survived.py Lists actionable mutants.
.claude/skills/fix-mutants/group-by-line.py Groups mutants by source line.
.claude/skills/fix-mutants/check-results.py Detects prior mutation results.
.claude/skills/caveman/SKILL.md Adds template ownership notice.
.claude/skills/address-pr-comments/verify-env.py Adds environment and PR validation.
.claude/skills/address-pr-comments/utils.py Adds shared command execution.
.claude/skills/address-pr-comments/SKILL.md Refines the PR-comment workflow.
.claude/skills/address-pr-comments/post-reply.py Reuses shared command handling.
.claude/skills/address-pr-comments/fetch-pr-comments.py Forces UTF-8 subprocess decoding.
.claude/skills/address-pr-comments/commit-link.py Generates commit links for replies.
.claude/skills/address-pr-comments/check-footer.py Adds template ownership notice.
.claude/settings/permissions/write.jsonc Adds template ownership notice.
.claude/settings/permissions/read.jsonc Adds template ownership notice.
.claude/settings/permissions/bash.jsonc Broadens Git permissions with safeguards.
.claude/settings/permissions/additional-dirs.jsonc Adds template ownership notice.
.claude/settings/models.jsonc Defines available models.
.claude/settings/hooks.jsonc Adds template ownership notice.
.claude/settings/basics.jsonc Adds template ownership notice.
.claude/hooks/caveman-mode-tracker.js Adds template ownership notice.
.claude/hooks/caveman-config.js Adds template ownership notice.
.claude/hooks/caveman-activate.js Adds template ownership notice.
.claude/hooks/bash-chain-guard.js Expands command-chain detection.
.claude/helpers/merge-claude-settings.sh Adds template ownership notice.
.claude/commands/tdd.md Refines one-behavior TDD guidance.
.claude/commands/tdd-review.md Refines test-smell criteria.
.claude/commands/summarize.md Adds template ownership notice.
.claude/commands/spike.md Refines one-behavior TDD guidance.
.claude/commands/simplify.md Adds template ownership notice.
.claude/commands/research.md Adds template ownership notice.
.claude/commands/refactor.md Refines one-behavior TDD guidance.
.claude/commands/red.md Refines one-behavior TDD guidance.
.claude/commands/polish.md Adds template ownership notice.
.claude/commands/issue.md Refines one-behavior TDD guidance.
.claude/commands/green.md Refines one-behavior TDD guidance.
.claude/commands/gap.md Adds template ownership notice.
.claude/commands/create-issues.md Adds template ownership notice.
.claude/commands/create-adr.md Adds template ownership notice.
.claude/commands/commit.md Adds template ownership notice.
.claude/commands/add-command.md Adds template ownership notice.
.claude/CLAUDE.md Redirects Claude guidance to AGENTS.md.
.claude/.beads/config.yaml Adds template ownership notice.
.claude/.beads/.gitignore Adds template ownership notice.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/release.yaml
Comment thread .claude/skills/address-pr-comments/commit-link.py
Comment thread .claude/hooks/bash-chain-guard.js
Comment thread pyproject.toml
@ejfine
ejfine merged commit aeda697 into main Aug 24, 2026
26 checks passed
@ejfine
ejfine deleted the cop-pyrefly branch August 24, 2026 13:14
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