wireservice / csvkit

A suite of utilities for converting to and working with CSV, the king of tabular file formats.
https://csvkit.readthedocs.io
MIT License
6.03k stars 603 forks source link

Feature Request: Add the Python API to the docs #1269

Closed DeflateAwning closed 6 days ago

DeflateAwning commented 6 days ago

The docs (for example, https://csvkit.readthedocs.io/en/latest/scripts/csvclean.html) only show info about using the CLI tools. I'm hoping to use this project within a Python project.

Is there a way this can be included, and the CLI methods can be called with Python? If so, it would be awesome if this API's documentation was available in the readthedocs pages.

jpmckinney commented 6 days ago

See https://agate.readthedocs.io/en/latest/

DeflateAwning commented 5 days ago

Hmm that's strange; when I search "csvclean" on there, I don't see any indication that it's linked to this project at all. Maybe more docs explaining the interconnect would be good?

After searching around those docs quite a bit, I still don't see a way to use the "csvclean" functionality of this CLI tool. I stand by my point.

jpmckinney commented 5 days ago

True, csvclean is one of the utilities that does not have any corresponding features in agate.

CSV Kit is not designed to be used as a Python library. Back around version 1.0, there was a major effort to move functionality to agate, which is designed as a Python library. However, not all functionality was moved over.

The remaining functionality in CSV Kit could be organized into a stable API. If we publish the API as part of the docs, then that is a public declaration of a stable API, and we will have to accept the overhead of managing API changes, properly documenting the API, etc. However, there is not a lot of demand (or maintainer availability) to do that. So, I would prefer to leave things as is. For csvclean, you can just read the code which is 100 lines here and then another 150 lines here, and you can call it from your code.