Closed kloczek closed 2 years ago
Seaborn vendors the husl
module so technically it is unaffected by this. I'm not sure there's a compelling reason to incur the churn required to change the name seaborn uses for the palette — AFAIK there are no actual bugs in the code we package.
Issue still remains that husl
is no longer maintained and looks like its code still is not cleaned to remove python 2.x bits.
but what is the actual problem here? the husl code just does some matrix multiplications, it's not like there is a security risk. if it exercises upstream features that get deprecated, that will turn up in the seaborn tests and we can deal with it in the vendored module.
Issue is that husl
as it still contaons python 2.x syntach thos blocks packaging of that module because it is not possible to generate python pcode files (.pyc and .po files).
It sounds like you're trying to do something specific, but I don't know what it is. Please be clear about what actual problem you are encountering, beyond the mere existence of Python 2.x syntax. Otherwise, it's a waste of time to update a vendored dependency that solves the problem it is meant to solve.
I'm packaging python modules as rpm and Solaris IPS packages. Part of the packaging process is gernerate python pcode files and as I wrote python exits with error cpde when source .py file contains python 2.x syntax.
Nevertheless depend on the other modules code which is unmantained brings some elent of the risk. That risk is possible IMO to nullify by switching to alternative module which is EnoughGood™️ mantained.
Please provide details about the error code you are seeing.
I alredy gave more thab one argument and each one should be enough to at leaset consider change cureent situation. Despite that yuo still want me to give you more. I have impression that whatever I'll dropp on the table you are not going to do anything and you are tryng to discourage me. At some pont it is necessary to stop .. because looks like I'm wasteing time.
If you don't like the idea just please close the ticket and I'll reuse saved time on my own migration.
Closing because there is no clearly defined issue here.
I alredy gave more thab one argument and each one should be enough to at leaset consider change cureent situation. Despite that yuo still want me to give you more.
What I asked for was details to support the argument you were making. If you say you are seeing an error, what error are you seeing? If you are saying that Python 2 syntax is a problem, what syntax? Why am I supposed to believe that whatever problem you are having has anything to do with the husl code?
What I asked for was details to support the argument you were making. If you say you are seeing an error, what error are you seeing? If you are saying that Python 2 syntax is a problem, what syntax? Why am I supposed to believe that whatever problem you are having has anything to do with the husl code?
As I wrote husl
is no longer maintained module.
On packaging as rpm package it fails because its code contains python 2.x syntax (python 3.x refuses generate in such cases pcode).
In mean time I've been tryng to switch to hsluv
using below patch
however looks like there are some API changes so above is not enough and pytest is failing
Despite that pytest as you see shows DeprecationWarning
warnings about still use distutils
. That part definitelly is sometbig which should be fixed.
On packaging as rpm package it fails because its code contains python 2.x syntax
You keep saying that "its code contains python 2.x syntax" and I have truly no idea what you mean. Seaborn has been running on Python 3 for many years with no issues related to syntax in the husl module.
I would be :-1: on your patch even if you manage to update all of the lines that call into the new library. I am not going to break seaborn API and change the name of the palette just because the husl folks decided to change the name of their library.
I would be 👎 on your patch even if you manage to update all of the lines that call into the new library. I am not going to break seaborn API and change the name of the palette just because the husl folks decided to change the name of their library.
I'm talkimg about not mantained husl
module. Not your seaborn
.
Is that now clear why I've asked move away fom that module?
It really is not clear. I can run seaborn perfectly fine on Python 3 and have never heard otherwise from anyone else until now. If you are talking about a different library, why are you opening an issue on the seaborn repository?
Again: seaborn
depends on husl
and THAT module contains py 2.x syntax THAT module and by this it is now disfficult to package it.
I have nothint to say about impact of usimg old husl
module with seaborn
.
Again: seaborn depends on husl and THAT module contains py 2.x syntax
These are seaborn's mandatory dependencies:
https://github.com/mwaskom/seaborn/blob/b726628083f56ddec3cf390b2e7e91d9608d88c9/setup.py#L38-L43
And this is pytest output
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-seaborn-0.11.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-seaborn-0.11.2-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -p no:cacheprovider seaborn
ImportError while loading conftest '/home/tkloczko/rpmbuild/BUILD/seaborn-0.11.2/seaborn/conftest.py'.
seaborn/__init__.py:2: in <module>
from .rcmod import * # noqa: F401,F403
seaborn/rcmod.py:7: in <module>
from . import palettes
seaborn/palettes.py:7: in <module>
import husl
E ModuleNotFoundError: No module named 'husl'
This is what line 7 of palettes.py
looks like at the v0.11.2 tag:
I don't know where you're getting your seaborn source from, but if it doesn't match what's in this repository, I cannot do anything about that.
Hmm so in this case looks like pytes cannot find that module because is used relative direcory import. I'm using typical "test as installed methodologu which consit from:
python3 -sBm build -w --no-isolation
Just hads a look one more time on what lands in </install/prefix> and I see:
[tkloczko@devel-g2v seaborn]$ grep -r "from \."
__init__.py:from .rcmod import * # noqa: F401,F403
__init__.py:from .utils import * # noqa: F401,F403
__init__.py:from .palettes import * # noqa: F401,F403
__init__.py:from .relational import * # noqa: F401,F403
__init__.py:from .regression import * # noqa: F401,F403
__init__.py:from .categorical import * # noqa: F401,F403
__init__.py:from .distributions import * # noqa: F401,F403
__init__.py:from .matrix import * # noqa: F401,F403
__init__.py:from .miscplot import * # noqa: F401,F403
__init__.py:from .axisgrid import * # noqa: F401,F403
__init__.py:from .widgets import * # noqa: F401,F403
__init__.py:from .colors import xkcd_rgb, crayons # noqa: F401
__init__.py:from . import cm # noqa: F401
_core.py:from ._decorators import (
_core.py:from .palettes import (
_core.py:from .utils import (
_core.py: from .axisgrid import FacetGrid
_statistics.py:from .utils import _check_argument
axisgrid.py:from ._core import VectorPlotter, variable_type, categorical_order
axisgrid.py:from . import utils
axisgrid.py:from .utils import _check_argument, adjust_legend_subtitles, _draw_figure
axisgrid.py:from .palettes import color_palette, blend_palette
axisgrid.py:from ._decorators import _deprecate_positional_args
axisgrid.py:from ._docstrings import (
axisgrid.py: from .distributions import histplot, kdeplot
axisgrid.py: from .distributions import histplot, kdeplot
axisgrid.py: from .relational import scatterplot # Avoid circular import
axisgrid.py: from .regression import regplot # Avoid circular import
axisgrid.py: from .distributions import kdeplot # Avoid circular import
axisgrid.py: from .distributions import histplot # Avoid circular import
axisgrid.py: from .relational import scatterplot
axisgrid.py: from .regression import regplot, residplot
axisgrid.py: from .distributions import histplot, kdeplot, _freedman_diaconis_bins
categorical.py:from ._core import variable_type, infer_orient, categorical_order
categorical.py:from . import utils
categorical.py:from .utils import remove_na
categorical.py:from .algorithms import bootstrap
categorical.py:from .palettes import color_palette, husl_palette, light_palette, dark_palette
categorical.py:from .axisgrid import FacetGrid, _facet_docs
categorical.py:from ._decorators import _deprecate_positional_args
distributions.py:from ._core import (
distributions.py:from ._statistics import (
distributions.py:from .axisgrid import (
distributions.py:from .utils import (
distributions.py:from .palettes import color_palette
distributions.py:from ._decorators import _deprecate_positional_args
distributions.py:from ._docstrings import (
matrix.py:from . import cm
matrix.py:from .axisgrid import Grid
matrix.py:from .utils import (
matrix.py:from ._decorators import _deprecate_positional_args
palettes.py:from .utils import desaturate, get_color_cycle
palettes.py:from .colors import xkcd_rgb, crayons
palettes.py: from .rcmod import set_palette
palettes.py: from .rcmod import set_palette
rcmod.py:from . import palettes
rcmod.py: from . import _orig_rc_params
regression.py:from . import utils
regression.py:from . import algorithms as algo
regression.py:from .axisgrid import FacetGrid, _facet_docs
regression.py:from ._decorators import _deprecate_positional_args
relational.py:from ._core import (
relational.py:from .utils import (
relational.py:from .algorithms import bootstrap
relational.py:from .axisgrid import FacetGrid, _facet_docs
relational.py:from ._decorators import _deprecate_positional_args
relational.py:from ._docstrings import (
widgets.py:from .miscplot import palplot
widgets.py:from .palettes import (color_palette, dark_palette, light_palette,
widgets.py: from .rcmod import axes_style # Avoid circular import
colors/__init__.py:from .xkcd_rgb import xkcd_rgb # noqa: F401
colors/__init__.py:from .crayons import crayons # noqa: F401
tests/test_algorithms.py:from .. import algorithms as algo
tests/test_axisgrid.py:from .._core import categorical_order
tests/test_axisgrid.py:from .. import rcmod
tests/test_axisgrid.py:from ..palettes import color_palette
tests/test_axisgrid.py:from ..relational import scatterplot
tests/test_axisgrid.py:from ..distributions import histplot, kdeplot, distplot
tests/test_axisgrid.py:from ..categorical import pointplot
tests/test_axisgrid.py:from .. import axisgrid as ag
tests/test_axisgrid.py:from .._testing import (
tests/test_categorical.py:from .. import categorical as cat
tests/test_categorical.py:from .. import palettes
tests/test_core.py:from ..axisgrid import FacetGrid
tests/test_core.py:from .._core import (
tests/test_core.py:from ..palettes import color_palette
tests/test_decorators.py:from .._decorators import (
tests/test_distributions.py:from .. import distributions as dist
tests/test_distributions.py:from ..palettes import (
tests/test_distributions.py:from .._core import (
tests/test_distributions.py:from .._statistics import (
tests/test_distributions.py:from ..distributions import (
tests/test_distributions.py:from ..axisgrid import FacetGrid
tests/test_distributions.py:from .._testing import (
tests/test_docstrings.py:from .._docstrings import DocstringComponents
tests/test_matrix.py:from .. import matrix as mat
tests/test_matrix.py:from .. import color_palette
tests/test_matrix.py:from .._testing import assert_colors_equal
tests/test_miscplot.py:from .. import miscplot as misc
tests/test_miscplot.py:from ..palettes import color_palette
tests/test_miscplot.py:from .test_utils import _network
tests/test_palettes.py:from .. import palettes, utils, rcmod
tests/test_palettes.py:from ..colors import xkcd_rgb, crayons
tests/test_rcmod.py:from .. import rcmod, palettes, utils
tests/test_rcmod.py:from ..conftest import has_verdana
tests/test_regression.py:from .. import regression as lm
tests/test_regression.py:from ..palettes import color_palette
tests/test_relational.py:from ..palettes import color_palette
tests/test_relational.py:from ..relational import (
tests/test_statistics.py:from .._statistics import (
tests/test_utils.py:from .. import utils, rcmod
tests/test_utils.py:from ..utils import (
All that should be raplaced by full module names.
That seems irrelevant to the problem you're having with husl.
It is revelant becasuse in all packaged pythom modules I'm using "test as installed methodology":
python3 -sBm build -w --no-isolation
build
with --no-isolation
I'm using during all processes only locally installed modulesIn that case no longer all components involved in testing are in the same tree (sopurce code tree) in which is possible to reach all necessaty components over relative paths. Using relative imports is always bad and may casues many other issues.
None of that has anything to do with the fact that you (or whoever you got it from) have changed the source code to import husl as an external package rather than use the vendored version that works perfectly fine on Python 3.
Whether the tests import seaborn modules with relative or absolute paths has nothing to do with the fact that your stacktrace says import husl
, and that is not what it says in the canonical version of the seaborn source code.
You have wasted a tremendous amount of my time reporting this issue without sufficient information to understand it, and now that the cause of the problem seems apparent, you don't really seem motivated to actually fix it. I don't see any reason to continue this discussion.
Looks like
husl
module is no longer maintained (last release was in 2015) and instead can be usedhsluv
https://pypi.org/project/hsluv/ https://github.com/hsluv/hsluv-python/