Skip to content

Commit a890caf

Browse files
datapythonistajorisvandenbossche
authored andcommitted
DOC/CI: Failing documentation build on warnings (#26852)
1 parent adc6564 commit a890caf

File tree

6 files changed

+56
-20
lines changed

6 files changed

+56
-20
lines changed

azure-pipelines.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ jobs:
55
parameters:
66
name: macOS
77
vmImage: xcode9-macos10.13
8+
89
- template: ci/azure/posix.yml
910
parameters:
1011
name: Linux
@@ -134,7 +135,10 @@ jobs:
134135
- script: |
135136
export PATH=$HOME/miniconda3/bin:$PATH
136137
source activate pandas-dev
137-
doc/make.py
138+
# Next we should simply have `doc/make.py --warnings-are-errors`, everything else is required because the ipython directive doesn't fail the build on errors (https://github.com/ipython/ipython/issues/11547)
139+
doc/make.py --warnings-are-errors | tee sphinx.log ; SPHINX_RET=${PIPESTATUS[0]}
140+
grep -B1 "^<<<-------------------------------------------------------------------------$" sphinx.log ; IPY_RET=$(( $? != 1 ))
141+
exit $(( $SPHINX_RET + $IPY_RET ))
138142
displayName: 'Build documentation'
139143
140144
- script: |

doc/source/getting_started/10min.rst

+1
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,7 @@ See the :ref:`Plotting <visualization>` docs.
712712
plt.close('all')
713713
714714
.. ipython:: python
715+
:okwarning:
715716
716717
ts = pd.Series(np.random.randn(1000),
717718
index=pd.date_range('1/1/2000', periods=1000))

doc/source/user_guide/io.rst

+22-11
Original file line numberDiff line numberDiff line change
@@ -3249,24 +3249,35 @@ And then import the data directly to a ``DataFrame`` by calling:
32493249

32503250
.. code-block:: python
32513251
3252-
clipdf = pd.read_clipboard()
3253-
3254-
.. ipython:: python
3255-
3256-
clipdf
3257-
3252+
>>> clipdf = pd.read_clipboard()
3253+
>>> clipdf
3254+
A B C
3255+
x 1 4 p
3256+
y 2 5 q
3257+
z 3 6 r
32583258
32593259
The ``to_clipboard`` method can be used to write the contents of a ``DataFrame`` to
32603260
the clipboard. Following which you can paste the clipboard contents into other
32613261
applications (CTRL-V on many operating systems). Here we illustrate writing a
32623262
``DataFrame`` into clipboard and reading it back.
32633263

3264-
.. ipython:: python
3264+
.. code-block:: python
32653265
3266-
df = pd.DataFrame(np.random.randn(5, 3))
3267-
df
3268-
df.to_clipboard()
3269-
pd.read_clipboard()
3266+
>>> df = pd.DataFrame({'A': [1, 2, 3],
3267+
... 'B': [4, 5, 6],
3268+
... 'C': ['p', 'q', 'r']},
3269+
... index=['x', 'y', 'z'])
3270+
>>> df
3271+
A B C
3272+
x 1 4 p
3273+
y 2 5 q
3274+
z 3 6 r
3275+
>>> df.to_clipboard()
3276+
>>> pd.read_clipboard()
3277+
A B C
3278+
x 1 4 p
3279+
y 2 5 q
3280+
z 3 6 r
32703281
32713282
We can see that we got the same content back, which we had earlier written to the clipboard.
32723283

doc/sphinxext/contributors.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,15 @@ class ContributorsDirective(Directive):
2121

2222
def run(self):
2323
range_ = self.arguments[0]
24+
if range_.endswith('x..HEAD'):
25+
return [nodes.paragraph(), nodes.bullet_list()]
2426
try:
2527
components = build_components(range_)
26-
except git.GitCommandError:
28+
except git.GitCommandError as exc:
2729
return [
2830
self.state.document.reporter.warning(
29-
"Cannot find contributors for range '{}'".format(range_),
31+
"Cannot find contributors for range '{}': {}".format(
32+
range_, exc),
3033
line=self.lineno)
3134
]
3235
else:

pandas/core/dtypes/base.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ class property**.
6868
``pandas.errors.AbstractMethodError`` and no ``register`` method is
6969
provided for registering virtual subclasses.
7070
"""
71-
# na_value is the default NA value to use for this type. This is used in
72-
# e.g. ExtensionArray.take. This should be the user-facing "boxed" version
73-
# of the NA value, not the physical NA value for storage.
74-
# e.g. for JSONArray, this is an empty dictionary.
75-
na_value = np.nan
7671
_metadata = () # type: Tuple[str, ...]
7772

7873
def __str__(self):
@@ -114,6 +109,17 @@ def __hash__(self):
114109
def __ne__(self, other):
115110
return not self.__eq__(other)
116111

112+
@property
113+
def na_value(self):
114+
"""
115+
Default NA value to use for this type.
116+
117+
This is used in e.g. ExtensionArray.take. This should be the
118+
user-facing "boxed" version of the NA value, not the physical NA value
119+
for storage. e.g. for JSONArray, this is an empty dictionary.
120+
"""
121+
return np.nan
122+
117123
@property
118124
def type(self) -> Type:
119125
"""

pandas/core/indexes/base.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ def _outer_indexer(self, left, right):
229229
_data = None
230230
_id = None
231231
name = None
232-
asi8 = None
233232
_comparables = ['name']
234233
_attributes = ['name']
235234
_is_numeric_dtype = False
@@ -501,6 +500,18 @@ def __new__(cls, data=None, dtype=None, copy=False, name=None,
501500
See each method's docstring.
502501
"""
503502

503+
@property
504+
def asi8(self):
505+
"""
506+
Integer representation of the values.
507+
508+
Returns
509+
-------
510+
ndarray
511+
An ndarray with int64 dtype.
512+
"""
513+
return None
514+
504515
@classmethod
505516
def _simple_new(cls, values, name=None, dtype=None, **kwargs):
506517
"""

0 commit comments

Comments
 (0)