Posit Connect

Posit Connect is a publishing platform for the work your teams create in R and Python. Share Shiny applications, R Markdown reports, Plumber Application Programming Interfaces (APIs), dashboards, plots, Jupyter Notebooks, and more in one convenient place. To learn more, visit the Posit Connect Product Page and contact your Posit Customer Success Representative.

For the latest information on integrating Posit Package Manager with Connect, see the Integration with Posit Package Manager section of the Connect admin guide.

If you want to configure Connect to install packages from an authenticated repository, see Authenticated Repositories below.

Authenticated repositories

Getting a token

You can create a token to use for repository authentication using the rspm create token Command Line Interface (CLI) command. See Creating API Tokens for details.

Configure Connect for authenticated R repositories

If any of your R repositories require authentication, you can configure credentials for Connect by creating a netrc file. This method is widely supported and provides a secure way to access authenticated repositories in R.

  1. Create a netrc file in a location that is accessible to the RunAs user (typically rstudio-connect), such as /etc/netrc.

    Add the following content, replacing [packagemanager.example.com] with your Package Manager server address and [your-token] with your actual token.

    /etc/netrc
    machine [packagemanager.example.com]
    login __token__
    password [your-token]

    The machine field should not contain a protocol, port, or repository path. If your repository Uniform Resource Locator (URL) is https://packagemanager.example.com/cran/__linux__/noble/latest, use packagemanager.example.com for the machine field.

  2. Create a .curlrc file in the home directory of the default RunAs user, typically at /home/rstudio-connect/.curlrc. Add the following content:

    /home/rstudio-connect/.curlrc
    --netrc-file /etc/netrc

Users should also configure credentials when deploying content by following the instructions in the Authenticated R Repositories section of the User Guide.

Warning

All deployed content can access the credentials stored in /etc/netrc. To mitigate this security risk, ensure that your API token restricts scopes to repos:read for the necessary repositories.

Configure Connect for authenticated Python repositories

Connect uses uv by default to install Python packages. You can configure credentials for Connect by creating a netrc file, which works with both uv and pip.

If any of your Python repositories require authentication, you can configure credentials for Connect by creating a netrc file. This method is widely supported and provides a secure way to access authenticated repositories in Python.

  1. Create a netrc file in a location that is accessible to all users, such as /etc/netrc.

    Add the following content, replacing [packagemanager.example.com] with your Package Manager server address and [your-token] with your actual token.

    /etc/netrc
    machine [packagemanager.example.com]
    login __token__
    password [your-token]

The machine field should not contain a protocol, port, or repository path. If your repository URL is https://packagemanager.example.com/pypi/latest, use packagemanager.example.com for the machine field.

  1. Set the NETRC=/etc/netrc environment variable for the Connect server process. If the Connect service is managed by systemd, you can simply add the environment variable to /etc/default/rstudio-connect. If the file does not exist, create it.

    /etc/default/rstudio-connect
    NETRC=/etc/netrc
  2. Configure the repository URL for Connect. Since Connect uses uv by default, we recommend configuring uv. If you have legacy content that requires pip, you can configure both. You can check compatibility using Astral’s compatibility page.

    For uv (recommended), add the following lines to /etc/uv/uv.toml, replacing packagemanager.example.com with your Package Manager server address:

    /etc/uv/uv.toml
    [[index]]
    url = "https://packagemanager.example.com/pypi/latest/simple"
    default = true

    For pip (legacy content), add the following lines to /etc/pip.conf:

    /etc/pip.conf
    [global]
    timeout = 60
    index-url = https://packagemanager.example.com/pypi/latest/simple
    trusted-host = packagemanager.example.com

    Both uv and pip will automatically use the credentials from the netrc file when accessing authenticated repositories.

Users should also configure credentials when deploying content by following the instructions in the Authenticated Python Repositories section of the User Guide.

Note

When deploying projects that use uv to manage dependencies, you must generate a requirements.txt file for Connect. See the Package Manager Setup User Interface (UI) for detailed instructions on using uv export to generate the requirements file with the correct index URL configuration.

Warning

All deployed content can access the credentials stored in /etc/netrc. To mitigate this security risk, ensure that your API token restricts scopes to repos:read for the necessary repositories.

Back to top