|
| 1 | +# --- |
| 2 | +# jupyter: |
| 3 | +# jupytext: |
| 4 | +# formats: docs///md:myst,docs/py///py:percent |
| 5 | +# notebook_metadata_filter: -jupytext.text_representation.jupytext_version |
| 6 | +# text_representation: |
| 7 | +# extension: .py |
| 8 | +# format_name: percent |
| 9 | +# format_version: '1.3' |
| 10 | +# kernelspec: |
| 11 | +# display_name: itables |
| 12 | +# language: python |
| 13 | +# name: itables |
| 14 | +# --- |
| 15 | + |
| 16 | +# %% [markdown] |
| 17 | +# # Configuration |
| 18 | +# |
| 19 | +# ITables exposes many of the `datatables` [options](options/options.md). Since ITables v2.5, the default values for these options can be set in an `itables.toml` configuration file. |
| 20 | +# |
| 21 | +# ## Prerequisites |
| 22 | +# |
| 23 | +# You will need ITables v2.5 or higher, and two dependencies: either `tomllib` or `tomli`, and `platformdirs`, which can be installed with `pip install itables[config]`. |
| 24 | +# |
| 25 | +# ## Configuration file |
| 26 | +# |
| 27 | +# The configuration file is identified using `get_config_file` from [`itables.config`](https://github.com/mwouts/itables/blob/main/src/itables/config.py). It can be: |
| 28 | +# |
| 29 | +# - The file pointed to by the environment variable `ITABLES_CONFIG`, if set and non-empty (if the variable is an empty string, no configuration file is used) |
| 30 | +# - An `itables.toml` file in the current directory or a parent directory |
| 31 | +# - A `tool.itables` section in a `pyproject.toml` file in the current directory or a parent directory |
| 32 | +# |
| 33 | +# ## Example configuration |
| 34 | +# |
| 35 | +# A simple `itables.toml` configuration file that makes the tables a bit more [compact](options/classes.md) looks like this: |
| 36 | +# ``` |
| 37 | +# classes = ["display", "nowrap", "compact"] |
| 38 | +# ``` |
| 39 | +# |
| 40 | +# If you want the Excel export button on each table, add this: |
| 41 | +# ``` |
| 42 | +# buttons = ["pageLength", "copyHtml5", "csvHtml5", "excelHtml5"] |
| 43 | +# ``` |
| 44 | +# |
| 45 | +# And if you want to use the [column control](options/column_control.md) extension: |
| 46 | +# ``` |
| 47 | +# [[columnControl]] |
| 48 | +# target = 0 |
| 49 | +# content = ["order"] |
| 50 | +# [[columnControl]] |
| 51 | +# target = "tfoot" |
| 52 | +# content = ["search"] |
| 53 | +# |
| 54 | +# [ordering] |
| 55 | +# indicators = false |
| 56 | +# handler = false |
| 57 | +# ``` |
| 58 | +# |
| 59 | +# ## Modifying the configuration |
| 60 | +# |
| 61 | +# The configuration file is loaded when `itables` is imported. If you make changes to the configuration file, these will take effect only when you restart Python and re-import ITables. |
| 62 | +# |
| 63 | +# You can confirm which configuration file is being used (in a given directory) by running: |
| 64 | +# ``` |
| 65 | +# python -m itables.show_config |
| 66 | +# ``` |
0 commit comments