Skip to content

Record/keep extension source for later reuse (quarto update extension ...) #11468

Open

Description

@mcanouil

Currently, when installation an extension from GitHub, if the extension name does not match the repository name, it's not possible to use quarto update extension ....

The majority of extensions uses quarto-<extension name> as a repository name instead of <extension name>.
For example:

  1. Install extensions:

    quarto add mcanouil/quarto-iconify
    quarto add quarto-ext/typst-templates/poster
  2. Check the installed extensions

    quarto list extensions
    Id                         Version    Contributes        
    quarto-ext/poster          1.0.0      formats            
    mcanouil/iconify           2.1.0      shortcodes         
  3. Update the extensions

    quarto update extension quarto-ext/poster
    Extension not found in local or remote sources

This means that it's not possible to update the extension quarto-ext/poster because the repository name (directory) is typst-templates/poster and not poster.
Same goes for the extension mcanouil/iconify.

This could be solved by recording/keeping the repository name (source) somewhere.
It could be in _extension.yml under source key.

Keeping the source would allow better extension management and easier updates, e.g., quarto update extension all.

Activity

  1. added
    enhancement
    extensions
    on Nov 18, 2024
  2. cderv commented on Nov 18, 2024

    @cderv
    Member

    Just a note for clarity that quarto update extension does work, but you need to know the github repo name

    > quarto update extension quarto-ext/quarto-poster
    

    and we don't record it for now and we do store the extension in org-name/ext-name, ext-name being the registered name from the metadata of the extension. This name is also the one to use inside the document to load a filter for example. filter: [quarto-ext/poster]

    So we need to

    • Find where to store the source information, and maybe other information.
      We could adopt an approach similar to R package that does modify the DESCRIPTION in the installed package folder. We could write some fields in the _extension.yml with install datetime, type of extension (local zip, remote, ...) and source of the remote if so.

    • Show this information in quarto list extension indeed

    • Adapt quarto update to use the source when installed extension is used (quarto update quarto-ext/poster) and probably allow to update from source directly quarto update extension quarto-ext/typst-template/poster

    Thanks a lot for the report @mcanouil !

  3. added this to the v1.7 milestone on Nov 18, 2024
  4. gadenbuie commented on Dec 5, 2024

    @gadenbuie
    Collaborator

    I'm going to second writing the source info into _extension.yml on install. Relatedly, it'd also be nice if that could support a command to help users open extension docs (it's offered during install but I don't think there's a way to return to the docs if you select No at that point).

    (Sidenote: there's enough here that it'd be nice to have a quarto extension subcommand. I never feel secure that I'm doing the right thing when I use quarto add, quarto list or quarto update to interact with extensions. quarto extension add or quarto extension update are more verbose but much more certain.)

  5. mcanouil commented on Dec 5, 2024

    @mcanouil
    CollaboratorAuthor

    Writing the source in _extension.yml is also what I had in mind.
    I am a bit working on this for my VSCode extension (https://github.com/mcanouil/quarto-wizard), especially to provide an interface to update/install/remove/get help on extensions.

    If this design is validated and if that's ok, I volunteer to work on this on my spare time and make a PR.

    Sidenote: my VSCode extension allows to access any extension repository (I plan to make a better UI than a list)
    Image

  6. cscheid commented on Dec 5, 2024

    @cscheid
    Member

    We have a 2025 goal to improve third-party extensibility in Quarto, and rethinking our extension tooling definitely fits. quarto extension doesn't actually fit most of our other commands; from memory, I think they're all verbs.

    That doesn't mean we shouldn't do it, but it means that we need to think about it more carefully.

  7. cderv commented on Dec 6, 2024

    @cderv
    Member

    quarto extension doesn't actually fit most of our other commands; from memory, I think they're all verbs.

    yes we have only quarto tools as left over. Previously it was quarto tools install but it has been switched (d2447e0) to verb with quarto install for all extensions or tools, and then quarto add was added as better way for extension quarto install extension <extension> is now quarto add <extension>

    So if we are changing this, we definitely need to see the current state of all this and make the clearer API that will last 😄

  8. mcanouil commented on Mar 24, 2025

    @mcanouil
    CollaboratorAuthor

    FYI, Quarto Wizard adds a source: owner/repo or source: owner/repo@tag upon install/update to the extension manifest.

  9. modified the milestones: v1.7, v1.8 on Apr 4, 2025
  10. modified the milestones: v1.8, v1.9 on Aug 21, 2025
  11. modified the milestones: v1.9, v1.10 on Feb 17, 2026
  12. modified the milestones: v1.10, v1.11 on Jul 30, 2026
  13. self-assigned this
    on Oct 23, 2026
  14. modified the milestones: v1.11, v1.12 on Oct 29, 2026
  15. mcanouil commented on Oct 30, 2026

    @mcanouil
    CollaboratorAuthor

    For reference:

    q2 calls this record .quarto-source.yml. It sits in each installed extension's folder, _extensions/[<org>/]<name>/.quarto-source.yml, and q2 never touches the author's _extension.yml.

    Source code (last change to the record module: commit f9fe40f79, 2026-10-22):

    Format (schema version 1):

    # Generated by `q2 add`. Do not edit.
    #
    # Records where this extension was installed from, and a sha256 of each
    # installed file. Before replacing this extension, `q2 add` compares the
    # files against these hashes and refuses (without --force) to overwrite
    # local changes.
    version: 1
    source: acme/demo-ext@v1.0.0
    kind: github
    ref: v1.0.0
    files:
      _extension.yml: <sha256>
      filter.lua: <sha256>

    Keys:

    Key Type Meaning
    version integer Schema version of the file, currently 1 (RECORD_VERSION).
    source string The source exactly as the user typed it, including any @ref.
    kind enum One of github, url, local-archive or local-dir (kebab-case of SourceKind).
    ref string, optional The text after the last @ of a GitHub source: a tag, a branch, or a full or short commit SHA (since quarto-dev/q2#1006). It's left out when no ref was typed, so an install without a ref (which takes main, then master) doesn't record which branch or commit it got. URL and local sources have no ref.
    files map Each path, relative to the extension folder with / separators, mapped to a lowercase hex sha256 of the file's raw bytes. The record itself is left out, symbolic links are followed, the walk stops at a depth of 32, and keys are sorted (BTreeMap).

    How q2 reads it (installed_state):

    • No file: Untracked. q2 installs or updates anyway, with a note.
    • File present, every hash matches: Unmodified.
    • A file modified, missing or added: Modified, and q2 refuses to replace the extension without --force.
    • A record q2 can't parse: also Modified (UnreadableRecord), so it needs --force too. This covers invalid YAML, a missing field, and an unknown kind such as registry.
    • Unknown extra keys: accepted, because the struct doesn't reject unknown fields. q2 drops them the next time it rewrites the record.
  16. mcanouil commented on Nov 2, 2026

    @mcanouil
    CollaboratorAuthor

    I've closed #13764, since q2 already handles this with its .quarto-source.yml record.

    Is there a plan to backport that record to Quarto 1.x? @cscheid
    If so, quarto add could write the same file in q2's version 1 format, and quarto update extension could read it to find the source.
    Both tools would then share one record, and an extension installed with one could be updated with the other.

  17. removed their assignment
    on Nov 2, 2026
  18. mcanouil commented on Nov 3, 2026

    @mcanouil
    CollaboratorAuthor

    For reference, amongst several improvements, I'm aligning Quarto Wizard with q2 to ensure native support and no conflicts issues between Quarto Wizard and Q2 ways of recording the source.

    This is on the main branch of Quarto Wizard and isn't released yet.

    Source code (Quarto Wizard main at commit 95522cb, 2026-11-02):

    What's shared with q2:

    • Quarto Wizard writes the same _extensions/[<org>/]<name>/.quarto-source.yml, in q2's schema version 1: version, source, kind, ref and files, with the same sha256 hashing and the same file walk.
    • It reads the record the way q2 does, and an unreadable record, an unknown kind or a version above 1 counts as a local edit.
    • It refuses to replace an extension whose files don't match the hashes, unless you choose Replace anyway.
    • It no longer writes source and source-type into the author's _extension.yml.
      It still reads those keys from extensions installed with Quarto Wizard 3, and the next update writes a record.

    So an extension installed with one tool can be updated with the other.

    What Quarto Wizard adds:

    Quarto Wizard can follow either the latest version tag or the head of a branch.
    It keeps that choice, and the commit it installed from a branch, under an optional quarto-wizard key:

    # Generated by Quarto Wizard. Do not edit.
    version: 1
    source: acme/demo-ext@dev
    kind: github
    ref: dev
    files:
      _extension.yml: <sha256>
      filter.lua: <sha256>
    quarto-wizard:
      track: branch
      commit: <full 40-character sha>
    Key Type Meaning
    quarto-wizard.track tag or branch, optional What an update follows: the latest version tag, or the head of a branch. Quarto Wizard writes it for every GitHub install, and a record without it counts as tag.
    quarto-wizard.commit string, optional The full commit, in lower case, of an install from a branch, or from a repository with no version tag.
    quarto-wizard.source-type registry, optional Set when the extension was installed from the extension registry that Quarto Wizard lists.

    q2 ignores the quarto-wizard key, because it accepts unknown keys.
    It drops the key the next time it rewrites the record, and Quarto Wizard then falls back to tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementextensions

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions