1- # pins-python
1+ # pins
2+ <a href =" https://rstudio.github.io/pins-python/ " ><img src =" docs/logo.png " align =" right " height =" 138 " /></a >
23
3- The pins package publishes data, models, and other Python objects, making it
4- easy to share them across projects and with your colleagues. You can pin
5- objects to a variety of pin * boards* , including folders (to share on a
6- networked drive or with services like DropBox), Posit Connect, Amazon
7- S3, and Google Cloud Storage.
8- Pins can be automatically versioned, making it straightforward to track changes,
9- re-run analyses on historical data, and undo mistakes.
4+ The pins package publishes data, models, and other Python objects,
5+ making it easy to share them across projects and with your colleagues.
6+ You can pin objects to a variety of pin * boards* , including folders (to
7+ share on a networked drive or with services like DropBox), Posit
8+ Connect, Amazon S3, and Google Cloud Storage. Pins can be automatically
9+ versioned, making it straightforward to track changes, re-run analyses
10+ on historical data, and undo mistakes.
1011
11- See the [ documentation] ( https://rstudio.github.io/pins-python ) for getting started.
12+ See the [ documentation] ( https://rstudio.github.io/pins-python ) for
13+ getting started.
14+
15+ You can use pins from R as well as Python. For example, you can use one
16+ language to read a pin created with the other. Learn more about [ pins
17+ for R] ( https://pins.rstudio.com ) .
1218
1319## Installation
1420
15- ``` shell
21+ You can install the released version of vetiver from
22+ [ PyPI] ( https://pypi.org/project/pins/ ) :
23+
24+ ``` shell
1625python -m pip install pins
1726```
1827
19- ## Usage
28+ And the development version from
29+ [ GitHub] ( https://github.com/rstudio/pins-python ) with:
2030
21- See the [ documentation] ( https://rstudio.github.io/pins-python ) for getting started.
31+ ``` shell
32+ python -m pip install git+https://github.com/rstudio/pins-python
33+ ```
34+
35+ ## Usage
2236
2337To use the pins package, you must first create a pin board. A good place
2438to start is ` board_folder() ` , which stores pins in a directory you
2539specify. Here I’ll use a special version of ` board_folder() ` called
2640` board_temp() ` which creates a temporary board that’s automatically
27- deleted when your Python script or notebook session ends. This is great for examples, but
28- obviously you shouldn' t use it for real work!
41+ deleted when your Python script or notebook session ends. This is great
42+ for examples, but obviously you shouldn’ t use it for real work!
2943
30-
31- ``` python
44+ ``` python
3245import pins
3346from pins.data import mtcars
3447
3548board = pins.board_temp()
3649```
3750
38- You can "pin" (save) data to a board with the ` .pin_write() ` method. It requires three
39- arguments: an object, a name, and a pin type:
40-
51+ You can “pin” (save) data to a board with the ` .pin_write() ` method. It
52+ requires three arguments: an object, a name, and a pin type:
4153
42- ``` python
54+ ``` python
4355board.pin_write(mtcars.head(), " mtcars" , type = " csv" )
4456```
4557
4658 Writing pin:
4759 Name: 'mtcars'
48- Version: 20230410T151442Z-120a5
49-
50-
51-
60+ Version: 20230523T115348Z-120a5
5261
62+ Meta(title='mtcars: a pinned 5 x 11 DataFrame', description=None, created='20230523T115348Z', pin_hash='120a54f7e0818041', file='mtcars.csv', file_size=249, type='csv', api_version=1, version=Version(created=datetime.datetime(2023, 5, 23, 11, 53, 48, 555797), hash='120a54f7e0818041'), tags=None, name='mtcars', user={}, local={})
5363
54- Meta(title='mtcars: a pinned 5 x 11 DataFrame', description=None, created='20230410T151442Z', pin_hash='120a54f7e0818041', file='mtcars.csv', file_size=249, type='csv', api_version=1, version=Version(created=datetime.datetime(2023, 4, 10, 15, 14, 42, 55001), hash='120a54f7e0818041'), tags=None, name='mtcars', user={}, local={})
55-
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 ` , ` parquet ` , or ` json ` file.
64+ Above, we saved the data as a CSV, but depending on what you’re saving
65+ and who else you want to read it, you might use the ` type ` argument to
66+ instead save it as a ` joblib ` , ` parquet ` , or ` json ` file.
6167
6268You can later retrieve the pinned data with ` .pin_read() ` :
6369
64-
65- ``` python
70+ ``` python
6671board.pin_read(" mtcars" )
6772```
6873
69-
70-
71-
7274 mpg cyl disp hp drat wt qsec vs am gear carb
7375 0 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4
7476 1 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4
7577 2 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1
7678 3 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1
7779 4 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2
7880
79-
80-
8181A board on your computer is good place to start, but the real power of
8282pins comes when you use a board that’s shared with multiple people. To
8383get started, you can use ` board_folder() ` with a directory on a shared
8484drive or in DropBox, or if you use [ Posit
8585Connect] ( https://posit.co/products/enterprise/connect/ ) you can use
8686` board_connect() ` :
8787
88- ``` python
88+ ``` python
8989# Note that this uses one approach to connecting,
9090# the environment variables CONNECT_SERVER and CONNECT_API_KEY
9191
9292board = pins.board_connect()
9393board.pin_write(tidy_sales_data, " hadley/sales-summary" , type = " csv" )
9494```
9595
96- Then, someone else (or an automated report) can read and use your
97- pin:
96+ Then, someone else (or an automated report) can read and use your pin:
9897
99- ``` python
98+ ``` python
10099board = board_connect()
101100board.pin_read(" hadley/sales-summary" )
102101```
@@ -105,9 +104,14 @@ You can easily control who gets to access the data using the Posit
105104Connect permissions pane.
106105
107106The pins package also includes boards that allow you to share data on
108- services like Amazon’s S3 (` board_s3() ` ), Google Cloud Storage (` board_gcs() ` ),
109- and Azure blob storage (` board_azure() ` ).
107+ services like Amazon’s S3 (` board_s3() ` ), Google Cloud Storage
108+ (` board_gcs() ` ), and Azure blob storage (` board_azure() ` ).
109+
110+ ## Contributing
110111
111- ## Development
112+ - This project is released with a [ Contributor Code of
113+ Conduct] ( https://www.contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html ) .
114+ By contributing to this project, you agree to abide by its terms.
112115
113- See [ CONTRIBUTING.md] ( CONTRIBUTING.md )
116+ - If you think you have encountered a bug, please [ submit an
117+ issue] ( https://github.com/rstudio/pins-python/issues ) .
0 commit comments