Skip to content

Commit

Permalink
Merge pull request #189 from rstudio/docs-posit-connect
Browse files Browse the repository at this point in the history
Docs posit connect
  • Loading branch information
machow authored Mar 21, 2023
2 parents 94973c5 + d230073 commit b6049c8
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 23 deletions.
16 changes: 9 additions & 7 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ pd.set_option("display.notebook_repr_html", False)
The pins package publishes data, models, and other Python objects, making it
easy to share them across projects and with your colleagues. You can pin
objects to a variety of pin *boards*, including folders (to share on a
networked drive or with services like DropBox), RStudio Connect, and Amazon
S3.
networked drive or with services like DropBox), Posit Connect, Amazon
S3, and Google Cloud Storage.
Pins can be automatically versioned, making it straightforward to track changes,
re-run analyses on historical data, and undo mistakes.

See the [documentation](https://rstudio.github.io/pins-python) for getting started.

## Installation

```shell
Expand Down Expand Up @@ -50,7 +52,7 @@ board.pin_write(mtcars.head(), "mtcars", type="csv")

Above, we saved the data as a CSV, but depending on
what you’re saving and who else you want to read it, you might use the
`type` argument to instead save it as a `joblib` or `arrow` file (NOTE: arrow is not yet supported).
`type` argument to instead save it as a `joblib`, `parquet`, or `json` file.

You can later retrieve the pinned data with `.pin_read()`:

Expand All @@ -61,7 +63,7 @@ board.pin_read("mtcars")
A board on your computer is good place to start, but the real power of
pins comes when you use a board that’s shared with multiple people. To
get started, you can use `board_folder()` with a directory on a shared
drive or in DropBox, or if you use [RStudio
drive or in DropBox, or if you use [Posit
Connect](https://www.rstudio.com/products/connect/) you can use
`board_rsconnect()`:

Expand All @@ -81,12 +83,12 @@ board = board_rsconnect()
board.pin_read("hadley/sales-summary")
```

You can easily control who gets to access the data using the RStudio
You can easily control who gets to access the data using the Posit
Connect permissions pane.

The pins package also includes boards that allow you to share data on
services like Amazon’s S3 (`board_s3()`), with plans to support other backends--
such as Azure's blob storage.
services like Amazon’s S3 (`board_s3()`), Google Cloud Storage (`board_gcs()`),
and Azure blob storage (`board_azure()`).

## Development

Expand Down
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
The pins package publishes data, models, and other Python objects, making it
easy to share them across projects and with your colleagues. You can pin
objects to a variety of pin *boards*, including folders (to share on a
networked drive or with services like DropBox), RStudio Connect, Amazon S3,
and Google Cloud Storage.
networked drive or with services like DropBox), Posit Connect, Amazon
S3, and Google Cloud Storage.
Pins can be automatically versioned, making it straightforward to track changes,
re-run analyses on historical data, and undo mistakes.

See the [documentation](https://rstudio.github.io/pins-python) for getting started.

## Installation

```shell
Expand Down Expand Up @@ -43,19 +45,21 @@ arguments: an object, a name, and a pin type:
board.pin_write(mtcars.head(), "mtcars", type="csv")
```

Writing to pin 'mtcars'
Writing pin:
Name: 'mtcars'
Version: 20230321T151326Z-120a5





Meta(title='mtcars: a pinned 5 x 11 DataFrame', description=None, created='20220526T165625Z', pin_hash='120a54f7e0818041', file='mtcars.csv', file_size=249, type='csv', api_version=1, version=Version(created=datetime.datetime(2022, 5, 26, 16, 56, 25, 738735), hash='120a54f7e0818041'), name='mtcars', user={})
Meta(title='mtcars: a pinned 5 x 11 DataFrame', description=None, created='20230321T151326Z', pin_hash='120a54f7e0818041', file='mtcars.csv', file_size=249, type='csv', api_version=1, version=Version(created=datetime.datetime(2023, 3, 21, 15, 13, 26, 362951), hash='120a54f7e0818041'), tags=None, name='mtcars', user={}, local={})



Above, we saved the data as a CSV, but depending on
what you’re saving and who else you want to read it, you might use the
`type` argument to instead save it as a `joblib` or `arrow` file.
`type` argument to instead save it as a `joblib`, `parquet`, or `json` file.

You can later retrieve the pinned data with `.pin_read()`:

Expand All @@ -79,7 +83,7 @@ board.pin_read("mtcars")
A board on your computer is good place to start, but the real power of
pins comes when you use a board that’s shared with multiple people. To
get started, you can use `board_folder()` with a directory on a shared
drive or in DropBox, or if you use [RStudio
drive or in DropBox, or if you use [Posit
Connect](https://www.rstudio.com/products/connect/) you can use
`board_rsconnect()`:

Expand All @@ -99,12 +103,12 @@ board = board_rsconnect()
board.pin_read("hadley/sales-summary")
```

You can easily control who gets to access the data using the RStudio
You can easily control who gets to access the data using the Posit
Connect permissions pane.

The pins package also includes boards that allow you to share data on
services like Amazon’s S3 (`board_s3()`), and Google Cloud Storage (`board_gcs`), with plans to support other backends--
such as Azure's blob storage.
services like Amazon’s S3 (`board_s3()`), Google Cloud Storage (`board_gcs()`),
and Azure blob storage (`board_azure()`).

## Development

Expand Down
10 changes: 5 additions & 5 deletions pins/constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ def board_deparse(board: BaseBoard):
Examples
--------
The example below deparses a board connected to RStudio Connect.
The example below deparses a board connected to Posit Connect.
>>> board_deparse(board_connect(server_url="http://example.com", api_key="xxx"))
"board_connect(server_url='http://example.com')"
Note that the deparsing an RStudio Connect board does not keep the api_key,
Note that the deparsing a Posit Connect board does not keep the api_key,
which is sensitive information. In this case, you can set the CONNECT_API_KEY
environment variable to connect.
Expand Down Expand Up @@ -92,7 +92,7 @@ def board(
Parameters
----------
protocol:
File system protocol. E.g. file, s3, github, rsc (for RStudio Connect).
File system protocol. E.g. file, s3, github, rsc (for Posit Connect).
See fsspec.filesystem for more information.
path:
A base path the board should use. For example, the directory the board lives in,
Expand Down Expand Up @@ -356,12 +356,12 @@ def board_url(path: str, pin_paths: dict, cache=DEFAULT, allow_pickle_read=None)
def board_connect(
server_url=None, versioned=True, api_key=None, cache=DEFAULT, allow_pickle_read=None
):
"""Create a board to read and write pins from an RStudio Connect instance.
"""Create a board to read and write pins from an Posit Connect instance.
Parameters
----------
server_url:
Url to the RStudio Connect server.
Url to the Posit Connect server.
api_key:
API key for server. If not specified, pins will attempt to read it from
CONNECT_API_KEY environment variable.
Expand Down
2 changes: 1 addition & 1 deletion pins/rsconnect/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ <h3>{{pin_name}}</h3>
<section>
<h3>Python Code</h3>

<pre id="pin-python" class="pin-code"><code class="python">from pins import board_rsconnect
<pre id="pin-python" class="pin-code"><code class="python">from pins import board_connect
board = {{board_deparse}}
board.pin_read("{{pin_name}}")</code></pre>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ <h3>derek/test_rsc_pin</h3>
<section>
<h3>Python Code</h3>

<pre id="pin-python" class="pin-code"><code class="python">from pins import board_rsconnect
<pre id="pin-python" class="pin-code"><code class="python">from pins import board_connect
board = board_connect(server_url='http://localhost:3939')
board.pin_read("derek/test_rsc_pin")</code></pre>

Expand Down

0 comments on commit b6049c8

Please sign in to comment.