Skip to main content

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

Project description

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-tablereStructuredText 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?

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx_csv_filter-0.4.2.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

sphinx_csv_filter-0.4.2-py2.py3-none-any.whl (9.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file sphinx_csv_filter-0.4.2.tar.gz.

File metadata

  • Download URL: sphinx_csv_filter-0.4.2.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for sphinx_csv_filter-0.4.2.tar.gz
Algorithm Hash digest
SHA256 e6d1614ca30d85403a5ce668f6348a9aeecab8bf7238a3d13723d3c56e9daa34
MD5 614c8058b1c1ff158cf3cfe2bc88d764
BLAKE2b-256 b8f04b48fae9db2232746b4cb94c5f1aa32200e64141645c762c0487388bbd38

See more details on using hashes here.

File details

Details for the file sphinx_csv_filter-0.4.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_csv_filter-0.4.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 23b804dec644a5ade4b64fb142b2116837b5166bbd5f264dd9d49910b07b3bcd
MD5 771cecd6d0463b8373d3c58b0babab3e
BLAKE2b-256 21943813d9b82dd4b9c73349529aec1554f7d29e7f33a29c0a866cf2ca6a0890

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page