adding a table of supported formats to the docs #159
Replies: 2 comments
-
Great idea! Maybe we can auto-generate it? Better yet, let's create a function for getting all the formats and the methods they support and putting them in a table. Then in the docs we just render the current table and we won't have to manually update it! Plus users will be able to see what formats their installation of dascore and associated plugins support. This should probably live in import pandas as pd
from dascore.io.core import FiberIO
# loads all the plugin so we know about all the FiberIO classes
FiberIO.manager.load_plugins()
out = {}
# iterate the dict _format_version_items which has the form {format_name: {version_str: FiberIO}}
for format_name, version_dict in FiberIO.manager._format_version.items():
for version_name, fiberio in version_dict.items():
print(version_name, fiberio)
out[name] = format_name
out[version] = version_name
out['scan'] = fiberio.implements_scan
out['get_format'] = fiberio.implements_get_format
# you will need to implement the `implements_read` and `implements_write` properties of `FiberIO`
# see FiberIO.implements_get_format for an example.
out['read'] = fiberio.implements_read
out['write'] = fiberio.implements_write
df = pd.DataFrame(out) Then, wherever you want to add the table you can use a hidden quarto python cell in the appropriate documentation page to import the function and create the table (DataFrame.to_markdown may be useful). This way the code wont show but its output will. I don't remember off the top of my head how to do it, but look at the execution options to start with. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your thoughts! I just implemented this and created a pull request. |
Beta Was this translation helpful? Give feedback.
-
@d-chambers
I want to add a table of supported formats to the documentation. Could you please give me a description of what should be included in the table?
Currently, we cover the DASDAE__V1, PICKLE, PRODML__V2_0, PRODML__V2_1, TDMS__V4713, TERRA15__V4, TERRA15__V5, TERRA15__V6, QUANTX__V2, and WAV. Any other formats?
Beta Was this translation helpful? Give feedback.
All reactions