https://github.com/ijlyttle/pinsmanifest
Manage Manifests for URL Boards in the Pins Package
https://github.com/ijlyttle/pinsmanifest
Last synced: 16 days ago
JSON representation
Manage Manifests for URL Boards in the Pins Package
- Host: GitHub
- URL: https://github.com/ijlyttle/pinsmanifest
- Owner: ijlyttle
- License: other
- Created: 2022-08-06T13:31:46.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-11-07T02:36:50.000Z (over 3 years ago)
- Last Synced: 2026-03-31T16:48:11.591Z (3 months ago)
- Language: R
- Homepage: https://ijlyttle.github.io/pinsManifest/
- Size: 413 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE.md
Awesome Lists containing this project
README
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# pinsManifest
[](https://github.com/ijlyttle/pinsManifest/actions/workflows/R-CMD-check.yaml)
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
The goal of pinsManifest is to help with a particular use-case for [pins](https://pins.rstudio.com/):
- you create a board using `pins::board_folder()`
- you serve the board using `pins::board_url()`
The mechanism is to make a *manifest* file of pins used to create a `pins::board_url()`.
It is hoped that this package can motivate a discussion to see if these ideas could be integrated into the pins package itself.
In other words, one version of success is that this package need not exist.
Towards that end, these ideas are being adopted into pins (yay!).
As a result, I'm making changes here to track the changes there.
## Installation
You can install the development version of pinsManifest from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("ijlyttle/pinsManifest")
```
## Example
```{r}
library("pinsManifest")
```
### Writing a folder-board
Let's say you have a `pins::board_folder()` that you want to serve as a website, perhaps using GitHub.
You can write a manifest file for the pins using `pin_write_manifest()`:
``` r
board <- pins::board_folder("/some/path")
# add/update pins
pin_write_manifest(board)
#> Manifest file written to `/some/path/_pins.yaml`
```
This writes a manifest file, `_pins.yaml` to root directory of your board.
It stores the names of your pins and the names of each version of each pin.
Note: `pin_write_manifest()` supports only boards created using `pins::board_folder()`.
### Reading a URL-board
To create a `pins::board_url()`, you need a named character-vector where:
- names are names of pins
- values are the URLs that point to a version-directory
The problem is that the names of version directories are, by design, hard to predict and manage manually.
This is where a manifest file, `_pins.yaml` can help.
When you call `board_url_manifest()`, it downloads `_pins.yaml`, then parses it to provide information to build a `pins::board_url()`.
A demonstration board is provided using `url_demo_manifest()`:
```{r}
board_demo <- board_url_manifest(url_demo_manifest())
pins::pin_list(board_demo)
pins::pin_meta(board_demo, "mtcars-json")
```
### Behind the scenes
The function `manifest_latest()`:
- takes a `url` describing the root directory of a board
- downloads and parses the `_pins.yaml` file at the root
- returns a named character vector where:
- names are names of pins
- values are URLs to directory for the latest version for each pin
The return value can be used to build a `pins::board_url()`:
```{r}
manifest_latest(url_demo_manifest())
```