Skip to content

build: enable Mypyc#247

Merged
wesselb merged 1 commit intobeartype:masterfrom
nstarman:mypyc
Feb 19, 2026
Merged

build: enable Mypyc#247
wesselb merged 1 commit intobeartype:masterfrom
nstarman:mypyc

Conversation

@nstarman
Copy link
Collaborator

@nstarman nstarman commented Jan 25, 2026

A very early starting implementation of mypyc builds.

@nstarman nstarman changed the title Mypyc WIP Mypyc Jan 25, 2026
@coveralls
Copy link

coveralls commented Jan 25, 2026

Pull Request Test Coverage Report for Build 21974702219

Details

  • 5 of 5 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.002%) to 99.591%

Totals Coverage Status
Change from base Build 21961193914: 0.002%
Covered Lines: 973
Relevant Lines: 977

💛 - Coveralls

@nstarman nstarman mentioned this pull request Feb 12, 2026
@nstarman nstarman force-pushed the mypyc branch 2 times, most recently from 0d0077f to b44717f Compare February 12, 2026 18:59
@nstarman nstarman changed the title WIP Mypyc build: enable Mypyc Feb 12, 2026
@nstarman
Copy link
Collaborator Author

This only includes a few modules in the mypyc compilation. We should be able to add more.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces mypyc compilation support to the plum-dispatch package to improve performance by compiling critical Python modules to C extensions. The changes include configuring the build system for mypyc, updating CI/CD workflows to build and test compiled wheels for multiple platforms, and making necessary code adjustments for mypyc compatibility.

Changes:

  • Added mypyc build configuration with hatch-mypyc and cibuildwheel for cross-platform wheel builds
  • Introduced COMPILED flag to detect if the package is running as compiled code
  • Fixed type compatibility issues for mypyc compilation (bool wrapping, frozenset conversion)

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pyproject.toml Adds mypyc and cibuildwheel configuration, test markers, and build dependencies
src/plum/init.py Implements COMPILED flag to detect mypyc-compiled modules
src/plum/_resolver.py Wraps return values with bool() for mypyc type inference compatibility
tests/test_method.py Fixes type mismatch by wrapping sets with frozenset()
tests/test_resolver.py Marks test incompatible with mypyc (uses monkeypatch on compiled module)
.github/workflows/publish.yml Complete rewrite to build both pure Python and mypyc-compiled wheels, use trusted publishing
.github/workflows/ci.yml Adds mypyc wheel testing job, updates actions versions and coverage paths
noxfile.py Fixes pylint path from "plum" to "src/plum"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: nstarman <nstarman@users.noreply.github.com>
@nstarman
Copy link
Collaborator Author

@wesselb the more we can get into mypyc the faster things should get!

@wesselb
Copy link
Member

wesselb commented Feb 14, 2026

@nstarman Let's go! That's awesome.

Do we need to somehow test publish.yml or are you fairly confident that it does what it needs to do? How about we merge this and immediately release a new version to test?

@nstarman
Copy link
Collaborator Author

Yeah, I'm not entirely sure how to test publish.yml except by trying it...
I tried basing it off of black's setup.

@wesselb
Copy link
Member

wesselb commented Feb 19, 2026

Let's go for it and see what happens!

@wesselb wesselb merged commit 6127249 into beartype:master Feb 19, 2026
17 checks passed
@nstarman nstarman deleted the mypyc branch February 19, 2026 13:17
@wesselb
Copy link
Member

wesselb commented Feb 19, 2026

After a bit of trial and error, I think the builds succeeded! :)

@nstarman
Copy link
Collaborator Author

Excellent. Now we can a todo to feed more modules to mypyc.

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.

3 participants

Comments