#Packages, Templates

1108 messages · Page 2 of 2 (latest)

hoary thunder
#

As for the registry protocol: I think it would likely be designed in such a way that an advanced registry with custom auth, package enumeration, and so on could exist (with a backend server) while still supporting more basic registries that are just file servers / a CDN.

#

The index.json thing will probably need to be replaced down the road as it gets too large at some point.

#

The index.json is not actually used under normal operation. There is no check in the CLI that a package exists before fetching it.

#

It's used for typst init and maybe for some other stuff like hints.

#

But since the CLI only fetches from packages.typst.org, it's still safe (as long as you trust packages.typst.org).

fallow seal
#

Just wondering, not necessarily feature requests:

  • Why do the PDF docs hosted by Typst not open in the browser like they do on CTAN?
  • Why do templates get to have thumbnails, but packages don't?
placid sky
#

Packages thumbnails can be interesting but not necessarily, some packages add only functions or features and they can't show what they do directly like a template

fallow seal
#

True, but not having any thumbnails at all I think makes the page look less appealing than it could be

floral crater
# fallow seal Just wondering, not necessarily feature requests: * Why do the PDF docs hosted b...

On the first point: IIRC this is controlled via the Content-Disposition header. I'm guessing this isn't easy to toggle in the software hosting the website?
-# On Firefox, the download attribute being set on the element with a URL will also behave like a file download, according to mdn. Though one can set browser.download.open_pdf_attachments_inline in about:config to force the inline behavior (regardless of content-disposition or download attribute).

hoary thunder
#

We don't host any documentation, it's all GitHub links, so I don't think there's anything we can do about that

fallow seal
#

Right, I checked again through many READMEs and I couldn't find any docs leading to typst.app, so I must have been delusional when looking at the URL then.

manic zenith
#

Why do the PDF docs hosted by Typst not open in the browser like they do on CTAN?

We don't host any documentation, it's all GitHub links, so I don't think there's anything we can do about that

It seems like it is possible to get GitHub links to PDFs to render in the browser. At least, this one renders fine for me using Firefox:

https://raw.githubusercontent.com/mewmew/cheat-sheet-typ/master/cheat-sheet.pdf

Edit: hmm, the same link doesn't work when I try it in Chromium. So it seems to be browser dependent

fallow seal
manic zenith
#

(i.e. use /raw/ instead of /blob/)

#

Haha, but /blob/ works in Chromium. And /raw/ in Firefox. ^^ lol

fallow seal
#

Oh, you mean like opening in the browser's PDF viewer, not GitHub's one?

manic zenith
#

Yes, exactly.

fallow seal
#

On Chrome, blob still opens in GitHub

manic zenith
#

I now got the GitHub preview one to work in both Firefox and Chromium (with /blob/). The issue was NoScript for me in Firefox.

However, the /blob/ preview version is just an image? For instance, links doesn't work in the PDF.

fallow seal
#

Weird, I thought there used to be an option in the sense "open full PDF"

manic zenith
#

I guess you have to click the "download raw file" link for that.

fallow seal
#

Apparently that "open full PDF" option I was thinking of is just to load more pages, but it's still images like you said.

manic zenith
#

right

crimson sleet
#

Just append ?raw=true and you get the in browser view

fallow seal
#

That still directly starts the download for me, on Chrome at least.

fresh hornet
#

Since we currently see downtime for the package registry we should reopen the discussion of custom independent registries again.

The current work around is to locally install / manual cache the packages the you need.
As mentioned by @lone granite in #discussions message this is not possible for ci/cd. It is also very uncool to be forced to do that. It feels a bit like a lock in. It means that even when not using the webapp, you are still dependent to an external service that you can not change or choose (when using packages). Mirrors are also not possible.

The web app already allows private packages for pro users. I don't have pro and don't use the web app but it sounds a bit like a custom registry, but hosted on and restricted to typst.app. Typst on-premise with self hosted and Distribute packages and fonts across your organization sounds even more like a custom registry.

Any chance we can find a solution for that in the future? What are our options. Of course the solution should be safe to some extend, but custom registries will always come with some safety issues to some point. But that should not be the reason to kill that idea completely.

hoary thunder
fresh hornet
# hoary thunder There is no intent to lock anybody into anything. The whole package infrastructu...

I see. I guess this is a situation were everyone is not 100% happy with the current solution. You guys did your best and created a good working (besides aws issus) package infrastructure. I am very thankful for that work.

As grateful as I am for the current package infrastructure (I really am), I might be forced at some point to build a script tool (like pip but for typst) by myself. Should I do that, maybe there are some learnings from it that could go in an ofiicial way.

sleek halo
# fresh hornet I see. I guess this is a situation were everyone is not 100% happy with the curr...

like pip but for typst

This already exists, typship and utpm are two tools that support it (not sure if it's released in utpm yet though). It's not a registry, but you can e.g. typship download <git repo> -n preview -c <release-tag> to install from Github. (Unless you mean making a proper registry tool on top of either of these.)
There's also this showcase of mine from a while back—not that I'd seriously recommend it, but it is prior art and I do use it in CI 😉

As for official support, it just takes time.

fresh hornet
fresh hornet
crimson sleet
#

usually, for a cli, the list of commands / the help command is gonna be the documentation if u will

fresh hornet
fresh hornet
#

@sleek halo you are a contributor to utpm right? While trying it out, it always crashed. On every command I tried. Before I dig into it, I wonder: Do you happen to know, if utpm creates a build kind directory with package storage for every workspace?

mild carbon
#

ps there's #1266702763539304461

#

(not very active though)

sleek halo
placid sky
#

Like every year I don't have time unfortunately :((

#

And there aren't many contributors

placid sky
#

I have plans for it but like I said: no time

mild carbon
fresh hornet
#

Is it okay for the pople that host packages.typst.org if other/alternative typst clients download from there?

main thicket
#

This already happens and as long as your clients don't ship with a DOS built in it probably fine

floral crater
fresh hornet
fresh hornet
floral crater
#

"otherwise" as in if you would be generating lots of traffic 😅
but since thats not the case your initial idea should be fine

sleek halo
hoary thunder
fresh hornet
fresh hornet
#

I am working on a package manager prototype for advanced package management. I am currently working on the config format. I would love to get some feedback (any kind) on the design I have so far.

The following config adds some dependencies to the project (including official ones and git ones), patching/overwriding one dependency and applying a patch to another one.

[dependency.cetz]
"1.1.1" = { git = "URL", rev = "asdasd" }
"1.1.3" = {official = "cetz", version = "1.2.3", apply-edit = "local/fix.patch"}

[dependency.cetz-plot]
"1.1.1" = {official = "cetz-plot", version = "1.1.1"}

[dependency.algorithm]
"1.1.1" = {official = "algorithm", version = "1.1.1"}
"1.1.3" = {official = "algorithm", version = "1.2.3"}

[[patch]]
old = { official = "cetz", version = "1.1.1" }
new = { git = "URL", rev = "asdasd" }
target = { official = "cetz-plot", version = "1.1.1" }
main thicket
#

is this for typst proper or is this going to be a third party project, if it's the latter I would like to know if you considered looking at either utpm or typship to contribute this instead of creating another competing project.

#

To answer the actual question, I'm not entirely sure what to make of the patch format, the one at the bnottom and the one apploed at the topic is presumably not the same?

fresh hornet
# main thicket is this for typst proper or is this going to be a third party project, if it's t...

This is intended to be a third party project. I have looked at both projects. Typship seems to have a completely different approach. utpm looked like it could be something similar. But when I tested, it was super buggy and crashed with panics on mostly all commands that I tried. Furthermore there are pretty much no docs.
Besides, as far as I know, my approach is a bit different from the base. I indent to have a local build dir for each project which enables proper patching/overwriding of dependencies. The things I have in mind would likely not be a small addition, but more of a rewrite of the base. I do not know if my ideas even work or if I can contribute to utpm on a skill level. That is why I decided initially not to contribute to utpm.

fresh hornet
main thicket
#

I see, how exactly will this work from a user perspective? Surely they can't just run normal regular typst if a patch is to be applied

#

or will they simply set the package dir?

fresh hornet
placid sky
#

But I get why you didn't want to contribute it directly

fresh hornet
placid sky
fresh hornet
sleek halo
# fresh hornet I am working on a package manager prototype for advanced package management. I a...

Did you see @deep pewter's typship#29? It's an issue proposing something similar (at least it seems so, superficially). Personally, I'm looking for something a bit different (not managing dependencies for individual projects/documents, but package registries), so if you think this fits your vision, also taking typship#34 for inspiration would be nice 🙂

(I also would love if there were more synergies between the projects in this area, but I get that right now we're still more in an exploration phase, where the directions of the tools just differ too much)

fresh hornet
sleek halo
fresh hornet
deep pewter
fresh hornet
# deep pewter patches can be run once before a tarball (npm, github, typst universe) is extrac...

Sure. But what do you do if two packages depend on cetz:4.2.0 and you want to patch the cetz version for one of them? That makes it difficult. You need to have two version of cetzt:4.2.0 (one patched and one original). Now you need to patch the package that depends on it too, because it can not keep its name. This issue can occur recursive. My idea was to save the modified packages as a new package (with edited non duplicate name) and automatically edit the packages that should use this one.

Not sure it is clear what I mean.

deep pewter
deep pewter
fresh hornet
deep pewter
fresh hornet
deep pewter
#

Patching sounds a bit risky in typst tho. If "cetz" and "cetz-patched" both have a state named "some-internal-state", they actually share the state during typst evaluation. only package owners know whether state can be shared safely.

fresh hornet
deep pewter
#

So we are lucky if such "runtime conflict" won't happen. so in principle we should PR cetz to fix some bugs ovo.

fresh hornet
#

The states itself can be renamed. But I forgot about imports (and states) where the name of the file is not hard coded. I can not replace those too.

#

When I think about it. The sates are not the issue. For patching we could simple add some uniq value infront of each state def for each dependency. But imports that are expressions break patching. We cant just add something to them and it works.

fresh hornet
#

But it seems that is a minimal issue. Only one package in the univese seems to not hard code it.

main thicket
#

I generally recommend that internal states for packages are keyed by their version, name and some garbage to ensure it doesn't conflict with users code

placid sky
main thicket
#

That should be fine, I use something similar for tytanic

#

I just copied what typst uses

kindred hollow
#

Over the Christmas break I ended up writing up some thoughts and suggestions around the design of dependencies in Typst that hopefully addresses the security concerns in https://github.com/typst/typst/pull/5579#issuecomment-2545034781 while also expanding on the idea of typst.toml being used for larger Typst projects as opposed to just packages. I thought I would add it here as I hope it could be a useful starting point for a design discussion around the implementation of non-Universe packages when the time for that comes.

Though I am a keen and long-time user of Typst, I am a bit of a tourist in the Typst development community, so my apologises if this is not the right forum for such a discussion.

Typst Projects and Dependencies Design Discussion: https://typst.app/project/RO6NOpDmMvjVoYDk2WAXyq

sleek halo
# kindred hollow Over the Christmas break I ended up writing up some thoughts and suggestions aro...

I don't have enough time to go into as much depth as you have, but I'm also interested in this topic (from the "using packages not on Universe" angle, less the "declaring dependencies" angle) and have some comments.

First, I'm a fan of trying things out in "user space" where possible. That doesn't work for the @dep syntax, but infrastructure around the [dependencies] table in typst.toml could be added as [tool.dependencies] for third party tools to pick up.

(a problem with this is that the typst-kit crate for parsing typst.toml files requires the package section; removing that requirement would make tool sections for documents/projects more feasible, but that's a simple change)

Related are these feature requests on the typship third party package manager: typship#29, typship#34

A big part of what you want is probably the convenience of not having to use third party tools, but the design space here is very big (just compare your proposal and the two issues—all very different), so I think it's more realistic and also the safer approach for Typst to see first try one or two approaches outside the compiler and learn from them. Web app integration is not possible this way, of course.

#

Second, some of what you want can be done by adopting conventions/patterns instead of adding features to Typst. Instead of [dependencies] in typst.toml, a file like deps.typ can also be used to centralize dependencies. This gives reuse of dependencies between different entry points, and to some extent makes imports static (at least as static as what you describe in 3.d.v).

Similarly, the [project] table could be emulated by a project.typ file that contains some variable definitions. Imo thinking about possibilities like this encourages separating the different aspects in the proposal: What is the actual core that can't be achieved using conventions, and has to go into the compiler (or a tool)? To me, the answer is resolving non-Universe packages and enabling dependency overrides, so personally I would look at whether there is a design that can achieve these (together or separate) without touching all the other aspects as well.

kindred hollow
#

Thank you for taking a look!

I agree that I was probably a bit overly enthusiastic including suggestions such as the [project] table in the proposal. These are really intended to be seen as potential additional suggestions that are separate from the main topic, but are included to sound out whether the proposal fits organically within Typst — [project] is an entirely optional part of the fleshing out of typst.toml such that it goes beyond just packages. This ties in with the distinction between documents and projects in the proposal.

I agree that this table in particular is easily replaced with the existing scripting functionality of Typst and should only be included if would be considered idiomatic, in which case its inclusion could help guide users towards an idiomatically correct/preferred setup.

I also use the deps.typ trick today, but to me this seems as more of a workaround due to the limitations of the current implementation. Similarly, while I think projects such as typship and utpm do a great job exploring the design space, I would also argue that a first-party implementation would be very valuable, and probably necessary for use in the WebApp. I don't think the discussion around a first-party implementation needs to wait for 3rd party tools to be further developed. One of the best features of Typst is that it ships in a single binary and is easy to embed and install — that all goes away if important features such as non-Universe packages are relegated to third party tools.

The idea of resolving dependencies statically, either entirely or partially, I think could potentially be a very good design choice for Typst and would alleviate the concern around data exfiltration, which exists in principle even for Universe packages today.

If time permits, I will have another go at the proposal and reduce the emphasis on the [project] table, which I agree detracts from the discussion at the moment.

main thicket
#

I think, just like they said in their comment, adding the field to the manifest is backwards compatible assuming noone has added weird non-standard fields to their manifests. I looked at the package-check and it seems to only check known fields, not reject unknown fields though, bit of a bummer if that bites us.

How do we feel about a separate display-name field? Should this be added, there's some merit to it, considering that the target audience of Typst aren't necessarily programmers, but I also feel like ther will ahrdly be a difference bewteen the display name and the identifier name.

#

90% of the time it'll be spaces instead of dashes and title case

sleek halo
#

I'd be in favor; I specify a kinda display name as the title in my PDF manuals, and that field would reduce manual adjustments. The use case in the latest comment (before tinger's) resonates in a similar manner.

cerulean tangle
#

Is it planned to let packages use Typst for their README at some point (not necessarily in the next release)?

main thicket
#

I think that's a logical step once package documentation is also typst based

cerulean tangle
#

That makes sense, especially because then both the README and the documentation would probably be the same thing

main thicket
#

Yeah I reckon there would be a dedicated way to host a docs page with reference and examples separate from the github readme

cerulean tangle
#

One of the issues I have with the current README.md for packages is that many packages use the same README for their GitHub repo as for the package itself, meaning the Typst Universe page ends up describing what Typst is and how to build the package, which most users don't care about.
So anything that prevents authors from being able to reuse the same file is an improvement imo

main thicket
#

Yes but that's not easily avoided because the universe page doesn't show anything other than the readme AFAIK

mild carbon
#

I would also hope there's a way to compile the manual for a package from the cli

cerulean tangle
main thicket
#

Yes that's what I mean

#

I believe this will happen even before the non preview namespace

#

I think this is the logical conclusion to the typst docs themselves being selfhosted already