-
Notifications
You must be signed in to change notification settings - Fork 105
Add CLI flag to override typeshed #488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add --typeshed-path flag to pyrefly check command for testing typeshed upgrades and custom typeshed modifications. - Add typeshed_path CLI argument to ConfigOverrideArgs - Add typeshed_path field to ConfigFile struct - Wire custom typeshed lookup into find_import() logic - Custom typeshed takes precedence over bundled typeshed - Falls back gracefully to bundled typeshed if module not found Fixes facebook#483
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @krikera, thanks for doing this! Just a few things that need to be changed before we can get this in.
Once you're able to fix them, please re-request my review and I'll come check it out!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there's still a part from the last review that is unaddressed. Let me know when it's fixed and I'll review/pull it in @krikera!
@@ -223,6 +223,10 @@ pub struct ConfigFile { | |||
)] | |||
pub fallback_search_path: Vec<PathBuf>, | |||
|
|||
/// Override the bundled typeshed with a custom path. | |||
#[serde(skip)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this like the other serde macros above? Probably instead of regular skip
, do
#[serde(
default,
skip_serializing_if = "Vec::is_empty",
)]
} else if let Some(path) = find_module_in_search_path(module, self.fallback_search_path.iter()) { | ||
Ok(path) | ||
} else if let Some(path) = find_module_in_site_package_path( | ||
module, | ||
self.site_package_path(), | ||
self.use_untyped_imports, | ||
self.ignore_missing_source, | ||
)? { | ||
Ok(path) | ||
} else { | ||
Err(FindError::import_lookup_path( | ||
self.structured_import_lookup_path(), | ||
module, | ||
&self.source, | ||
)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @krikera, it looks like this part is still duplicated here. Can you delete this before I pull it in?
It's doing the same thing as lines 388-403 as far as I can tell.
Add --typeshed-path flag to pyrefly check command for testing typeshed upgrades and custom typeshed modifications.
Fixes #483