quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.58k stars 294 forks source link

Wrong function method in julia environment configuration. #10225

Closed XLin0mu closed 1 day ago

XLin0mu commented 5 days ago

Bug description

Codes at the file https://github.com/quarto-dev/quarto-cli/blob/main/src/resources/julia/ensure_environment.jl:

#...
manifest_matches_project_toml = Pkg.is_manifest_current() === true # this returns nothing if there's no manifest

It lead to an error as follow:

quarto preview e:/DESKTOP/test.qmd --no-browser --no-watch-inputs  21:13:54 
Starting julia control server process. This might take a while...
ERROR: LoadError: MethodError: no method matching is_manifest_current()
The function `is_manifest_current` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  is_manifest_current(::Pkg.Types.Context)
   @ Pkg D:\MyTools\julia\share\julia\stdlib\v1.11\Pkg\src\API.jl:489
  is_manifest_current(::AbstractString)
   @ Pkg D:\MyTools\julia\share\julia\stdlib\v1.11\Pkg\src\API.jl:490

Stacktrace:
 [1] top-level scope
   @ D:\MyPrograms\Quarto\share\julia\ensure_environment.jl:17
in expression starting at D:\MyPrograms\Quarto\share\julia\ensure_environment.jl:17
ERROR: Ensuring an updated julia server environment failed

Obviously.

And it'll be solved if modify that line as:

manifest_matches_project_toml = Pkg.is_manifest_current(dirname(Base.active_project())) === true # this returns nothing if there's no manifest

Everything works well till now after modifying.

Steps to reproduce

As above.

Expected behavior

Everyting works.

Actual behavior

Error. As above.

Your environment

VSCode@Windows10 julia: Version 1.11.0-beta2 Quarto: 1.5.53

Quarto check output

Quarto 1.5.53
[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.5.53
      Path: D:\MyPrograms\Quarto\bin
      CodePage: 936

[>] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[>] Checking LaTeX....................OK
      Using: Installation From Path
      Path: D:\MyPrograms\texlive\2024\bin\windows
      Version: 2024

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....OK
      Version: 3.12.3
      Path: D:/MyPrograms/Python312/python.exe
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with py -m pip install jupyter

[>] Checking R installation...........(None)

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/
cscheid commented 5 days ago

(tagging @jkrumbiegel)

jkrumbiegel commented 5 days ago

I assumed this function was relatively stable but seems they changed it in 1.11. Would need branching maybe, or giving the folder argument explicitly might work on older versions as well.

cscheid commented 5 days ago

they changed it in 1.11

"They" being the Julia authors, since (again, I'm inferring) 1.11 is the of Julia (and its stdlib) you're referring to? I'm just trying to understand the situation and exposure here.

jkrumbiegel commented 5 days ago

Yes, 1.11 is the upcoming version and this specific Pkg function must have changed signatures. Maybe I misjudged its API status and it was not intended to be used in a stable manner.

cderv commented 5 days ago

They changed it in

It seems only one tool used it Publicly on Julia package manager. This tool now adapt to it comparing version https://github.com/oscar-system/Oscar.jl/blob/27ec7aad12afa28e41adafd86f5fef5b86f74b38/src/Oscar.jl#L167-L173

From a github search it seems we are the only other project on Github https://github.com/search?q=Pkg.is_manifest_current+language:Julia+&type=code

jkrumbiegel commented 5 days ago

Nice find. Yeah I'm not surprised no packages were using it as you usually don't have to do any package management in a package itself. But it will be easy enough to apply the same workaround as the one you linked.

cscheid commented 4 days ago

It looks like they're close to shipping: https://github.com/JuliaLang/julia/milestone/46

Ideally, we'd be able to get a fix for this before November. From how you're responding, it seems that this should be no problem. Can you confirm that this is the case? Thanks!

jkrumbiegel commented 3 days ago

I'll try to make a PR on Monday