chmp / ipytest

Pytest in IPython notebooks.
MIT License
314 stars 17 forks source link

DOC: README.md: Inline i/o from Example.ipynb #89

Closed westurner closed 1 year ago

westurner commented 1 year ago

Could the usage examples from Example.ipynb be inlined into the README.md?

westurner commented 1 year ago

@fperez @carreau @choldgraf @mwouts If README.md were MyST-Markdown (e.g. as processed by executablebooks/jupyter-book), it still wouldn't have the cell outputs in the Markdown for the README, AFAIU?

chmp commented 1 year ago

I guess in general the Readme could use a bit of a touch up and reorganization. As the Readme is quite long as-is, I am not really in favor of adding more content, though.

Re how to achieve this: I guess writing a custom converter would be easiest (the notebook format is quite easy to parse).

westurner commented 1 year ago

Just that "Extended Usage" is more apidoc (see also sphinx-apidoc & jupyter-book, nbdev) than usage examples.

Maybe just bold the "example notebook" link?

mwouts commented 1 year ago

Hey @westurner , yes you're right in the end we never developed the text notebook format with outputs - sorry about that.

I like seeing this project about making test available in the notebook! BTW Jupyter and Pytest are probably my two favorite tools. In Pytest I write a lot of fixtures (sample data sets), do you plan to make them accessible from Jupyter ? I've always wondered what is the best way to get these data sets in Jupyter for interactive exploration when I work on a new test...

fperez commented 1 year ago

See my note here re. recent discussion about md+outputs, I hope it's useful.

chmp commented 1 year ago

Just that "Extended Usage" is more apidoc (see also sphinx-apidoc & jupyter-book, nbdev) than usage examples.

Maybe just bold the "example notebook" link?

@westurner That's a fair point. I will experiment a bit with rewriting the readme. Getting a bold link to the example notebook, should be doable whatever I come up with :)

I like seeing this project about making test available in the notebook! BTW Jupyter and Pytest are probably my two favorite tools. In Pytest I write a lot of fixtures (sample data sets), do you plan to make them accessible from Jupyter ? I've always wondered what is the best way to get these data sets in Jupyter for interactive exploration when I work on a new test...

@mwouts what are you exact requirements? Fixtures should already work. So far I did not run into any problems, but I guess it depends a bit your usage pattern. Example:

```python import ipytest ipytest.autoconfig() ``` --- ```python %pycat conftest.py ``` ```python import pytest @pytest.fixture def my_fixture(): return 21 ``` --- ```python %%ipytest def test_example(my_fixture): assert my_fixture * 2 == 42 ``` ```text . [100%] 1 passed in 0.00s ```
chmp commented 1 year ago

Work on readme started in #92.

chmp commented 1 year ago

Updated docs: simplified readme with a more prominent link to the example notebook.