[Pandas-dev] Avoiding Dependencies on Private Modules

Marc Garcia garcia.marc at gmail.com
Fri Jul 19 07:42:28 EDT 2019


I'm unsure, I think someone else should be able to answer about the license.

But I think it's worth opening the issue with Matplotlib. If that function
is useful for different use cases, I think they can be happy to move it
there, and it'd also be good to pandas to just call the Matplotlib function
directly.

Thanks!

On Fri, Jul 19, 2019 at 12:34 PM Matthew Gidden <matthew.gidden at gmail.com>
wrote:

> Hi Marc,
>
> Thanks for the quick reply. I agree with your "least bad of all solutions"
> approach here. I'm a bit rusty on the correct practice for doing so - do we
> need to copy over also panda's license file? Or are we ok with a
> notification via comment at the top of the copied file/function?
>
> Cheers,
> Matt
>
> On Fri, Jul 19, 2019 at 1:28 PM Marc Garcia <garcia.marc at gmail.com> wrote:
>
>> I don't think there is any better way. That's just an internal method,
>> and I don't think it makes sense to have it in the pandas public API.
>>
>> May be you can check with Matplotlib if that function is something they
>> want to provide, that sounds like the best option to me if it's useful for
>> other projects.
>>
>> If they are not interested, I'd personally just copy that file into your
>> project. Surely not an ideal solution, but of all the bad solutions I'd say
>> it's the best. There is no discussion about it yet, but we may want to move
>> `pandas.plotting._matplotlib` to a third-party package in the future. That
>> would break your code again if you just update the module path.
>>
>> On Fri, Jul 19, 2019 at 12:10 PM Matthew Gidden <matthew.gidden at gmail.com>
>> wrote:
>>
>>> Hi all,
>>>
>>> I am one of the developers of a niche scientific library, pyam [1]. We
>>> provide some standard plotting routines for users with our specific data
>>> model, many of which are shims for pandas plotting. In order to keep track
>>> of certain aspects of data-plot attributes, we utilize the
>>> `_get_standard_colors()` [2]. Before pandas 0.25.0, this lived in
>>> pandas.plotting._style. Now it lives in pandas.plotting._matplotlib.style.
>>> Of course, this change breaks our package - we know this is our fault for
>>> relying on a private module =).
>>>
>>> Therefore - I wanted to ask the list whether there is a better way to
>>> get this functionality that is provided in first-class public interfaces?
>>> For now we can hotfix the issue, but we would like to try to guarantee
>>> stability in the future.
>>>
>>> Cheers,
>>> Matt
>>>
>>> [1] https://pyam-iamc.readthedocs.io/en/latest/
>>> [2]
>>> https://github.com/IAMconsortium/pyam/blob/master/pyam/plotting.py#L37
>>> _______________________________________________
>>> Pandas-dev mailing list
>>> Pandas-dev at python.org
>>> https://mail.python.org/mailman/listinfo/pandas-dev
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pandas-dev/attachments/20190719/ee8bde66/attachment.html>


More information about the Pandas-dev mailing list