Skip to main content

Sphinx CSV filter

CI outcome Test suite code coverage Supported Python versions Package version on PyPI PyPI downloads per month Project status (alpha, beta, stable) License

A CSV filter directive for docutils and Sphinx, that extends the “csv-table” reStructuredText directive to add row filtering options.

Details

The package depends on docutils, it provides a CSVFilterDirective, extending CSVTable. When used as a Sphinx extension, it will register the csv-filter Sphinx directive.

Installation

The Sphinx CSV filter plugin is available as a pip package.

To install, run:

$ pip install sphinx-csv-filter

To update, run:

$ pip install -U sphinx-csv-filter

Set Up

To include the extension, add this line to config.py in your Sphinx project:

extensions = ['crate.sphinx.csv']

If you’re using other extensions, edit the existing list, or add this:

extensions.append('crate.sphinx.csv')

Use

This plugin adds the following options to the csv-table directive:

:included_cols:

This is a comma-separated list of column indexes to include in the output.

:include:

This option takes a Python dict specifying the column index (starting at zero) and a regular expression. Rows are included if the columnar value matches the supplied regular expression.

:exclude:

This option takes a Python dict specifying the column index (starting at zero) and a regular expression. Rows are excluded if the columnar value matches the supplied regular expression.

If a row matches an :include: as well as an :exclude: filter, the row with be excluded.

Here’s an example:

.. csv-filter:: Example Table
   :header: Company,Contact,Country,Attend?
   :file: example.csv
   :exclude: {3: '(?i)Y\w*'}

In this example, rows from example.csv will be omitted from the output if the regular expression (?i)Y\w* matches value of the Attend? column.

Contributing

This project is primarily maintained by Crate.IO, but we welcome community contributions!

See the developer docs and the contribution docs for more information.

Help

Looking for more help?

Metadata

Release files for sphinx-csv-filter 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sphinx-csv-filter 0.4.3
File Size Uploaded
sphinx_csv_filter-0.4.3.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sphinx-csv-filter 0.4.3
File Interpreter ABI Platform
sphinx_csv_filter-0.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 18.1 kB

Release files / sphinx_csv_filter-0.4.3.tar.gz

Download URL sphinx_csv_filter-0.4.3.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
28e80a8768b3d47c94376ec0643191aa96ac646baf210fcf1c90be21f21c1f43
BLAKE2b-256 checksum
How to use checksums
03c43e1836740600e3f777443abba8cf0e63df110f1e5f2566678ccf899a8984
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / sphinx_csv_filter-0.4.3-py3-none-any.whl

Download URL sphinx_csv_filter-0.4.3-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d871da4ac6c20eb7d87e812071b13d6a6c6b307a7db36e9cfc004da1f11a173
BLAKE2b-256 checksum
How to use checksums
dc92d5c6c626af99552023bf57519cbcc388418924d52bab26218ea5664f8a85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

0.4.3 This release

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page