Skip to content
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

Request: Introduce Option to Freeze/Lock Environments #4041

Open
alex-fu27 opened this issue Oct 9, 2024 · 0 comments
Open

Request: Introduce Option to Freeze/Lock Environments #4041

alex-fu27 opened this issue Oct 9, 2024 · 0 comments

Comments

@alex-fu27
Copy link

Whenever I create a new project, I will forget to activate the new project's directory as an environment for installing packages. So I always install the packages into the default @#.# and later realize that no Project.toml was created. Then I uninstall the packages from the default environment and create the new Project.toml.

Thus, I would like to request a feature which can lock an environment, for example the default one, so that I get an error message if I try to install packages.

The hack I am currently using already implies a possible implementation: I did chmod a-w ~/.julia/environments/v1.10, which leads to an error when I try to add a package:

(@v1.10) pkg> add Plots
   Resolving package versions...
ERROR: SystemError: opening file "/home/alex/.julia/environments/v1.10/Project.toml": Permission denied
Stacktrace:
  [1] systemerror(p::String, errno::Int32; extrainfo::Nothing)
    @ Base ./error.jl:176
  [2] systemerror
    @ ./error.jl:175 [inlined]
  [3] open(fname::String; lock::Bool, read::Nothing, write::Nothing, create::Nothing, truncate::Bool, append::Nothing)
    @ Base ./iostream.jl:293
.... huge stack trace truncated...

Broken down into individual tasks, the implementation would be:

  • Recognize that the current environment's Project.toml is read-only, show a concise error message explaining that the environment is 'locked'.
  • Add commands ] lock and ] unlock to set the permissions of Project.toml and Manifest.toml to read-only and rw accordingly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant