Is cbook public?

Hello everyone,

I was recently looking at the cbook module, and I was wondering
whether this module was public or not. I think there are several
unused method in it, such as ``unmasked_index_ranges``. If this isn't
public, it may be worth cleaning the module a bit and removing the
unused method.

Cheers,
Nelle

Yes, it is public, but it is geared for internal use.

I know there's a lot of code in the wild that treats cbook as public and would probably be affected by it going away. However, there hasn't been much care taken within that module as to what we want to support publicly and what would be better left as private. Many things in it, of course, are imported to the top-level of the matplotlib package, and those are quite strongly public, I would say, but we probably have to do these things on a case-by-case basis. I think the best approach is to probably deprecate now and remove later -- though there may be some things in there that we want to keep even if they aren't used internally (but let's add some tests in the latter case). Do you have a complete list of everything in cbook that isn't used by matplotlib itself?

Mike

···

On 01/07/2013 10:24 AM, Nelle Varoquaux wrote:

Hello everyone,

I was recently looking at the cbook module, and I was wondering
whether this module was public or not. I think there are several
unused method in it, such as ``unmasked_index_ranges``. If this isn't
public, it may be worth cleaning the module a bit and removing the
unused method.

Cheers,
Nelle

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

I know there's a lot of code in the wild that treats cbook as public and
would probably be affected by it going away. However, there hasn't been
much care taken within that module as to what we want to support
publicly and what would be better left as private. Many things in it,
of course, are imported to the top-level of the matplotlib package, and
those are quite strongly public, I would say, but we probably have to do
these things on a case-by-case basis. I think the best approach is to
probably deprecate now and remove later -- though there may be some
things in there that we want to keep even if they aren't used internally
(but let's add some tests in the latter case). Do you have a complete
list of everything in cbook that isn't used by matplotlib itself?

This is a list I quickly built: I have no certainty that it is correct
nor complete:

book's unused functions and classes in matplotlib:

unmasked_index_ranges
tostr (note that there is a method called tostr in mlab)
todatetime
todate
tofloat
toint
_BoundMethodProxy
TimeOut
Idler
Scheduler (is used by TimeOut and Idler)
uniquer
Sorter
Xlator
soundex
Null
dict_delall
RingBuffer
wrap (unsure)
pieces
alltrue
allpairs
finddir
reverse_dict
MemoryMonitor
unmasked_index_ranges

functions that are redefined elsewhere:
is_math_text (in the text module)

I can have a closer look and deprecate things that aren't used
anywhere and don't seem very useful to anyone.

Thanks,
N

···

On 7 January 2013 16:38, Michael Droettboom <mdroe@...31...> wrote:

Mike

On 01/07/2013 10:24 AM, Nelle Varoquaux wrote:

Hello everyone,

I was recently looking at the cbook module, and I was wondering
whether this module was public or not. I think there are several
unused method in it, such as ``unmasked_index_ranges``. If this isn't
public, it may be worth cleaning the module a bit and removing the
unused method.

Cheers,
Nelle

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

I know there's a lot of code in the wild that treats cbook as public and
would probably be affected by it going away. However, there hasn't been
much care taken within that module as to what we want to support
publicly and what would be better left as private. Many things in it,
of course, are imported to the top-level of the matplotlib package, and
those are quite strongly public, I would say, but we probably have to do
these things on a case-by-case basis. I think the best approach is to
probably deprecate now and remove later -- though there may be some
things in there that we want to keep even if they aren't used internally
(but let's add some tests in the latter case). Do you have a complete
list of everything in cbook that isn't used by matplotlib itself?

This is a list I quickly built: I have no certainty that it is correct
nor complete:

book's unused functions and classes in matplotlib:

unmasked_index_ranges
tostr (note that there is a method called tostr in mlab)
todatetime
todate
tofloat
toint
_BoundMethodProxy
TimeOut
Idler
Scheduler (is used by TimeOut and Idler)
uniquer
Sorter
Xlator
soundex
Null
dict_delall
RingBuffer
wrap (unsure)
pieces
alltrue
allpairs
finddir
reverse_dict
MemoryMonitor
unmasked_index_ranges

functions that are redefined elsewhere:
is_math_text (in the text module)

I can have a closer look and deprecate things that aren't used
anywhere and don't seem very useful to anyone.

That seems like a reasonable approach.

One way to handle this might be to

a) create a new module "_cbook.py" for internal use.
b) move everything used internally into there
c) in cbook.py, put "from _cbook import *" and include all of these other functions in there
d) emit a MatplotlibDeprecationWarning at the top level of cbook.py so there's a deprecation warning about the entire module.

I'm not sure this is the best approach, but it's an easy way to deprecate a lot of things at once. Comments from other are appreciated.

Cheers,
Mike

···

On 01/07/2013 11:05 AM, Nelle Varoquaux wrote:

On 7 January 2013 16:38, Michael Droettboom <mdroe@...31...> wrote:

Thanks,
N

Mike

On 01/07/2013 10:24 AM, Nelle Varoquaux wrote:

Hello everyone,

I was recently looking at the cbook module, and I was wondering
whether this module was public or not. I think there are several
unused method in it, such as ``unmasked_index_ranges``. If this isn't
public, it may be worth cleaning the module a bit and removing the
unused method.

Cheers,
Nelle

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

One way to handle this might be to

a) create a new module "_cbook.py" for internal use.
b) move everything used internally into there
c) in cbook.py, put "from _cbook import *" and include all of these other
functions in there
d) emit a MatplotlibDeprecationWarning at the top level of cbook.py so
there's a deprecation warning about the entire module.

I'm not sure this is the best approach, but it's an easy way to deprecate a
lot of things at once. Comments from other are appreciated.

I think it is going to be slightly more complicated than that, as
there are method that are meant for public use (such as
get_sample_data).
I think indeed it would be nice to deprecate most of the methods that
aren't use in matplotlib, and make private the ones that aren't useful
to users (that would make refactoring easier), but that needs to be
done cases by cases.

I can work on that and submit a PR.

···

Cheers,
Mike

Thanks,
N

Mike

On 01/07/2013 10:24 AM, Nelle Varoquaux wrote:

Hello everyone,

I was recently looking at the cbook module, and I was wondering
whether this module was public or not. I think there are several
unused method in it, such as ``unmasked_index_ranges``. If this isn't
public, it may be worth cleaning the module a bit and removing the
unused method.

Cheers,
Nelle

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

I can work on that and submit a PR.

I've submitted a PR (this is Work In Progress):
https://github.com/matplotlib/matplotlib/pull/1647
I think ``get_sample_data`` should be moved to a public, documented module,
as, unlike other methods from the cbook module, it is meant for public use.

···

>
> Cheers,
> Mike
>
>
>>
>> Thanks,
>> N
>>
>>> Mike
>>>
>>>
>>> On 01/07/2013 10:24 AM, Nelle Varoquaux wrote:
>>>>
>>>> Hello everyone,
>>>>
>>>> I was recently looking at the cbook module, and I was wondering
>>>> whether this module was public or not. I think there are several
>>>> unused method in it, such as ``unmasked_index_ranges``. If this isn't
>>>> public, it may be worth cleaning the module a bit and removing the
>>>> unused method.
>>>>
>>>> Cheers,
>>>> Nelle
>>>>
>>>>
>>>>
------------------------------------------------------------------------------
>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills
current
>>>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>>>> MVPs and experts. SALE $99.99 this month only -- learn more at:
>>>> http://p.sf.net/sfu/learnmore_122412
>>>> _______________________________________________
>>>> Matplotlib-devel mailing list
>>>> Matplotlib-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>>>
>>>
>>>
>>>
------------------------------------------------------------------------------
>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>>> MVPs and experts. SALE $99.99 this month only -- learn more at:
>>> http://p.sf.net/sfu/learnmore_122412
>>> _______________________________________________
>>> Matplotlib-devel mailing list
>>> Matplotlib-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>
>