Add experimental programmatic API for Monty - #4866
Conversation
|
This pull request has been imported. If you are a Meta employee, you can view this in D119299371. (Because this pull request was imported automatically, there will not be any future comments.) |
This comment has been minimized.
This comment has been minimized.
| /// when `None`) over the in-memory modules named in `modules`. Only those module | ||
| /// names are importable between the supplied sources; everything else resolves to | ||
| /// the bundled typeshed. No interpreter is queried. | ||
| pub fn new(python_version: Option<&str>, modules: &[&str]) -> Result<Self, String> { |
There was a problem hiding this comment.
it's unclear what modules is. is this every module this API can check?
the "config" is just a python_version. I imagine we will need a lot more config at some point. the config options that are essential here depends on the use-case. should we use the full ConfigFile struct?
There was a problem hiding this comment.
I don't think we should overdo it now - the full config is excessive IMO since it's just a REPL
we can add it later if we need it
There was a problem hiding this comment.
modules for Monty is 2 files, 1 is the "file" containing the REPL, 2 is the stubs that Monty injects
| /// Type check the `target` module, returning diagnostics for it only. | ||
| /// | ||
| /// `files` supplies the current source for each in-memory module (each | ||
| /// `(module_name, source)`); every name must have been declared in |
There was a problem hiding this comment.
every name must have been declared
this is a confusing API and I don't think it can land like this
|
In my view this is in the same category as glean's API or the WASM stuff, where it should be undocumented until we refine the API enough and decide to publicize it The main purpose of merging it is so that Monty can actually release a version that uses Pyrefly |
|
Cleaned up a few things |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Summary
For https://www.github.com/pydantic/monty/pull/501
Something about how Monty can't depend on a crate that's a GH revision hash.
I guess after this gets merged you guys need to publish it, but IDK how to do that
Test Plan
I ran all the tests at some point but after the demise of my Macbook Pro I now use a Macbook Air which has no fans so I'm reluctant to risk running the test suite and overheating it
so, TLDR trust CI