Repository navigation
Conversation
This allows for better modularity with wrappers and such.
|
Prior discussion: #4227 (comment) I wonder if it would make more sense to retain the original idea of being able to map one namespace to one path. Would love to hear more about potential use cases, and how that idea would interact with them. |
|
My motivation is my library for building Typst documents with packages from arbitrary git repos. Then I wouldn't have to move all the packages into the same directory, or symlink all of them together. Just create a search path. |
The former approach should win imo. I list some points about the latter aspproach from my quick thinking:
I'm wondering how compiler devs in other languages think of it. |
|
Your English is a bit hard to understand, but I will attempt to answer.
That is what it does now. But search paths in other compilers are quite common.
As is standard in tools with search paths, first wins.
I don't see how this is a problem. Someone has to put the files there. Either some tool that manages it for the user, so the users doesn't care, or the user themselves. And if it is a tool, they will most likely place it in
I'm unsure what locking has to do with anything. When would locking have to occur?
I'm sorry but I don't really understand. |
|
If you feel unfriendly to read my points, please forgive me. I'll accept whether this PR will be merged or not. I'm only personally don't like the invention of search paths and try to convince you that is not that good for a perfect typst language.
I meant you mentioned two approaches to configure packages:
Then approach 1 (existing approach that you can do) should win and approach 2 (the approach allowed since this PR) should lose, in my opinion.
I meant for a list of paths
This is different than currrent situation, where we only have two directories to check. If I know that it is not from I believe smart tools should prevent stupid errors caused by people early. For a counterexample in other language, the python's
I might have over-estimated the difficulty when I wrote this sentense. That is implementing a typst tool that respects a correct
The hard point is that this is happening when:
I have memory that typst suffered with writing package data atomically so there might be problems if we will make it more complex.
That's what I imainged with the worst future with allowing a search paths, where some orgnizations or people will abuse the search paths. I believe you won't, but allowing this will open the door to make the worst thing. It is not a strong point like above ones, but my personal feeling. |
|
I will do my best to interpret what you mean again. I don't understand why a search path "should lose," as you don't give any justification for such a thing. Search paths in other compilers are extremely common, so I'm unsure what abuse may occur. What do you imagine? You say that the user must check multiple paths, but those are paths that the user themselves choose. They can choose not to use them. Something about locking, but locking cannot occur at a directory level unless you have lock files, which Typst does not. So I don't really understand the motivation for that. Concurrently reading and writing files is, in general, hard to make sound and I don't see how it would be in-scope for Typst to care if the user is doing cursed things with their files. |
|
i have many the same use-cases. |
|
My main motivation is I would like to improve nixpkgs so that Typst packages "just work." For example, if you add a library that has a pkg-config file in the nix output to your build derivation, the pkgconfig package can detect that, and add it to the list of packages that the build system can see. Without search paths, adding such a feature for Typst is harder. |
|
I personally always found linker search paths in compilers a source of confusion. I'm not sure I want to encourage building out the system in this direction. Your use case with multiple directories sounds like it would be better served by expanding I was already a bit hesistant with adding TYPST_PACKAGE_PATH in the first place. See also the discussion preceding #4227 (comment). |
|
That is one solution, though I do consider it ugly. For Nix it would require that Nix rewrites every The Typst team seems very against this idea of dependencies that aren't in complete control of the Typst compiler, but I would not let perfect be the enemy of good. Currently using dependencies that are outside Typst Universe is not very fun, and I am trying hard to make it less painful with nixpkgs support. I am sorry that you find search paths confusing, but they are used extremely widely in build systems, are very pragmatic for real problems people have, and I do not think all things need to be designed for beginners since people are usually only beginners when they are new to something. Could you explain what you find confusing about my PR? I can add supporting documentation and examples if needed. |
|
I don't mean that your PR is confusing, but that when I started programming configuring linker search paths was super confusing to me. When it doesn't work, it usually just doesn't work without any clear indication why. Cargo-style dependency manager clicked much more with me and it's also easier to generate good error messages for this style. It's of course subjective, but so is programming language design in general.
To an extent, that is my approach with Typst though. In the sense that I want to have a coherent plan in an area before starting to take steps in one direction. I don't currently see a clear vision where ever-more package management configuration flags take us and whether it's the right target compared to a different approach, with e.g. more |
|
@laurmaedje - i see a list of different solutions here, but for a cli tool if you have an option that is no setable via cli but only config file or vice-versa isnt going to be popular. there will always be people arguing for one use-case or another until both the cli and config files and environment variables have feature parity, which isnt necessarily a bad thing at all.. since you already accepted the validity of multiple font-paths, multiple package-paths is one of the next logical consequences ... maybe followed by multiple root-paths. |
|
typst.toml support doesn't exist for projects right now so it is currently just something in someone's imagination. This isn't even more flags.
Which again. People are only beginners when they are beginning. They can just learn and then they are no longer beginners. If there are problems with errors, they can be made better! I would not prevent progress for
Making thing beginner-friendly is good, but making all feature for beginners is a mistake in my opinion. And I don't even think search paths are hard. Basically every developer has used them or will . |
That's a knockout argument. In this fashion, you could argue for anything that no one in our team is actively working on that we should ignore our vision and accept the first community suggestion. |
|
looks again as a 20:80 question.
looks like a no-brainer to me. |
i would not make that an "exclusive or" to the proposed solution above, it would give may a more structured way in their setups. the challenge is the current chicken-and-egg problem:
if you at least ship the above in production, you can collect feedback with further suggestions. |
|
My point is really just that I feel like there isn't a clear vision here for how package management in Typst should work in, let's say, two years. I don't want to start moving into a direction without a plan. You might say that this is an obvious extension of TYPST_PACKAGE_PATH, but the existence of TYPST_PACKAGE_PATH by itself is also not really planned. It was contributed at an earlier time and merged solely because I resisted less than here. I see its use, but don't think it's particularly great. It is a reasonable extension of Typst searching for packages in a fixed directory, but I'm not even sure that was a good idea in the first place. It was just how we started. We could as well have ended up in a world where the path for each non-preview package must be specified in the CLI and then the obvious extension would have been to support adding this to a config file format ( Generally, I dislike evolving the language based on "what is the next step towards the currently visible local optimum". Instead, we should try to discover the global optimum or at least potentially better local optima (of course, there isn't a global optimum per se as this is all subjective, but I hope you get my point). We might still end up with something like this, but I'm not sure we'd do. |
|
while i do see validity in the reasoning not to make a "patched up carpet" out of typst so to say, but please not also to avoid too much conservative over-engineering. suggestion: might it be possible to enable the above solution as an experimental feature via cli option ? then people that like to test it can enable it, and people that dont care are not bothered by it. |
@terefang imho it is not an effective suggestion. If there are some drawbacks and we don't investigate more, it will be a temporary solution instead of an experimental feature. A question is that: why can people process rust crates in nix, when rustc and cargo doesn't respect any "search paths"? The X-problem of @RossSmyth may build typst package layers in nix, and it is probably not necessary to solve the Y-problem: convincing that the search path is good to typst. Is search path the only solution to make life easy in nix? What's the drawback of search-based path solutions (C/C++, python, java) and registry-centric solutions (kotlin, rust, typst) and how can we learn from them? The only way to push forward the conversation is introducing more information and solving the conerning points. |
|
as i already wrote above, there will always be use-case with pros and cons. i also wrote here https://discord.com/channels/1054443721975922748/1054443722592497796/1383376688435429377 i also like to apply the KISS principle to solution to not suffer from much over-engineering. i am championing the solution above, because it is most unixy in approach and for my day job is basically "a must" once my netdevops team decides to switch over to typst. |
|
I don't think copying in a wall of LLM generated text is very helpful |
i give up for the sake of not insulting anyone. |
|
In line with my comment #6190 (comment), I'll close this PR for the time being. I am happy to continue discussing how best to evolve the package management story, but I think an issue would be a better place for that than this PR. |
|
#4776 might serve as a good in-house precedent. In my opinion, a list of search paths for They can be implemented with symlinked paths, but control over the file system is a bigger ask in any given environment than control over env variables. So that latter approach is more flexible, while not precluding the former, either. Edit: At a minimum, the singular name would have to be deprecated in favor of the plural. cc/ @RossSmyth |
This allows for better modularity with wrappers and such.