Skip to content

Python API / PyO3 bindings for embedding Pyrefly #3964

Description

@tylerriccio33

Summary

Would the project be interested in exposing a Python API for Pyrefly, similar to mypy.api?

Currently, the Python package is a CLI wrapper invoking pyrefly via subprocess. I'm building a python transpiler and wanted to use pyrefly in CI to verify the generated python code is valid. I had performance concerns calling subprocess as much as I wanted to; wondering if direct bindings exposed to the python api would be better? My guess is yes...

I pictured something like this but it's actually just an FFI to the rust code:

import pyrefly

result = pyrefly.check(paths=["src"])

Before spending time on a prototype, I wanted to check whether maintainers would be open to this direction or had other suggestions. I'd love the chance to work on something like this :)

Metadata

Metadata

Assignees

Labels

needs-discussionAn issue where it's not clear whether there is a bug or we are behaving as expected.
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions