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

Use the doctest module in get_example_data #308

Merged
merged 40 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
7b6ec43
First pass at using the doctest module in get_example_data
asmeurer Oct 20, 2023
8e11f52
Fix matplotlib showing the plots instead of saving them in doctests
asmeurer Oct 20, 2023
3dd390b
Move the PapyriDocTestRunner class to the module level
asmeurer Nov 10, 2023
0bbbabe
Handle filename and lineno not being accessible
asmeurer Nov 11, 2023
d65f57c
Fix a spelling error
asmeurer Nov 11, 2023
471d729
Fix generation of doctest plot figures
asmeurer Nov 11, 2023
bbcb40e
Remove unused variable
asmeurer Nov 11, 2023
29c66ac
Use ELLIPSIS option flag
asmeurer Nov 11, 2023
a13f7e4
First pass at using the doctest module in get_example_data
asmeurer Oct 20, 2023
9cdb1ae
Fix matplotlib showing the plots instead of saving them in doctests
asmeurer Oct 20, 2023
0fba48d
Move the PapyriDocTestRunner class to the module level
asmeurer Nov 10, 2023
24389a4
Handle filename and lineno not being accessible
asmeurer Nov 11, 2023
d946cc6
Fix a spelling error
asmeurer Nov 11, 2023
877026f
Fix generation of doctest plot figures
asmeurer Nov 11, 2023
cbd7fc0
Remove unused variable
asmeurer Nov 11, 2023
83be405
Use ELLIPSIS option flag
asmeurer Nov 11, 2023
1a0caee
add debug print
Carreau Nov 17, 2023
98304d2
debug log
Carreau Nov 17, 2023
236c309
cleanup
Carreau Nov 20, 2023
841ac12
... to >>>
Carreau Nov 20, 2023
ef6780e
debug and execute config
Carreau Nov 27, 2023
507e37c
don't execute in pandas
Carreau Nov 27, 2023
cfbacb7
Add Section.extend
asmeurer Dec 1, 2023
3e2409d
Split example sections into blocks
asmeurer Dec 1, 2023
8f6c1da
Merge branch 'doctest' of github.com:asmeurer/papyri into doctest
asmeurer Dec 1, 2023
a2da2d8
Fix errors from running doctests on SciPy
asmeurer Dec 1, 2023
6da0c62
Merge branch 'main' into doctest
asmeurer Dec 15, 2023
9bf10fb
Fix the --no-exec flag
asmeurer Dec 15, 2023
a1c8cdb
Excluse `set_numeric_ops` which seem to be the root of crash.
Carreau Dec 16, 2023
db1dbb4
reforamt to please linters
Carreau Dec 16, 2023
7ce945e
Merge branch 'main' into doctest
asmeurer Jan 4, 2024
4d114ff
Fix the doctest runner not maintaining the namespace across different…
asmeurer Jan 4, 2024
4100b5e
Use DocTestParser to parse doctest blocks
asmeurer Jan 4, 2024
dea1888
Don't generate text blocks for empty strings
asmeurer Jan 4, 2024
708dac9
Fix duplicate code entries in example section
asmeurer Jan 4, 2024
96502c7
Fix extending figures.
Carreau Jan 10, 2024
eb498cb
Apply suggestions from code review
Carreau Jan 10, 2024
4621cba
Rename config.exec to execute_doctests.
Carreau Jan 10, 2024
45a2fa3
Rename config.exec to execute_doctests.
Carreau Jan 10, 2024
81071b9
rename exec in a few more places
Carreau Jan 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/dask.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ exclude = [ "dask.utils:Dispatch",

#docs_path = "~/dev/dask/docs/source"
exec_failure = 'fallback'
execute_doctests = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You introduced this but are not using it, I'm guessing you intended something to exec. I pushed a commit that rename all the usage of config.exec to config.execute_doctests for it to work as intended. You naming is better.

1 change: 1 addition & 0 deletions examples/distributed.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ exclude = [
"distributed.shuffle._comms:CommShardsBuffer",
] #docs_path = "~/dev/dask/docs/source"
exec_failure = 'fallback'
execute_doctests = false

[global.expected_errors]
NumpydocParseError = [
Expand Down
1 change: 1 addition & 0 deletions examples/numpy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ exclude = [
]

execute_exclude_patterns = [
'numpy:set_numeric_ops',
'numpy._',
'numpy.testing._priv',
'numpy.errstate',
Expand Down
1 change: 1 addition & 0 deletions examples/pandas.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ exec_failure = "fallback"
submodules = []
exclude = [""
]
execute_doctests = false
[pandas.expected_errors]
IncorrectInternalDocsLen = [
"pandas.core.indexes.period:PeriodIndex.asof_locs",
Expand Down
22 changes: 11 additions & 11 deletions papyri/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,13 @@ async def example1(
Examples
--------
>>> import matplotlib.pyplot as plt
... fig, ax = plt.subplots()
... ax.plot(range(10))
>>> fig, ax = plt.subplots()
>>> ax.plot(range(10))

And now

>>> ax.plot(range(5, 15))
... plt.show()
>>> plt.show()

"""
return "ok"
Expand All @@ -243,24 +243,24 @@ def example2():
Examples
--------
>>> import numpy as np
... import matplotlib.pyplot as plt
... from scipy.interpolate import UnivariateSpline
>>> import matplotlib.pyplot as plt
>>> from scipy.interpolate import UnivariateSpline

>>> x = np.linspace(-3, 3, 50)
... y = np.exp(-(x ** 2)) + 0.1 * np.random.randn(50)
... plt.plot(x, y, "ro", ms=5)
>>> y = np.exp(-(x ** 2)) + 0.1 * np.random.randn(50)
>>> plt.plot(x, y, "ro", ms=5)

Use the default value for the smoothing parameter:

>>> spl = UnivariateSpline(x, y)
... xs = np.linspace(-3, 3, 1000)
... plt.plot(xs, spl(xs), "g", lw=3)
>>> xs = np.linspace(-3, 3, 1000)
>>> plt.plot(xs, spl(xs), "g", lw=3)

Manually change the amount of smoothing:

>>> spl.set_smoothing_factor(0.5)
... plt.plot(xs, spl(xs), "b", lw=3)
... plt.show()
>>> plt.plot(xs, spl(xs), "b", lw=3)
>>> plt.show()

"""
pass
Expand Down
Loading
Loading