@@ -20,6 +20,67 @@ python -m pip install pins
2020
2121See the [ documentation] ( https://rstudio.github.io/pins-python ) for getting started.
2222
23+ To use the pins package, you must first create a pin board. A good place
24+ to start is ` board_folder() ` , which stores pins in a directory you
25+ specify. Here I’ll use a special version of ` board_folder() ` called
26+ ` board_temp() ` which creates a temporary board that’s automatically
27+ deleted when your R session ends. This is great for examples, but
28+ obviously you shouldn't use it for real work!
29+
30+ ``` python
31+ import pins
32+ from pins.data import mtcars
33+
34+ board = pins.board_temp()
35+ ```
36+
37+ You can “pin” (save) data to a board with the ` .pin_write() ` method. It requires three
38+ arguments: an object, a name, and a pin type:
39+
40+ ``` python
41+ board.pin_write(mtcars.head(), " mtcars" , type = " csv" )
42+ ```
43+
44+ Above, we saved the data as a CSV, but depending on
45+ what you’re saving and who else you want to read it, you might use the
46+ ` type ` argument to instead save it as a ` joblib ` or ` arrow ` file (NOTE: arrow is not yet supported).
47+
48+ You can later retrieve the pinned data with ` .pin_read() ` :
49+
50+ ``` python
51+ board.pin_read(" mtcars" )
52+ ```
53+
54+ A board on your computer is good place to start, but the real power of
55+ pins comes when you use a board that’s shared with multiple people. To
56+ get started, you can use ` board_folder() ` with a directory on a shared
57+ drive or in dropbox, or if you use [ RStudio
58+ Connect] ( https://www.rstudio.com/products/connect/ ) you can use
59+ ` board_rsconnect() ` :
60+
61+ ``` python
62+ # Note that this uses one approach to connecting,
63+ # the environment variables CONNECT_SERVER and CONNECT_API_KEY
64+
65+ board = pins.board_rsconnect()
66+ board.pin_write(tidy_sales_data, " hadley/sales-summary" , type = " csv" )
67+ ```
68+
69+ Then, someone else (or an automated report) can read and use your
70+ pin:
71+
72+ ``` python
73+ board = board_rsconnect()
74+ board.pin_read(" hadley/sales-summary" )
75+ ```
76+
77+ You can easily control who gets to access the data using the RStudio
78+ Connect permissions pane.
79+
80+ The pins package also includes boards that allow you to share data on
81+ services like Amazon’s S3 (` board_s3() ` ), with plans to support other backends--
82+ such as Azure's blob storage.
83+
2384## Development
2485
2586See [ CONTRIBUTING.md] ( CONTRIBUTING.md )
0 commit comments