-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added metadata in Tectonic.toml #1120
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1120 +/- ##
==========================================
- Coverage 46.22% 46.20% -0.02%
==========================================
Files 171 171
Lines 65069 65104 +35
==========================================
+ Hits 30077 30082 +5
- Misses 34992 35022 +30 ☔ View full report in Codecov by Sentry. |
Personally, I have a rather irrational dislike of metadata-like fields, nobody can verify their correctness, besides perhaps their levenshtein distance to some common metadata (which would be pretty fraught if your correct metadata happens to have a close enough distance to some common metadata). I would much rather see a json-ld based input format, and a schema for tectonic.toml <-> json, such that other tools are free to build schemas for their data and we can still extract the tectonic-specific bits from it. FWIW, I had posted a bit about this in the old tectonic forums about two years ago asking that we avoid adding such fields in the future, and work towards a better way than needing to embed arbitrary metadata fields. So if there is a cure for fuddy duddy, I have not discovered it. |
I don't think I understand. Why would we need to verify the correctness of metadata? In fact, this PR implements borrows this feature from cargo. It's an elegant solution to the problem---it doesn't require any extra files, and it's completely orthogonal to the regular build process.
Why the complexity? Another format when we already support toml? For more complex tools, we could easily make If there is one, I'd argue that tools complex enough to warrant that should be parsing |
If it is completely orthogonal it belongs in a completely separate .toml file alongside I'd argue for the more complex scheme of linked data, when the data being added is well... linked to the data in the toml file. I don't like it in cargo either and think it is a mistake. With a schema, tectonic itself can consume the schema and check for well-formedness regardless of the tool, with the context of the metadata retained.
Because toml doesn't support arbitrary data in a way which is self-describing and checkable for well-formedness. IMO forcing people who want to embed arbitrary data in tectonic.toml to use a different format better suited to solving these problems and providing a migration path from Tectonic.toml seems like an adequate trade-off... Once we include this metadata the migration can no longer be done automatically, and the output now contains blobs devoid of any context.
Sure... it's easy, but it is also unprincipled, metadata could clash, only the author knows what tools consume it or what it means. |
I think I actually agree with most of these points... Cranko options in tectonic's tomls caused me a bit of confusion earlier today. But I'd still argue for a simple scheme. 99% of tectonic users won't ever need metadata, and 99% of those that do will only need a few simple values. Making an extra file for three lines of, say, auto-publish metadata isn't ideal. At that point, I'd just roll my own metadata file instead of dealing with a schema. Tectonic isn't a fully-fledged build system, it's a TeX compiler. Fancy linked schemas may be nice for cargo, but they're beyond overkill for tectonic. |
To me at least, it comes down to whether we want to include arbitrary data despite the downsides of doing so. But I don't think the alternative of not including arbitrary metadata, and forcing users with metadata to create their own toml file is so inconvenient that it is worth allowing it in Anyhow, thanks for hearing me out at least. |
Hmm, this is an interesting discussion! I think it might be clarifying to focus on some specific use cases. @rm-dr, I would guess that there's a goal that this proposed functionality would help you accomplish? Can you describe the sort of things that you envision doing with this feature? At the moment, although I don't personally have any projects where I can see myself using this functionality, I can see how it could come in handy. In particular, while it's true that Tectonic's capabilities as a build system are pretty limited, I would like to see them get stronger, with better "workspace" support in particular. As those capabilities (hopefully) improve, I think it becomes more valuable to have a metadata system that's integrated with the semantics of the broader build system. As things stand right now, it does feel a bit like overkill, but hopefully that won't always be the case. |
Here's mine. I could, of course, add a file to every week's workspace... [doc.metadata]
title = "pretty title"
description = "sentence"
publish = false ...with a few elegant |
Thanks, I think that's helpful. As I wrote above, I don't mind generic metadata fields in these sorts of files, at least not as much as @ratmice. While I don't think that it's wise to encourage people to make up their own fields in the abstract hope that they'll be useful, I think that these sorts of mechanisms have proven to be useful when you want to integrate some kind of value-add tool that integrates with the main build framework (e.g., my Cranko tool, or @rm-dr's use case here). And I'd like to hope that the Tectonic document model will open up lots of nice possibilities for exactly that sort of thing. I can't disagree that you can always add another file that just sits next to your (e.g.) The aspect that concerns me a bit more here is adding to the CLI's "surface area" to add utilities to print out the metadata. Every new CLI command is something that (thinking cautiously) we have to support for the rest of time, and this particular piece of functionality seems like it could be implemented better in an entirely separate tool — there's |
That's a good point. It's a super simple feature right now, but I can see how it could become a problem later.
Of course. If the goal is to allow |
Cool. I think that I'd happy to merge a PR that added a free-metadata section to the TOML file. I'm a bit more reluctant to add generic metadata commands to the CLI. |
Done. This PR no longer provides a command, simply ignoring |
Sorry for taking absolutely forever to merge this. |
This PR adds the
tectonic show metadata
command, which allows users to embed arbitrary data in theirTectonic.toml
under thedoc.metadata
table:tectonic show metadata
is used as follows (only valid when in a workspace):The goal
tectonic show metadata
is to make scripting easier. Instead of adding additional dependencies to a bash script to parse toml files, users may usetectonic show
instead.