Site icon R-bloggers

Diffify & Posit Package Manager

[This article was first published on The Jumping Rivers Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The latest release of Posit Package Manager introduces several enhancements, including:

All great stuff, I’m sure. But most of them don’t directly impact the end user. But there is an exception to this rule, and that’s the ability to add custom metadata to a package page.

What is Package Metadata?

Custom metadata lets administrators define key-value pairs for packages. For instance, you could tag packages as part of the tidyverse with is_tidyverse: TRUE|FALSE. Other use cases include:

Metadata can apply globally (e.g., all versions of {dplyr}) or to specific versions in a repository.

How to Add Metadata

Metadata is added via the API. Start by creating a token:

# Care should be taken over expires and scope
rspm create token --scope=global:admin --expires=never --description="Allows global admin access"

## Generated an access token. Be sure to record this token immediately since you will not be able to retrieve it later.
# eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

This will generate an access token (e.g., eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...). As with most tokens, it’s not retrievable, so put it somewhere secure.

Test the token on the API page, ensuring you prefix it with Bearer when authorizing.

For example, a /verify-auth GET request with a valid token should return a 200 response, confirming successful authorization.

Linking with diffify.com

The diffify.com website has a predictable URL structure: diffify.com/language/package-name/old-version/new-version, where

diffify.com & Posit Package Manager

Adding the diffify links to PPM is performed using the

and/or

API calls. Depending on how precise you want to be you can either add a global tag, e.g.

Diffify: https://diffify.com/r/datasauRus

which would work for all versions of diffify. This is less work for the admin, but the user has to perform an extra click.

Or specify the version number in the URL,

Diffify: https://diffify.com/r/datasauRus/0.1.2

which is more work for the admin, but nicer for the user. The end result after this hard work is a nice link near the top of the page.

To learn more about diffify.com, check out our blog posts here!

For updates and revisions to this article, see the original post

To leave a comment for the author, please follow the link and comment on their blog: The Jumping Rivers Blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Exit mobile version