Trouver le projet quarto sans lancer quarto inspect (squash 1.3.1) - #25
Merged
Merged
Conversation
added 4 commits
September 22, 2026 14:08
Fails on the current implementation: with no usable quarto binary a chapter subfolder is not resolved to its project root, and the result is a list instead of a character vector. The equivalence test against quarto inspect already passes and pins the behaviour to keep.
fetch_project() ran one quarto inspect process per qmd folder (about 1.5 s each). The root quarto reports is the closest parent holding _quarto.yml or _quarto.yaml, so a filesystem walk gives the same answer: 14.7 s down to 0.01 s on 10 chapter folders. The unused quarto_inspect import is dropped.
…inks quarto inspect looks for the project above the folder path it is given: a folder linked into a project belongs to it, a project folder linked from outside does not. Resolving the symlinks first gave the opposite answer in both cases. Relative paths and dot segments are collapsed lexically. The quarto checks of the tests now skip with quarto_available(), which is FALSE for a QUARTO_PATH pointing nowhere.
VincentGuyader
force-pushed
the
perf-fetch-project-walk-up
branch
from
September 25, 2026 16:04
a3917f7 to
8f4f83e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #25 +/- ##
=======================================
Coverage 95.98% 95.98%
=======================================
Files 13 13
Lines 622 647 +25
=======================================
+ Hits 597 621 +24
- Misses 25 26 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
quarto and fetch_project() both keep the path as written. The tests normalised only the expected side, so they failed on macOS, where the temporary folder lives under /var, a link to /private/var, and on Windows, where a temporary path carries short names and backslashes. Both sides are now compared in the same canonical form, which still catches an implementation resolving the links before walking up: 4 failures.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Le probleme
Avant chaque compilation,
add_extension()demande afetch_project()ou se trouve le projet quarto de chaque dossier de qmd. Cette detection lance un processusquarto inspectpar dossier. Sur un cours decoupe en chapitres, cela represente plusieurs secondes par dossier, payees a chaque compilation.Ce que fait cette PR
La racine que
quarto inspectrenvoie est le dossier le plus proche, en remontant, qui contient un_quarto.ymlou un_quarto.yaml. Le meme resultat s'obtient donc en lisant le disque, sans lancer quarto.fetch_project()renvoie desormais un vecteur caractere au lieu d'une liste. Son seul appelant,add_extension(), s'en accommode sans changement (verifie par sa suite de tests).L'equivalence, mesuree
Les tests comparent la nouvelle detection a
quarto inspectsur chaque configuration, et couvrent les cas qui piegent une recherche naive :_quarto.ymlvide : c'est un projet quand meme ;_quarto-init.ymlseul : ce n'est pas un projet ;.et...Un test pose
QUARTO_PATHsur un binaire inexistant : seule une recherche sur le disque peut alors reussir.Les liens symboliques
quarto inspectne resout pas les liens : il remonte le chemin tel qu'il est ecrit. Un dossier lie depuis l'exterieur d'un projet n'appartient donc pas a ce projet, et un dossier lie a l'interieur d'un projet lui appartient. La premiere version de cette PR resolvait les liens avecnormalizePath()et donnait la reponse inverse dans les deux cas. Le chemin est maintenant rendu absolu sans resoudre les liens, avec.et..reduits lexicalement.Verification
R CMD check --no-manual: 0 erreur, 0 warning, 0 note. Suite complete : 84 tests verts, les 2 skips habituels (session interactive, impression Chrome).