Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cover examples in the readme by doctest #14

Open
tdrose opened this issue Dec 1, 2023 · 1 comment
Open

Cover examples in the readme by doctest #14

tdrose opened this issue Dec 1, 2023 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@tdrose
Copy link
Member

tdrose commented Dec 1, 2023

Idea from @aeisenbarth (Copied from PR review):

If we like, we could also cover examples in the readme by doctest to ensure consistency and that they work. In that case, we would call doctest explicitly on the file (since it is not managed by sphinx make targets):
.github/workflows/tests.yml:

        - name: Doc Test on readme
          run: python -m doctest -v README.md

and the example:

>>> from metaspace_converter import metaspace_to_anndata, anndata_to_image_array
>>> 
>>> # Download data
>>> adata2 = metaspace_to_anndata(dataset_id="2023-11-14_21h58m39s", fdr=0.1)
>>> 
>>> ion_images = anndata_to_image_array(adata2)
>>> 
>>> print("{} ion images of shape {}x{}".format(*ion_images.shape))
20 ion images of shape 130x143

(with empty line before closing ticks)

The disadvantage is that the IDE displays syntax error for language code python (but pycon for Python console works) and users would not be able to copy-paste the code without >>>.

@tdrose tdrose added the documentation Improvements or additions to documentation label Dec 1, 2023
@tdrose
Copy link
Member Author

tdrose commented Dec 1, 2023

In principle a nice idea, but I see the disadvantage that you cannot copy the code block easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants