-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
API to activate first parent dir with Project.toml #2640
Comments
To give some more context, the proposed functionality is already implemented in DrWatson, as a function You start a script with the lines: using DrWatson
@quickactivate "ProjectName" and Julia starts scanning the folder that contains your script until it finds a project, and activates that project. The argument The Macro is the most useful version, and our users are extremely happy with it. It allows for reproducible scientific projects, allows finding your "correct" project automatically by running your script (no manual labor!), and it allows for easily switching projects within the same Julia session. The only problem it has is that it requires This as a result also leads to some difficulties in Pluto.jl notebooks, cf JuliaDynamics/DrWatson.jl#261 . Given that this functionality seems generally useful, we think it is a good idea to have it in Pkg.jl directly. |
You can use |
Yes (and actually the source of this function was the starting point for Does this sound like something possible for you? If yes, then this issue practically resolves to a documentation PR. |
How is it relevant to Jupyter and VS Code? Jupyter (IJulia) already activates the closest parent env:
VS Code suggests to choose which of the parent envs to activate when opening a project for the first time, and activates it automatically afterwards. |
When launching
julia
with argument--project
, then it will "search through parent directories until a Project.toml or JuliaProject.toml file is found." (docs). This is really useful for projects with scripts and notebooks in nested folders. (e.g.<project-root>/notebooks/analysis/hello.jl
)It would be great if this automatic Project search was available as a function in Pkg, to be called at the top of a script/notebook. This would be useful in environments where setting the
project
flag is impractical (Pluto.jl, Jupyter, VS Code). It also helps to simplify the reproducibility steps: you can just run the script.Currently, you need to manually count towards the root directory of your project:
I would be happy to make this PR myself if there is interest?
The text was updated successfully, but these errors were encountered: