Skip to content

Commit 8f9343a

Browse files
committed
docs: make README an Rmd
1 parent 4eee832 commit 8f9343a

File tree

2 files changed

+110
-0
lines changed

2 files changed

+110
-0
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ dev-stop:
2020
$(RSC_API_KEYS): dev-start
2121
python script/setup-rsconnect/dump_api_keys.py $@
2222

23+
README.md: README.Rmd
24+
jupytext --from Rmd --to ipynb --output - $^ \
25+
| jupyter nbconvert \
26+
--stdin --to markdown \
27+
--execute \
28+
--ExecutePreprocessor.kernel_name='venv-pins-python' \
29+
--TagRemovePreprocessor.remove_all_outputs_tags='hide-cell' \
30+
--TagRemovePreprocessor.remove_input_tags='hide-cell' \
31+
--output $@
32+
2333
test:
2434
pytest
2535

README.Rmd

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
jupyter:
3+
jupytext:
4+
text_representation:
5+
extension: .Rmd
6+
format_name: rmarkdown
7+
format_version: '1.2'
8+
jupytext_version: 1.13.6
9+
kernelspec:
10+
display_name: venv-pins-python
11+
language: python
12+
name: venv-pins-python
13+
---
14+
15+
# pins-python
16+
17+
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/machow/pins-python/HEAD)
18+
19+
The pins package publishes data, models, and other python objects, making it
20+
easy to share them across projects and with your colleagues. You can pin
21+
objects to a variety of pin *boards*, including folders (to share on a
22+
networked drive or with services like DropBox), RStudio Connect, and Amazon
23+
S3.
24+
Pins can be automatically versioned, making it straightforward to track changes,
25+
re-run analyses on historical data, and undo mistakes.
26+
27+
## Installation
28+
29+
```shell
30+
python -m pip install pins
31+
```
32+
33+
## Usage
34+
35+
See the [documentation](https://rstudio.github.io/pins-python) for getting started.
36+
37+
To use the pins package, you must first create a pin board. A good place
38+
to start is `board_folder()`, which stores pins in a directory you
39+
specify. Here I’ll use a special version of `board_folder()` called
40+
`board_temp()` which creates a temporary board that’s automatically
41+
deleted when your R session ends. This is great for examples, but
42+
obviously you shouldn't use it for real work!
43+
44+
```{python}
45+
import pins
46+
from pins.data import mtcars
47+
48+
board = pins.board_temp()
49+
```
50+
51+
You can “pin” (save) data to a board with the `.pin_write()` method. It requires three
52+
arguments: an object, a name, and a pin type:
53+
54+
```{python}
55+
board.pin_write(mtcars.head(), "mtcars", type="csv")
56+
```
57+
58+
Above, we saved the data as a CSV, but depending on
59+
what you’re saving and who else you want to read it, you might use the
60+
`type` argument to instead save it as a `joblib` or `arrow` file (NOTE: arrow is not yet supported).
61+
62+
You can later retrieve the pinned data with `.pin_read()`:
63+
64+
```{python}
65+
board.pin_read("mtcars")
66+
```
67+
68+
A board on your computer is good place to start, but the real power of
69+
pins comes when you use a board that’s shared with multiple people. To
70+
get started, you can use `board_folder()` with a directory on a shared
71+
drive or in dropbox, or if you use [RStudio
72+
Connect](https://www.rstudio.com/products/connect/) you can use
73+
`board_rsconnect()`:
74+
75+
```python
76+
# Note that this uses one approach to connecting,
77+
# the environment variables CONNECT_SERVER and CONNECT_API_KEY
78+
79+
board = pins.board_rsconnect()
80+
board.pin_write(tidy_sales_data, "hadley/sales-summary", type="csv")
81+
```
82+
83+
Then, someone else (or an automated report) can read and use your
84+
pin:
85+
86+
```python
87+
board = board_rsconnect()
88+
board.pin_read("hadley/sales-summary")
89+
```
90+
91+
You can easily control who gets to access the data using the RStudio
92+
Connect permissions pane.
93+
94+
The pins package also includes boards that allow you to share data on
95+
services like Amazon’s S3 (`board_s3()`), with plans to support other backends--
96+
such as Azure's blob storage.
97+
98+
## Development
99+
100+
See [CONTRIBUTING.md](CONTRIBUTING.md)

0 commit comments

Comments
 (0)