Skip to content

The Package System Should have a LATEST and STABLE version #1632

Closed as not planned

Description

@ondohotola

Description

I like the idea of package management.

However, if I have to manually track the version of each published package this defeats the purpose, as I will have to track the versions manually and/or update all .typ files (per find/perl script).

I have up to now symlinked tablex.typ from a central location so only needed to worry about one file.

Use Case

I would propose, if not already done, to mandate that a package MUST have at least a STABLE and/or a LATEST (perhaps even a NIGHTLY) version, which could be by symlinked, perhaps, so that in the example of tablex @PgBiel could replace

#import "@preview/tablex:0.0.4": *

by

#import "@preview/tablex:STABLE": *

for example, to automate this.

Activity

  1. added
    feature request
    on Jun 30, 2023
  2. Enivex commented on Jun 30, 2023

    @Enivex
    Collaborator

    I strongly agree with this, but I also know that there are strong opinions from the other camp as well. The motivation is that documents should be reproducible.

    Personally I'd rather have the convenience and accept the risk.

    My idea for a less verbose way of ensuring reproducible documents is to set a date in the document, and packages will then use the version that was current at that date.

  3. ondohotola commented on Jun 30, 2023

    @ondohotola
    Author
  4. PgBiel commented on Jul 1, 2023

    @PgBiel
    Contributor

    Personally, I mostly prefer the safety of having reproducible documents. But I understand that it could be nice to easily have common versions for multiple files in a project. In that sense, however, maybe a better approach could be to use a re-exports file, like some Rust crates do? Not sure here.

  5. RolfBremer commented on Jul 1, 2023

    @RolfBremer

    We have use cases for both ways (reproducible and latest versions). It would be nice to not only have it both ways, but to be able to "freeze" a version automatically in the release pipeline. "Freezing" means, the current version gets fixed for the document during the release step.

  6. added
    packages
    on Jul 6, 2023
  7. laurmaedje commented on Sep 4, 2023

    @laurmaedje
    Member

    I think good editor support for autocompleting the latest version is better. If we support "latest" or "stable", then people will just use it all the time and we'll get lots of breakage down the road.

  8. ondohotola commented on Sep 4, 2023

    @ondohotola
    Author
  9. laurmaedje commented on Sep 4, 2023

    @laurmaedje
    Member

    I don't understand the first sentence.

    I mean that if use the web app or have a language server installed, the package list will be autocompleted for you. This makes it easy to use the most recent version.

    And about the second, so what?

    Breakage is generally something we should avoid. Sometimes it's good to be forced to do something the right way rather than the easy way. Down the road someone will be happy that their document still compiles.

  10. ondohotola commented on Sep 4, 2023

    @ondohotola
    Author
  11. laurmaedje commented on Sep 4, 2023

    @laurmaedje
    Member

    I agree that it's not ideal if you have to fix it in multiple files. You can put all your imports in a helper file and import that, but I acknowledge that this is a bit of a workaround. I could imagine allowing a typst.toml file for project configuration (think also root, exports, etc. which could be configured there) which allows to specify a project-wide default version for a package. But that could also be a bad idea in the end.

  12. ondohotola commented on Sep 4, 2023

    @ondohotola
    Author
  13. MHellmund commented on Sep 5, 2023

    @MHellmund

    Sometimes one wants to fix the package version.

    But, as a "normal user", most if the time I don't care. If I install some package/library, with pip in python, with cabal in Haskell, with Pkg.jl in Julia, I don't provide a version number and expect the ecosystem to deliver a sensible default (such as, the latest stable release).

    Of course it is good that we can add the version number for fully reproducible documents.

  14. laurmaedje commented on Sep 5, 2023

    @laurmaedje
    Member

    With pip, I frequently run into problems specifically because of this. Old projects don't work anymore because the dependencies aren't accurately specified.

    With editor support or the TOML file and a CLI command, you can have a similar workflow to pip, which specifies the most current in the project TOML file, while still having fully reproducible results.

  15. kdkasad commented on Mar 19, 2024

    @kdkasad

    I know this issue is a little stale, but I think having the TOML file + CLI command is the best solution. It sounds like what Rust currently does if I'm not mistaken.

    It meets many needs:

    • If you want a specific version, you just put it in the TOML file.
    • If you just want the latest version, the CLI command can take the package name, find the latest stable version, and add that to the TOML file, just like cargo add does.
    • In any .typ files, you only need to specify the package name, not the version.
    • The versions are still pinned, so documents are reproducible.

    Also, packages & templates already have a typst.toml file. Parsing this file is already implemented in Typst, so all that would be required is adding logic for a new dependency section.

    I think this should be optional, though, and package versions should still be able to be specified in the #import statement. This would keep Typst simple, as single-file documents would still be possible. The main problem with requiring pinned versions was within multi-file projects anyways; adding a TOML file in that case isn't as big of a deal if the project is already complex.

  16. laurmaedje commented on Apr 8, 2024

    @laurmaedje
    Member

    The current plans are pretty much what @kdkasad describes above. A typst.toml file would give a convenient way to deduplicate versions across files and could also go hand in hand with allowing git imports in a safe way.

    There are no plans to support downloading always the latest versions at the moment, for the reproducibility reasons laid out above, so I'll go ahead and close this.

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

    feature requestpackages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions