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

[v0.11] Vendor the Version package, use it instead of distutils #2766

Merged
merged 7 commits into from
Apr 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [master, v0.11]
pull_request:
branches: master
branches: [master, v0.11]

env:
NB_KERNEL: python
Expand Down
2 changes: 1 addition & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sphinx==3.3.1
sphinx_bootstrap_theme==0.7.1
sphinx_bootstrap_theme==0.8.1
numpydoc
nbconvert
ipykernel
Expand Down
23 changes: 23 additions & 0 deletions licences/PACKAGING_LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Copyright (c) Donald Stufft and individual contributors.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4 changes: 2 additions & 2 deletions seaborn/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from collections.abc import Iterable, Sequence, Mapping
from numbers import Number
from datetime import datetime
from distutils.version import LooseVersion

import numpy as np
import pandas as pd
Expand All @@ -14,6 +13,7 @@
from ._decorators import (
share_init_params_with_map,
)
from .external.version import Version
from .palettes import (
QUAL_PALETTES,
color_palette,
Expand Down Expand Up @@ -1162,7 +1162,7 @@ def _attach(self, obj, allowed_types=None, log_scale=None):
if scale is True:
set_scale("log")
else:
if LooseVersion(mpl.__version__) >= "3.3":
if Version(mpl.__version__) >= Version("3.3"):
set_scale("log", base=scale)
else:
set_scale("log", **{f"base{axis}": scale})
Expand Down
4 changes: 2 additions & 2 deletions seaborn/_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
class instantiation.

"""
from distutils.version import LooseVersion
from numbers import Number
import numpy as np
import scipy as sp
from scipy import stats

from .external.version import Version
from .utils import _check_argument


Expand Down Expand Up @@ -129,7 +129,7 @@ def _fit(self, fit_data, weights=None):
"""Fit the scipy kde while adding bw_adjust logic and version check."""
fit_kws = {"bw_method": self.bw_method}
if weights is not None:
if LooseVersion(sp.__version__) < "1.2.0":
if Version(sp.__version__) < Version("1.2.0"):
msg = "Weighted KDE requires scipy >= 1.2.0"
raise RuntimeError(msg)
fit_kws["weights"] = weights
Expand Down
4 changes: 2 additions & 2 deletions seaborn/axisgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from inspect import signature
import warnings
from textwrap import dedent
from distutils.version import LooseVersion

import numpy as np
import pandas as pd
Expand All @@ -11,6 +10,7 @@

from ._core import VectorPlotter, variable_type, categorical_order
from . import utils
from .external.version import Version
from .utils import _check_argument, adjust_legend_subtitles, _draw_figure
from .palettes import color_palette, blend_palette
from ._decorators import _deprecate_positional_args
Expand Down Expand Up @@ -127,7 +127,7 @@ def add_legend(self, legend_data=None, title=None, label_order=None,
blank_handle = mpl.patches.Patch(alpha=0, linewidth=0)
handles = [legend_data.get(l, blank_handle) for l in label_order]
title = self._hue_var if title is None else title
if LooseVersion(mpl.__version__) < LooseVersion("3.0"):
if Version(mpl.__version__) < Version("3.0"):
try:
title_size = mpl.rcParams["axes.labelsize"] * .85
except TypeError: # labelsize is something like "large"
Expand Down
4 changes: 2 additions & 2 deletions seaborn/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import matplotlib.patches as Patches
import matplotlib.pyplot as plt
import warnings
from distutils.version import LooseVersion

from ._core import variable_type, infer_orient, categorical_order
from . import utils
from .external.version import Version
from .utils import remove_na
from .algorithms import bootstrap
from .palettes import color_palette, husl_palette, light_palette, dark_palette
Expand Down Expand Up @@ -378,7 +378,7 @@ def annotate_axes(self, ax):
if self.hue_names is not None:
leg = ax.legend(loc="best", title=self.hue_title)
if self.hue_title is not None:
if LooseVersion(mpl.__version__) < "3.0":
if Version(mpl.__version__) < Version("3.0"):
# Old Matplotlib has no legend title size rcparam
try:
title_size = mpl.rcParams["axes.labelsize"] * .85
Expand Down
Loading