Skip to content

DOC/CI: Failing documentation build on warnings #26852

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

Merged
merged 8 commits into from
Jun 17, 2019
6 changes: 5 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ jobs:
parameters:
name: macOS
vmImage: xcode9-macos10.13

- template: ci/azure/posix.yml
parameters:
name: Linux
Expand Down Expand Up @@ -134,7 +135,10 @@ jobs:
- script: |
export PATH=$HOME/miniconda3/bin:$PATH
source activate pandas-dev
doc/make.py
# 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)
doc/make.py --warnings-are-errors | tee sphinx.log ; SPHINX_RET=${PIPESTATUS[0]}
grep -B1 "^<<<-------------------------------------------------------------------------$" sphinx.log ; IPY_RET=$(( $? != 1 ))
exit $(( $SPHINX_RET + $IPY_RET ))
displayName: 'Build documentation'

- script: |
Expand Down
1 change: 1 addition & 0 deletions doc/source/getting_started/10min.rst
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ See the :ref:`Plotting <visualization>` docs.
plt.close('all')

.. ipython:: python
:okwarning:

ts = pd.Series(np.random.randn(1000),
index=pd.date_range('1/1/2000', periods=1000))
Expand Down
29 changes: 22 additions & 7 deletions doc/source/user_guide/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3249,24 +3249,39 @@ And then import the data directly to a ``DataFrame`` by calling:

.. code-block:: python

clipdf = pd.read_clipboard()

.. ipython:: python

clipdf

>>> clipdf = pd.read_clipboard()
>>> clipdf
A B C
x 1 4 p
y 2 5 q
z 3 6 r

The ``to_clipboard`` method can be used to write the contents of a ``DataFrame`` to
the clipboard. Following which you can paste the clipboard contents into other
applications (CTRL-V on many operating systems). Here we illustrate writing a
``DataFrame`` into clipboard and reading it back.

.. ipython:: python
.. code-block:: python

df = pd.DataFrame(np.random.randn(5, 3))
df
df.to_clipboard()
pd.read_clipboard()
>>> df = pd.DataFrame({'A': [1, 2, 3],
Copy link
Member

Choose a reason for hiding this comment

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

The lines above needed to be removed I think?

... 'B': [4, 5, 6],
... 'C': ['p', 'q', 'r']},
... index=['x', 'y', 'z'])
>>> df
A B C
x 1 4 p
y 2 5 q
z 3 6 r
>>> df.to_clipboard()
>>> pd.read_clipboard()
A B C
x 1 4 p
y 2 5 q
z 3 6 r

We can see that we got the same content back, which we had earlier written to the clipboard.

Expand Down
7 changes: 5 additions & 2 deletions doc/sphinxext/contributors.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ class ContributorsDirective(Directive):

def run(self):
range_ = self.arguments[0]
if range_.endswith('x..HEAD'):
return [nodes.paragraph(), nodes.bullet_list()]
try:
components = build_components(range_)
except git.GitCommandError:
except git.GitCommandError as exc:
return [
self.state.document.reporter.warning(
"Cannot find contributors for range '{}'".format(range_),
"Cannot find contributors for range '{}': {}".format(
range_, exc),
line=self.lineno)
]
else:
Expand Down
16 changes: 11 additions & 5 deletions pandas/core/dtypes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ class property**.
``pandas.errors.AbstractMethodError`` and no ``register`` method is
provided for registering virtual subclasses.
"""
# na_value is the default NA value to use for this type. This is used in
# e.g. ExtensionArray.take. This should be the user-facing "boxed" version
# of the NA value, not the physical NA value for storage.
# e.g. for JSONArray, this is an empty dictionary.
na_value = np.nan
_metadata = () # type: Tuple[str, ...]

def __str__(self):
Expand Down Expand Up @@ -114,6 +109,17 @@ def __hash__(self):
def __ne__(self, other):
return not self.__eq__(other)

@property
def na_value(self):
"""
Default NA value to use for this type.

This is used in e.g. ExtensionArray.take. This should be the
user-facing "boxed" version of the NA value, not the physical NA value
for storage. e.g. for JSONArray, this is an empty dictionary.
"""
return np.nan

@property
def type(self) -> Type:
"""
Expand Down
13 changes: 12 additions & 1 deletion pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ def _outer_indexer(self, left, right):
_data = None
_id = None
name = None
asi8 = None
_comparables = ['name']
_attributes = ['name']
_is_numeric_dtype = False
Expand Down Expand Up @@ -501,6 +500,18 @@ def __new__(cls, data=None, dtype=None, copy=False, name=None,
See each method's docstring.
"""

@property
def asi8(self):
"""
Integer representation of the values.
Copy link
Member

Choose a reason for hiding this comment

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

Only for the datetime-like indexes (we should probably rather remove it, but that's another issue)


Returns
-------
ndarray
An ndarray with int64 dtype.
"""
return None

@classmethod
def _simple_new(cls, values, name=None, dtype=None, **kwargs):
"""
Expand Down