Skip to content
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

Adding arbitrary fields to packages.json #530

Open
noamross opened this issue Nov 20, 2024 · 4 comments
Open

Adding arbitrary fields to packages.json #530

noamross opened this issue Nov 20, 2024 · 4 comments

Comments

@noamross
Copy link

Potential idea: Could a universe's packages.json contain arbitrary fields? This way someone managing a collection of packages could use the packages.json file as a single source of truth for information, such as whether the packages are deprecated, their lifecycle stage, or other topics.

At its simplest all this would require is some documentation of fields that R-Universe would ignore, or designate an extra-metadata that could serve arbitrary JSON or standard prefix for fields (x-). However, it would be even better if this information could be passed on through the R-Universe API, so someone building on top of the API would have access to additional fields. We were discussing reviving the RECON website's package page and thought the best way to do it would be if we could just power all the content from the https://reconhub.r-universe.dev API endpoints.

@jeroen
Copy link
Member

jeroen commented Nov 20, 2024

Yes you can put anything in there. We just parse it with jsonlite::fromJSON()and look at is the package and url and optionally branch and subdir columns. The rest is ignored.

The easiest way to store custom metadata is put it in the DESCRIPTION files of the individual packages. Each field in the package DESCRIPTION file will be stored in the database and exposed as a field the API. CRAN allows you to stick any custom field that starts with Config/.

For example have a look at:

df <- jsonlite::fromJSON("https://ropensci.r-universe.dev/api/packages")
names(df)

What is the sort of metadata you would want to put in the packages.json file that is not available from the DESCRIPTION files?

@noamross
Copy link
Author

We were thinking about something like lifecycle designations/badges (https://www.reconverse.org/lifecycle.html). While you can put custom info in Config/ , this might depend on whether the info is controlled by the package owner or the universe owner. For instance, the information we put in the rOpenSci registry, like the peer-review link or bronze/silver/gold badging for stats packages, is universe/repo-level-controlled rather than package-level. If a Universe owner wants to put some metadata like this to organize packages, they might want it in packages.json rather than requiring the package authors to modify their DESCRIPTION.

@jeroen
Copy link
Member

jeroen commented Nov 21, 2024

Yeah I guess we can add that. It's not entirely trivial because in the workflow, the syncing of registries is completely separate from building packages and deploying. But we can probably find a way.

Would you like metadata field in the registry json that we copy to the database? What would it be called?

@noamross
Copy link
Author

metadata is probably fine, unless we want something like universe-metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants