### Setup Pre-commit Hooks Source: https://github.com/rstudio/pins-python/blob/main/CONTRIBUTING.md Installs and sets up pre-commit hooks for the pins-python project. Pre-commit helps maintain code quality by running checks and formatting before each commit. ```shell python -m pip install pre-commit pre-commit install ``` -------------------------------- ### Install pins Package Source: https://github.com/rstudio/pins-python/blob/main/README.md Installs the released version of the pins package from PyPI using pip. Also shows how to install the development version from GitHub. ```shell python -m pip install pins ``` ```shell python -m pip install git+https://github.com/rstudio/pins-python ``` -------------------------------- ### Setup Posit Connect Tests Source: https://github.com/rstudio/pins-python/blob/main/CONTRIBUTING.md Command to set up the development environment for Posit Connect tests, which involves running a 'make dev' command after ensuring the RSC_LICENSE environment variable is set in the `.env` file. ```shell # Be sure to set RSC_LICENSE in .env make dev ``` -------------------------------- ### Initialize a Temporary Pin Board Source: https://github.com/rstudio/pins-python/blob/main/README.md Demonstrates how to create a temporary pin board using `board_temp()`. This board is automatically deleted when the Python session ends, making it suitable for examples and testing. ```python import pins from pins.data import mtcars board = pins.board_temp() ``` -------------------------------- ### Install pins with Dev Dependencies Source: https://github.com/rstudio/pins-python/blob/main/CONTRIBUTING.md Installs the pins-python package in editable mode with development dependencies included, allowing for direct code modifications and testing. ```shell python -m pip install -e .[dev] ``` -------------------------------- ### Run Pytest Tests Source: https://github.com/rstudio/pins-python/blob/main/CONTRIBUTING.md Provides various commands for running tests using pytest. It includes examples for running all tests, excluding specific backends (like Posit Connect), running only specific backend tests (like local filesystem), and excluding multiple backends or tests involving GitHub data. ```shell pytest pins pytest pins -m 'not fs_rsc' pytest pins -m 'fs_file' pytest pins -m 'not fs_s3 and not fs_gcs' pytest pins -m 'not skip_on_github' -k 'not pins.boards.BoardManual' ``` -------------------------------- ### Dependency Management with pip-compile Source: https://github.com/rstudio/pins-python/blob/main/binder/requirements.txt This snippet shows the autogenerated header from a pip-compile output, indicating the Python version and the command used to generate the file. It's crucial for understanding the project's build and dependency setup. ```python # # This file is autogenerated by pip-compile with python 3.8 # To update, run: # # pip-compile --extra=dev --output-file=- setup.cfg ``` -------------------------------- ### Configure Test Backends Source: https://github.com/rstudio/pins-python/blob/main/CONTRIBUTING.md Instructions for configuring the local environment for testing, specifically by copying and modifying a development environment file (`.env.dev` to `.env`) to include necessary environment variables. ```shell # Copy .env.dev to be .env # Modify .env to file in environment variables (e.g. AWS_ACCESS_KEY_ID) # Be careful not to put any sensitive information in .env.dev ! ``` -------------------------------- ### Project Metadata Source: https://github.com/rstudio/pins-python/blob/main/pins/tests/example-bundle/data.txt Provides metadata for the pins-python project, including API version, creation timestamp, file details, and user information. ```APIDOC Project Metadata: api_version: 1 - The version of the API used. created: 20220304T153828Z - The timestamp when the project was created. description: null - A description of the project (currently null). file: data_frame.csv - The name of the associated data file. file_size: 15 - The size of the data file in bytes. name: data_frame.csv - The name of the pin. pin_hash: c65b0e9785abaa60 - A hash representing the pin's content. title: some title - A title for the pin. type: csv - The type of the pin (e.g., csv). user: {} - Information about the user who created the pin (currently empty). ``` -------------------------------- ### Set Project Version Source: https://github.com/rstudio/pins-python/blob/main/CONTRIBUTING.md Demonstrates how to set the project's version number using git tags, which is automatically tracked by setuptools_scm. It also shows how to view the current version. ```shell git tag v0.0.1 python -m setuptools_scm ``` -------------------------------- ### Pinning Data with pins-python Source: https://github.com/rstudio/pins-python/blob/main/pins/tests/pin-board/y/20221215T180400Z-b81d5/data.txt This snippet demonstrates the basic usage of the pins-python library for pinning data. It shows how to create a pin, specify its type, and associate metadata like a hash and version. ```python import pins # Example of pinning data (conceptual, actual implementation may vary) # Assuming 'data' is the object to be pinned and 'pin_name' is its identifier # board = pins.get_board('local', path='./pins') # board.pin( # data, # name=pin_name, # type='json', # description='a pinned integer vector', # metadata={'pin_hash': 'b81d5bea9e760608', 'api_version': '1.0'} # ) ``` -------------------------------- ### pip-compile Build Command Source: https://github.com/rstudio/pins-python/blob/main/requirements/dev.txt This snippet shows the command used to generate the dependency file for the pins-python project. It specifies Python 3.11, extra requirements for checking, documentation, and testing, and outputs the result to standard output after stripping extras from pyproject.toml. ```bash pip-compile --extra=check --extra=doc --extra=test --output-file=- --strip-extras pyproject.toml ``` -------------------------------- ### RStudio Pins API Metadata Source: https://github.com/rstudio/pins-python/blob/main/pins/tests/_snapshots/test_board_pin_write_rsc_index_html/data.txt Metadata for the RStudio Pins API, including version, creation timestamp, description, file details, pin hash, title, type, and user information. ```APIDOC api_version: 1 created: 20200113T235859Z description: some description file: test_rsc_pin.csv file_size: 19 pin_hash: a6cf5331bf3de6c6 title: some pin type: csv user: {} ``` -------------------------------- ### Connect to Posit Connect Board Source: https://github.com/rstudio/pins-python/blob/main/README.md Establishes a connection to a Posit Connect board, typically requiring environment variables `CONNECT_SERVER` and `CONNECT_API_KEY` to be set. This allows for sharing pins within a Posit Connect environment. ```python # Note that this uses one approach to connecting, # the environment variables CONNECT_SERVER and CONNECT_API_KEY board = pins.board_connect() board.pin_write(tidy_sales_data, "hadley/sales-summary", type="csv") ``` ```python board = board_connect() board.pin_read("hadley/sales-summary") ``` -------------------------------- ### Project Dependencies Source: https://github.com/rstudio/pins-python/blob/main/requirements/dev.txt Lists the direct and transitive dependencies for the pins-python project, along with their specified versions. This information is crucial for understanding the project's environment and ensuring compatibility. ```python pathspec==0.12.1 pexpect==4.9.0 pickleshare==0.7.5 pip-tools==7.4.1 platformdirs==4.3.8 pluggy==1.6.0 plum-dispatch==2.5.7 pre-commit==4.2.0 prompt-toolkit==3.0.51 propcache==0.3.1 proto-plus==1.26.1 protobuf==6.31.1 psutil==7.0.0 ptyprocess==0.7.0 pure-eval==0.2.3 py==1.11.0 pyarrow==20.0.0 pyasn1==0.6.1 pyasn1-modules==0.4.2 pycparser==2.22 pydantic==2.11.5 pydantic-core==2.33.2 pygments==2.19.1 pyjwt==2.10.1 pyproject-hooks==1.2.0 pyright==1.1.372 pytest==7.1.3 pytest-cases==3.8.6 pytest-dotenv==0.5.2 pytest-parallel==0.1.1 python-dateutil==2.9.0.post0 python-dotenv==1.1.0 pytz==2025.2 pyyaml==6.0.2 pyzmq==26.4.0 quartodoc==0.10.0 rdata==0.11.2 referencing==0.36.2 requests==2.32.3 requests-oauthlib==2.0.0 rich==14.0.0 rpds-py==0.25.1 rsa==4.9.1 ruff==0.5.4 s3fs==2025.5.1 six==1.17.0 sphobjinv==2.3.1.3 stack-data==0.6.3 tabulate==0.9.0 tblib==3.1.0 tomli==2.2.1 tornado==6.5.1 traitlets==5.14.3 types-appdirs==1.4.3.5 typing-extensions==4.14.0 typing-inspection==0.4.1 tzdata==2025.2 urllib3==2.4.0 virtualenv==20.31.2 watchdog==6.0.0 wcwidth==0.2.13 wheel==0.45.1 wrapt==1.17.2 xarray==2025.4.0 xxhash==3.5.0 yarl==1.20.0 zipp==3.22.0 ``` -------------------------------- ### Project Dependencies Source: https://github.com/rstudio/pins-python/blob/main/requirements/dev.txt Lists the Python packages and their versions required for the pins-python project. This includes direct dependencies and those inherited through other packages. ```python adlfs==2024.12.0 aiobotocore==2.22.0 aiohappyeyeballs==2.6.1 aiohttp==3.12.7 aioitertools==0.12.0 aiosignal==1.3.2 annotated-types==0.7.0 appdirs==1.4.4 appnope==0.1.4 asttokens==3.0.0 attrs==25.3.0 azure-core==1.34.0 azure-datalake-store==0.0.53 azure-identity==1.23.0 azure-storage-blob==12.25.1 backcall==0.2.0 beartype==0.21.0 black==25.1.0 botocore==1.37.3 build==1.2.2.post1 cachetools==5.5.2 certifi==2025.4.26 cffi==1.17.1 cfgv==3.4.0 charset-normalizer==3.4.2 click==8.2.1 colorama==0.4.6 comm==0.2.2 cramjam==2.10.0 cryptography==45.0.3 databackend==0.0.3 databricks-sdk==0.55.0 debugpy==1.8.14 decopatch==1.4.10 decorator==5.2.1 distlib==0.3.9 executing==2.2.0 fastjsonschema==2.21.1 fastparquet==2024.11.0 filelock==3.18.0 frozenlist==1.6.2 fsspec==2025.5.1 gcsfs==2025.5.1 google-api-core==2.25.0 google-auth==2.40.2 google-auth-oauthlib==1.2.2 google-cloud-core==2.4.3 google-cloud-storage==3.1.0 google-crc32c==1.7.1 google-resumable-media==2.7.2 googleapis-common-protos==1.70.0 griffe==1.7.3 humanize==4.12.3 identify==2.6.12 idna==3.10 importlib-metadata==8.7.0 importlib-resources==6.5.2 iniconfig==2.1.0 ipykernel==6.29.5 ipython==8.12.0 isodate==0.7.2 jedi==0.19.2 jinja2==3.1.6 joblib==1.5.1 jsonschema==4.24.0 jsonschema-specifications==2025.4.1 jupyter-client==8.6.3 jupyter-core==5.8.1 makefun==1.16.0 markdown-it-py==3.0.0 markupsafe==3.0.2 matplotlib-inline==0.1.7 mdurl==0.1.2 msal==1.32.3 msal-extensions==1.3.1 multidict==6.4.4 mypy-extensions==1.1.0 nbclient==0.10.2 nbformat==5.10.4 nest-asyncio==1.6.0 nodeenv==1.9.1 numpy==2.2.6 oauthlib==3.2.2 packaging==25.0 pandas==2.2.3 parso==0.8.4 ``` -------------------------------- ### Project Dependencies Source: https://github.com/rstudio/pins-python/blob/main/binder/requirements.txt This snippet lists the direct and transitive dependencies for the pins-python project, along with their specified versions. It also notes packages considered unsafe in a requirements file. ```python traitlets==5.1.1 typing-extensions==4.1.1 urllib3==1.26.9 wcwidth==0.2.5 webencodings==0.5.1 wheel==0.37.1 wrapt==1.14.0 xxhash==3.0.0 yarl==1.7.2 zipp==3.7.0 # The following packages are considered to be unsafe in a requirements file: pip setuptools ``` -------------------------------- ### Project Data Structure Source: https://github.com/rstudio/pins-python/blob/main/pins/tests/pins-old-types/a-table/v/data.txt This snippet describes the data files and their structure within the pins-python project. It includes file types, dimensions, and column details. ```python path: - data.csv - data.rds type: table rows: 2 cols: 2 columns: a: integer b: character ``` -------------------------------- ### Read Pin Data (R) Source: https://github.com/rstudio/pins-python/blob/main/pins/rsconnect/html/index.html Connects to a pin board using environment variables and reads a specified pin. Requires the 'pins' R package. ```r library(pins) board <- board_connect(auth = "envvar") pin_read(board, "{{pin_name}}") ``` -------------------------------- ### Read Pin in Python Source: https://github.com/rstudio/pins-python/blob/main/pins/tests/_snapshots/test_board_pin_write_rsc_index_html/index.html Connects to a pins board and reads the 'derek/test_rsc_pin' pin. It requires the 'pins' and 'dotenv' libraries. The connection uses a local server URL and loads environment variables for authentication. ```python from pins import board_connect from dotenv import load_dotenv load_dotenv() board = board_connect(server_url='http://localhost:3939') board.pin_read("derek/test_rsc_pin") ``` -------------------------------- ### Read Pin Data (Python) Source: https://github.com/rstudio/pins-python/blob/main/pins/rsconnect/html/index.html Connects to a pin board using environment variables and reads a specified pin. Requires the 'pins' and 'python-dotenv' libraries. ```python from pins import board_connect from dotenv import load_dotenv load_dotenv() board = {{board_deparse}} board.pin_read("{{pin_name}}") ``` -------------------------------- ### Read Pin in R Source: https://github.com/rstudio/pins-python/blob/main/pins/tests/_snapshots/test_board_pin_write_rsc_index_html/index.html Connects to a pins board using environment variable authentication and reads the 'derek/test_rsc_pin' pin. It requires the 'pins' library. ```r library(pins) board <- board_connect(auth = "envvar") pin_read(board, "derek/test_rsc_pin") ``` -------------------------------- ### Project Dependencies Source: https://github.com/rstudio/pins-python/blob/main/binder/requirements.txt This snippet lists the Python packages and their specific versions required for the rstudio/pins-python project. It is derived from the project's dependency management files. ```python aiobotocore==2.1.2 aiohttp==3.8.1 aioitertools==0.10.0 aiosignal==1.2.0 alabaster==0.7.12 appdirs==1.4.4 appnope==0.1.2 asttokens==2.0.5 async-timeout==4.0.2 attrs==21.4.0 babel==2.9.1 backcall==0.2.0 beautifulsoup4==4.10.0 bleach==4.1.0 botocore==1.23.24 certifi==2021.10.8 charset-normalizer==2.0.12 click==8.0.4 debugpy==1.6.0 decopatch==1.4.10 decorator==5.1.1 defusedxml==0.7.1 docutils==0.17.1 entrypoints==0.4 executing==0.8.3 frozenlist==1.3.0 fsspec==2022.02.0 idna==3.3 imagesize==1.3.0 importlib-metadata==4.11.3 importlib-resources==5.4.0 iniconfig==1.1.1 ipykernel==6.9.2 ipython==8.1.1 jedi==0.18.1 jinja2==3.1.0 jmespath==0.10.0 joblib==1.1.0 jsonschema==4.4.0 jupyter-client==7.1.2 jupyter-core==4.9.2 jupyterlab-pygments==0.1.2 jupytext==1.13.7 makefun==1.13.1 markdown-it-py==1.1.0 markupsafe==2.1.1 matplotlib-inline==0.1.3 mdit-py-plugins==0.3.0 mistune==0.8.4 multidict==6.0.2 nbclient==0.5.13 nbconvert==6.4.4 nbformat==5.2.0 nbsphinx==0.8.8 nest-asyncio==1.5.4 numpy==1.22.3 packaging==21.3 pandas==1.4.1 pandocfilters==1.5.0 parso==0.8.3 pep517==0.12.0 pexpect==4.8.0 pickleshare==0.7.5 pip-tools==6.5.1 pluggy==1.0.0 prompt-toolkit==3.0.28 psutil==5.9.0 ptyprocess==0.7.0 pure-eval==0.2.2 py==1.11.0 pydata-sphinx-theme==0.8.0 pygments==2.11.2 pyparsing==3.0.7 pyrsistent==0.18.1 pytest==7.1.1 pytest-cases==3.6.11 pytest-dotenv==0.5.2 python-dateutil==2.8.2 python-dotenv==0.20.0 pytz==2022.1 pyyaml==6.0 pyzmq==22.3.0 requests==2.27.1 s3fs==2022.2.0 siuba==0.1.2 six==1.16.0 snowballstemmer==2.2.0 soupsieve==2.3.1 sphinx==4.4.0 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 sqlalchemy==1.4.32 stack-data==0.2.0 testpath==0.6.0 toml==0.10.2 tomli==2.0.1 tornado==6.1 ``` -------------------------------- ### Retrieve Pinned Data from a Board Source: https://github.com/rstudio/pins-python/blob/main/README.md Loads a previously saved pin from the board using the `.pin_read()` method, identified by its name. ```python board.pin_read("mtcars") ``` -------------------------------- ### Pinned Data Information (y.rds) Source: https://github.com/rstudio/pins-python/blob/main/pins/tests/pin-board/y/20221215T180357Z-9ae7a/data.txt Details about the pinned 'y.rds' file in the pins-python project. This includes its hash, type, and a description of its content. ```Python file: y.rds file_size: 61 pin_hash: 9ae7a970010c84e0 type: rds title: 'y: a pinned integer vector' description: ~ tags: ~ created: 20221215T180357Z api_version: 1.0 ``` -------------------------------- ### RDS Data Frame Pin Source: https://github.com/rstudio/pins-python/blob/main/pins/tests/pins-compat/df_rds/20220214T163720Z-35b15/data.txt This snippet details the metadata associated with pinning an RDS data frame. It includes information about the file, its size, a hash for integrity checking, the type of data, a title, creation timestamp, and API version. ```python file: df_rds.rds file_size: 116 pin_hash: 35b1570263448755 type: rds title: 'df_rds: a pinned 2 x 2 data frame' description: ~ created: 20220214T163720Z api_version: 1.0 ``` -------------------------------- ### Pin Data to a Board Source: https://github.com/rstudio/pins-python/blob/main/README.md Saves a Python object (e.g., a pandas DataFrame) to a pin board using the `.pin_write()` method. The data can be saved in various formats like CSV, joblib, parquet, or JSON. ```python board.pin_write(mtcars.head(), "mtcars", type="csv") ``` -------------------------------- ### Arrow DataFrame Pin Source: https://github.com/rstudio/pins-python/blob/main/pins/tests/pins-compat/df_arrow/20220214T163720Z-ad0c1/data.txt Details of a pinned Arrow DataFrame, including its hash, type, and creation timestamp. ```text file: df_arrow.arrow file_size: 1282 pin_hash: ad0c1a5a64ad7ca7 type: arrow title: 'df_arrow: a pinned 2 x 2 data frame' description: ~ created: 20220214T163720Z api_version: 1.0 ``` -------------------------------- ### Unversioned Data Frame Pin Source: https://github.com/rstudio/pins-python/blob/main/pins/tests/pins-compat/df_unversioned/20220214T163720Z-35b15/data.txt Details of a pinned data frame that is not versioned. It is stored in RDS format and has specific metadata associated with it. ```python file: df_unversioned.rds file_size: 116 pin_hash: 35b1570263448755 type: rds title: 'df_unversioned: a pinned 2 x 2 data frame' description: ~ created: 20220214T163720Z api_version: 1.0 ``` -------------------------------- ### Pinned CSV Data Asset: df_csv Source: https://github.com/rstudio/pins-python/blob/main/pins/tests/pins-compat/df_csv/20220214T163718Z-eceac/data.txt Details of a pinned CSV data asset named 'df_csv'. This asset is a 2x2 data frame stored in CSV format. ```python file: df_csv.csv file_size: 20 pin_hash: eceac651f7d06360 type: csv title: 'df_csv: a pinned 2 x 2 data frame' description: ~ created: 20220214T163718Z api_version: 1.0 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.