### Install codaio Python Library Source: https://github.com/licht1stein/codaio/blob/master/README.md This snippet demonstrates how to install the `codaio` Python library using either `poetry` (recommended) or `pip`. These commands add the library to your project's dependencies or global Python environment, respectively. ```shell script poetry add codaio ``` ```shell script pip install codaio ``` -------------------------------- ### Bump `codaio` Project Version (Minor) Source: https://github.com/licht1stein/codaio/blob/master/README.md This command increments the minor version number of the `codaio` project, for example, from 0.4.11 to 0.5.0. This is typically used for backward-compatible new features and significant updates before deploying to PyPI. ```Bash poetry version minor ``` -------------------------------- ### Bump `codaio` Project Version (Major) Source: https://github.com/licht1stein/codaio/blob/master/README.md This command increments the major version number of the `codaio` project, for example, from 0.4.11 to 1.0.0. This is typically used for incompatible API changes and major releases before deploying to PyPI. ```Bash poetry version major ``` -------------------------------- ### Bump `codaio` Project Version (Patch) Source: https://github.com/licht1stein/codaio/blob/master/README.md This command increments the patch version number of the `codaio` project, for example, from 0.4.11 to 0.4.12. This is typically used for backward-compatible bug fixes and minor updates before deploying to PyPI. ```Bash poetry version patch ``` -------------------------------- ### Iterate and Manipulate Coda Table Rows Source: https://github.com/licht1stein/codaio/blob/master/README.md This Python snippet shows how to iterate over rows in a `codaio` `Table` object. It provides examples of deleting rows based on a condition using row IDs and editing cell values based on a condition using row names. ```Python # Iterate over rows using IDs -> delete rows that match a condition for row in table.rows(): if row['COLUMN_ID'] == 'foo': row.delete() # Iterate over rows using names -> edit cells in rows that match a condition for row in table.rows(): if row['Name'] == 'bar': row['Value'] = 'spam' ``` -------------------------------- ### Initialize Coda API Client and Create Document Source: https://github.com/licht1stein/codaio/blob/master/README.md This Python snippet demonstrates how to initialize the `Coda` API client with your API key and then use it to create a new Coda document. It shows the expected dictionary response upon successful document creation, including the new document's ID and links. ```Python from codaio import Coda coda = Coda('YOUR_API_KEY') >>> coda.create_doc('My Document') {'id': 'NEW_DOC_ID', 'type': 'doc', 'href': 'https://coda.io/apis/v1/docs/NEW_DOC_ID', 'browserLink': 'https://coda.io/d/_dNEW_DOC_ID', 'name': 'My Document', 'owner': 'your@email', 'ownerName': 'Your Name', 'createdAt': '2020-09-28T19:32:20.866Z', 'updatedAt': '2020-09-28T19:32:20.924Z'} ``` -------------------------------- ### Run `codaio` Test Suite with Nox Source: https://github.com/licht1stein/codaio/blob/master/README.md This command executes the `nox` test session, which runs the test suite against Python 3.8 and 3.7, and performs linting with `flake8`. It's the recommended way to run tests for the `codaio` project. ```Shell Script nox ``` -------------------------------- ### Initialize Coda Document Object Source: https://github.com/licht1stein/codaio/blob/master/README.md This Python snippet illustrates two ways to initialize a `Document` object using the `codaio` library. You can either pass an initialized `Coda` object directly or initialize from environment variables by setting `CODA_API_KEY`. ```Python from codaio import Coda, Document # Initialize by providing a coda object directly coda = Coda('YOUR_API_KEY') doc = Document('YOUR_DOC_ID', coda=coda) # Or initialiaze from environment by storing your API key in environment variable `CODA_API_KEY` doc = Document.from_environment('YOUR_DOC_ID') doc.list_tables() table = doc.get_table('TABLE_ID') ``` -------------------------------- ### API Reference: codaio.Coda Class Source: https://github.com/licht1stein/codaio/blob/master/source/index.rst Documentation for the `codaio.Coda` class, which serves as the main entry point for interacting with the coda.io API. It provides methods to access and manage documents, tables, and other resources. ```APIDOC class codaio.Coda: # Members documented separately or via introspection __init__(api_key: str) api_key: Your Coda API key. ``` -------------------------------- ### Run `codaio` Tests Directly with Pytest Source: https://github.com/licht1stein/codaio/blob/master/README.md This command uses `poetry` to execute `pytest` directly, including code coverage analysis. It serves as an alternative method for running tests if `nox` is not preferred or for specific debugging purposes. ```Shell Script poetry run pytest --cov ``` -------------------------------- ### API Reference: codaio.Document Class Source: https://github.com/licht1stein/codaio/blob/master/source/index.rst Documentation for the `codaio.Document` class, representing a Coda document. This class allows interaction with document-level properties and content, including tables and pages within the document. ```APIDOC class codaio.Document: # Members documented separately or via introspection get_tables() Returns a list of Table objects within the document. get_table(table_id_or_name: str) Returns a specific Table object by ID or name. ``` -------------------------------- ### API Reference: codaio.Table Class Source: https://github.com/licht1stein/codaio/blob/master/source/index.rst Documentation for the `codaio.Table` class, representing a table within a Coda document. This class provides methods to access rows, columns, and manipulate table data. ```APIDOC class codaio.Table: # Members documented separately or via introspection get_rows() Returns a list of Row objects in the table. get_columns() Returns a list of Column objects in the table. add_row(cells: dict) Adds a new row to the table with specified cell values. ``` -------------------------------- ### API Reference: codaio.Column Class Source: https://github.com/licht1stein/codaio/blob/master/source/index.rst Documentation for the `codaio.Column` class, representing a column within a Coda table. This class allows access to column properties and metadata. ```APIDOC class codaio.Column: # Members documented separately or via introspection id: str name: str type: str ``` -------------------------------- ### Fetch a Row from Coda Table Source: https://github.com/licht1stein/codaio/blob/master/README.md This Python snippet demonstrates how to retrieve a specific row from a `codaio` `Table` object using its ID. It shows the direct dictionary-like access pattern for row retrieval. ```Python # You can fetch a row by ID row = table['ROW_ID'] ``` -------------------------------- ### API Reference: codaio.Row Class Source: https://github.com/licht1stein/codaio/blob/master/source/index.rst Documentation for the `codaio.Row` class, representing a row within a Coda table. This class provides methods to access cell values and row-level properties. ```APIDOC class codaio.Row: # Members documented separately or via introspection id: str values: dict get_cell(column_id_or_name: str) Returns a Cell object for a specific column in the row. ``` -------------------------------- ### Convert Coda Table/Row to Pandas DataFrame Source: https://github.com/licht1stein/codaio/blob/master/README.md This Python snippet shows how to integrate `codaio` objects with the Pandas library. It demonstrates converting a `Table` or `Row` object into a Pandas DataFrame using the `to_dict()` method, facilitating data analysis and manipulation. ```Python import pandas as pd df = pd.DataFrame(table.to_dict()) ``` -------------------------------- ### API Reference: codaio.Cell Class Source: https://github.com/licht1stein/codaio/blob/master/source/index.rst Documentation for the `codaio.Cell` class, representing a single cell within a Coda table row. This class allows access to the cell's value and type. ```APIDOC class codaio.Cell: # Members documented separately or via introspection value: any type: str ``` -------------------------------- ### Upsert a Single New Row to Coda Table Source: https://github.com/licht1stein/codaio/blob/master/README.md This Python snippet demonstrates how to upsert (update or insert) a single new row into a `codaio` `Table`. It involves creating `Cell` objects with column IDs and values, then passing a list of these cells to the `table.upsert_row()` method. ```Python name_cell = Cell(column='COLUMN_ID', value_storage='new_name') value_cell = Cell(column='COLUMN_ID', value_storage='new_value') table.upsert_row([name_cell, value_cell]) ``` -------------------------------- ### Fetch a Cell from Coda Table or Row Source: https://github.com/licht1stein/codaio/blob/master/README.md This Python snippet illustrates multiple ways to fetch a specific cell value from a `codaio` `Table` or `Row` object. Cells can be accessed by `ROW_ID` and `COLUMN_ID`, or by `COLUMN_ID`/`COLUMN_NAME` directly from a `Row` object, or using a `Column` instance. ```Python # Or fetch a cell by ROW_ID and COLUMN_ID cell = table['ROW_ID']['COLUMN_ID'] # This is equivalent to getting item from a row cell = row['COLUMN_ID'] # or cell = row['COLUMN_NAME'] # This should work fine if COLUMN_NAME is unique, otherwise it will raise AmbiguousColumn error # or use a Column instance cell = row[column] ``` -------------------------------- ### Update an Existing Row in Coda Table Source: https://github.com/licht1stein/codaio/blob/master/README.md This Python snippet demonstrates how to update an existing row in a `codaio` `Table`. It involves first fetching the row by its ID, then creating `Cell` objects with the new values, and finally calling `table.update_row()` with the row object and the list of cells. ```Python row = table['ROW_ID'] name_cell_a = Cell(column='COLUMN_ID', value_storage='new_name') value_cell_a = Cell(column='COLUMN_ID', value_storage='new_value') table.update_row(row, [name_cell_a, value_cell_a]) ``` -------------------------------- ### Upsert Multiple New Rows to Coda Table Source: https://github.com/licht1stein/codaio/blob/master/README.md This Python snippet shows how to upsert multiple new rows into a `codaio` `Table` simultaneously. It requires preparing a list of lists, where each inner list contains `Cell` objects representing a row, and then passing this structure to `table.upsert_rows()`. ```Python name_cell_a = Cell(column='COLUMN_ID', value_storage='new_name') value_cell_a = Cell(column='COLUMN_ID', value_storage='new_value') name_cell_b = Cell(column='COLUMN_ID', value_storage='new_name') value_cell_b = Cell(column='COLUMN_ID', value_storage='new_value') table.upsert_rows([[name_cell_a, value_cell_a], [name_cell_b, value_cell_b]]) ``` -------------------------------- ### Change Cell Value in Coda Row Source: https://github.com/licht1stein/codaio/blob/master/README.md This Python snippet demonstrates how to modify the value of a cell within a `codaio` `Row` object. Values can be updated by referencing the column using either its ID or its name. ```Python row['COLUMN_ID'] = 'foo' # or row['Column Name'] = 'foo' ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.