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.3.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinx_csv_filter-0.4.3-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sphinx_csv_filter-0.4.3.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for sphinx_csv_filter-0.4.3.tar.gz
Algorithm Hash digest
SHA256 28e80a8768b3d47c94376ec0643191aa96ac646baf210fcf1c90be21f21c1f43
MD5 525b047c05d1cc0f539999b5cfb1e8cf
BLAKE2b-256 03c43e1836740600e3f777443abba8cf0e63df110f1e5f2566678ccf899a8984

See more details on using hashes here.

File details

Details for the file sphinx_csv_filter-0.4.3-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_csv_filter-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7d871da4ac6c20eb7d87e812071b13d6a6c6b307a7db36e9cfc004da1f11a173
MD5 4b60d952b3e89d5bf1ab256cd6f5ac58
BLAKE2b-256 dc92d5c6c626af99552023bf57519cbcc388418924d52bab26218ea5664f8a85

See more details on using hashes here.

Supported by

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