Skip to content

Feature request: Display y/n package installation prompt for import Pkg if no registries are installed #4583

@DilumAluthge

Description

@DilumAluthge

In a fresh Julia depot:

julia> import Example
 │ Attempted to find missing packages in package registries but no registries are installed.
 └ Use package mode to install a registry. `pkg> registry add` will install the default registries.

ERROR: ArgumentError: Package Example not found in current path.
- Run `import Pkg; Pkg.add("Example")` to install the Example package.
Stacktrace:

Contrast that with the behavior if you already have the General registry, which I think is a nicer experience:

julia> import Example
 │ Package Example not found, but a package named Example is available from a registry.
 │ Install package?
 │   (@v1.14) pkg> add Example
 └ (y/n/o) [y]:

In the first case, if the General registry is not found locally, could we display a (y/n) [y] prompt to the user, and if they enter y (or press Enter), then we automatically run ] registry add for them? I think that would be a nicer user experience?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions