2. Packaging 101


In this section, you will learn:


Package Manager Mental Model

Package Manager consists of several different components that you need to understand to administer it effectively:

A diagram that explains how repositories, sources, and packages related to one another

  • Package: A package is a bundled unit of R or Python code built in a specific format. A package may have many versions and have different binaries for different operating systems. Examples of packages include dplyr in R and pandas in Python.
  • Source: A source is a collection of packages from a single location (e.g. git, CRAN, PyPI, etc.). Typically sources are transparent to the end users of Package Manager and are only dealt with by the Package Manager administrator.
  • Repository: A repository is a collection of one or more sources. Each repository has a unique endpoint that users can configure R or Python to pull packages.

In the user interface, users can explore the different repositories and packages available to them. Sources are not exposed via the user interface and are transparent to the end user.

Screenshot of Package Manager user interface.

Packages

A package is a bundled unit of R or Python code built in a specific format. A package may have many versions and have different binaries for different operating systems. Examples of packages include dplyr in R and pandas in Python.

Package Manager can distribute packages in two formats:

  • Source code: The source code is delivered to the end user in plain text files. The end user’s computer is responsible for compiling the source code to run on their machine.
  • Binary: A single binary file specific to the end user’s operating system is delivered.

Posit Package Manager can deliver binary or source code packages to end users.

Sources

Package Manager has several different types of sources. These include:

  • cran source - This source contains metadata and packages from Posit’s CRAN service. The source can be used directly in a repository to give users access to all CRAN packages, or it can be used indirectly by curated-cran sources.
  • pypi source - This source contains metadata and packages from Posit’s PyPI service. The source can be used directly in a Python repository to give users access to all PyPI packages.
  • bioconductor source - Bioconductor sources combine one or more internal sources (such as “bioc”, “data/annotation”, etc.) into a “meta-source” to represent a given bioconductor version. These meta-sources behave similarly to cran sources. See the Bioconductor Source section for more information.
  • curated-cran source - A curated CRAN source exposes an approved set of CRAN packages. Administrators can add packages to the set and update the set. See the Curated CRAN Source section for more information.
  • cran-snapshot source - A CRAN source pinned to a specific CRAN snapshot. Administrators can periodically update the snapshot to which the cran-snapshot source is pinned. See the CRAN Snapshot Source section for more information.
  • local source - A local source is used to distribute locally developed packages or other packages without native support in Posit Package Manager. Administrators add packages to local sources by specifying a path to a package’s tar file.
  • git source - A git source allows Posit Package Manager to automatically make packages in Git available to R users through install.packages (without requiring devtools). Git sources work for internal packages and external sites such as GitHub. Packages can be automatically updated on each commit or when a new Git tag is pushed.

Repositories

Package Manager has several different types of repositories. These include:

  • R - A CRAN-like repository for R packages.
  • Python - A repository that provides the Simple Repository API specified by PEP 503. This interface is used by pip and other tools that draw from Python Package Index (PyPI).
  • Bioconductor - A repository for Bioconductor R packages that supports use by BiocManager.

You will notice that repositories are distinguished by the language they support. A repository can contain one or many sources. However, the sources must be of the same language type. For example:

  • Repository A:
    • cran source
    • git source
  • Repository B:
    • cran source
    • pypi source

Repository A will work because it contains two compatible sources. Repository B will not work because CRAN and PyPi sources are incompatible.


Go to: 3. System Dependencies

Back to top