> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chaintable.com/llms.txt
> Use this file to discover all available pages before exploring further.

# chaintable-py

> Python reference for run arguments, account variables, constants, and utilities.

`chaintable-py` provides configuration and utilities for driver scripts. See the [source](https://github.com/Chaintable/chaintable-py) for the full implementation.

## Run arguments

```python theme={null}
from chaintable import arguments

args = arguments.get_arguments()
raw_amount = int(args.get('raw_amount', '1500000'))
print(raw_amount / 10 ** 6)
```

### `arguments.get_arguments()`

Takes no arguments. Reads command-line arguments in `--name=value` format and returns a dictionary in input order, with string keys and values. Returns an empty dictionary if no arguments match.

Notebooks pass parameters configured in the UI to the script. Convert numeric, boolean, or JSON values explicitly. See [Manage runs](/guides/notebooks/manage-runs).

## Account runtime variables

```python theme={null}
from chaintable import variables

network = variables.get('DOCS_NETWORK', 'eth')
```

### `variables.get(name, default=None)`

| Parameter | Type            | Description                                              |
| --------- | --------------- | -------------------------------------------------------- |
| `name`    | `str`           | Account variable name                                    |
| `default` | `str` or `None` | Value returned if the name is absent; defaults to `None` |

Returns a string value or the fallback for a missing name. Reads variables for the current account through the execution environment, querying on every call. A Chaintable runtime proxy is required; installing the package locally does not enable account-variable access.

A missing variable does not raise an exception. Service or proxy failures may raise `variables.VariableError`; missing proxy configuration produces an environment error. See [Read runtime variables](/guides/notebooks/advanced#read-runtime-variables) to create a variable.

## Utilities

```python theme={null}
from chaintable import utils

print(utils.is_address('0xd8da6bf26964af9d7eed9e03e53415d37aa96045'))
print(list(utils.chunked([1, 2, 3], 2)))
```

The output is `True` and `[(1, 2), (3,)]`.

| Interface                            | Parameters                                                             | Return value                                             |
| ------------------------------------ | ---------------------------------------------------------------------- | -------------------------------------------------------- |
| `utils.hash_md5(*strings)`           | Strings or `None`, concatenated in order; `None` counts as empty       | 32-character hexadecimal MD5 string                      |
| `utils.chunked(iterable, size)`      | Iterable and group size, at least 1                                    | Iterator yielding tuples; the final group may be shorter |
| `utils.is_hexstr(s, bytes_len=None)` | Hexadecimal string starting with `0x`, optionally an exact byte length | `bool`                                                   |
| `utils.is_digitstr(s)`               | Checks whether the value converts to a Python integer                  | `bool`                                                   |
| `utils.is_address(value)`            | Checks for lowercase `0x` plus 40 hexadecimal characters               | `bool`                                                   |

`is_address()` checks format without querying an on-chain account. Mixed-case checksum addresses do not meet this utility's lowercase requirement.

`hash_md5()` does not insert separators between inputs. For example, `('ab', 'c')` and `('a', 'bc')` produce the same concatenated input.

## Constants

`chaintable.consts.chain` and `chaintable.consts.address` provide chain and address constants. See the [consts source](https://github.com/Chaintable/chaintable-py/tree/main/chaintable/consts) for the full list.
