Skip to content

Add CLI flag to override typeshed #483

@connernilsen

Description

@connernilsen

I forgot to add a --typeshed-like flag to pyrefly check, which will let us override typeshed. This is useful for testing typeshed upgrades, testing how changes to typeshed will affect a codebase, and other typeshed-related changes.

This will involve a couple of steps. For whomever takes this on, I can turn this into more sub-tasks if that would make it easier for you!

  1. Add a CLI flag somewhere around
    struct ConfigOverrideArgs {
  2. Add a ConfigFile option for typeshed path
    pub struct ConfigFile {
  3. Wire it into our find_import() logic
    pub fn find_import(
    &self,
    module: ModuleName,
    path: Option<&Path>,
    ) -> Result<ModulePath, FindError> {
  4. You'l likely have to update our typeshed functionality (all in the file below) to handle loading a custom typeshed
    pub fn typeshed() -> anyhow::Result<&'static BundledTypeshed> {
    match &*BUNDLED_TYPESHED {
    Ok(typeshed) => Ok(typeshed),
    Err(error) => Err(anyhow!("{error:#}")),
    }
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions