[Python-ideas] Proposing additions to the standard library

Jonathan Crall erotemic at gmail.com
Wed Nov 14 19:31:49 EST 2018


@Stéfane Bolton looks really neat! I'll take a look. Some of my stuff may
fit better as a PR for this library.

Also I don't think its foolish to depend on a package for one function,
given that that (a) that function is really useful or (b) the size of the
dependency itself is small. Given my initial impressions of boltons, I
would guess that it doesn't have a large download size of runtime impact.
Although if this case keeps reoccurring with a particular function, then
perhaps that function might improve the stdlib? After really reviewing my
stuff, I think a few functions I have would make the stdlib better, but its
probably only a small few. I bet there are things in bolton that would
improve the stdlib as well, but I do agree that "semi-standard" libraries
(e.g. numpy / scipy / what-I-hope-ubelt-to-be) might be better place for
these functions that would otherwise cause costly-clutter in the stdlib.

On Tue, Nov 13, 2018 at 2:05 AM Stéfane Fermigier <sf at fermigier.com> wrote:

> Are you aware of https://boltons.readthedocs.io/ (whose motto is
> "Functionality that should be in the standard library.") ?
>
> Or similar endeavours such as:
>
> - https://pypi.org/project/auxlib/
> - https://pypi.org/project/omakase/
> - (And probably many others on PyPI with similar descriptions such as "a
> library of stuff I'm using / we're using at company X for all my / our
> project(s)...")
>
> Or the functional libraries listed here:
> https://github.com/sfermigier/awesome-functional-python/blob/master/README.md#libraries
>
> => IMHO there is room for a "semi-standard" library, stuff that's not
> included by default and has a release lifecycle more active that Python
> itself, but that can be considered the standard by a large group of users.
>
> Similar ideas can be found for instance in Java with Apache Commons (
> https://commons.apache.org/ -> "an Apache project focused on all aspects
> of reusable Java components."). One could argue, though, that the Java
> standard library is much less developed than the Python standard library,
> so it's much easier to justify the existence of Apache Commons than a
> similar Python project.
>
> There is also the question of the porosity between such a project and the
> stdlib, which is the essence of the original question by the OP.
>
> Another interesting issue is the granularity of such a project. I
> sometimes, and somewhat foolishly, make libraries such as toolz or boltons
> a dependency of my projects, for just one or two function calls from my
> code.
>
> Regards,
>
>   S.
>
>
> On Sun, Nov 11, 2018 at 2:37 AM Jonathan Crall <erotemic at gmail.com> wrote:
>
>> I'm interested in proposing several additions to the Python standard
>> library, and I would like more information on the procedure for doing so.
>> Are all additions done via a PEP? If not what is the procedure. If so, I've
>> read that the first step was to email this board and get feedback.
>>
>> I have a library called `ubelt` that contains several tools that I think
>> might be worthy of adding to the standard library.
>>
>> Here's my bullet point pitch:
>>
>>    - Python is batteries included. Ubelt contains extra batteries.
>>    function are extra batteries.
>>    - Most function in ubelt are fast. All 222 tests takes 7.33 seconds.
>>    - Ubelt has 100% test coverage (sans `# nocover` locations).
>>    - I'm only championing a subset of the functions in ubelt. There are
>>    certainly functions in there that do not belong in the standard library.
>>    - I have a Jupyter notebook that give a demo of some select functions
>>    (not necessarily the same as the ones proposed here):
>>    https://github.com/Erotemic/ubelt/blob/master/docs/notebooks/Ubelt%20Demo.ipynb
>>    - I do have documentation (mostly in docstrings) and in the docs
>>    folder, but I've been having trouble auto-updating read-the-docs. Here is
>>    the link anyway: https://ubelt.readthedocs.io/en/latest/
>>
>> Here is a tentative list of interesting functions. Hopefully the names
>> are descriptive (if not, see docstrings:
>> https://github.com/Erotemic/ubelt)
>>
>> ub.cmd
>>
>> ub.compressuser
>>
>> ub.group_items
>>
>> ub.dict_hist
>>
>> ub.find_duplicates
>>
>> ub.AutoDict
>>
>> ub.import_module_from_path
>>
>> ub.import_module_from_name
>>
>> ub.modname_to_modpath,
>>
>> ub.modpath_to_modname
>>
>> ub.ProgIter
>>
>> ub.ensuredir
>>
>> ub.expandpath
>>
>>
>> almost everything in util_list:
>>
>> allsame, argmax, argmin, argsort, argunique,
>>
>> chunks, flatten, iter_window, take, unique
>>
>>
>> These functions might be worth modifying into dictionary methods:
>>
>> ub.dict_subset
>>
>> ub.dict_take
>>
>> ub.map_vals
>>
>> ub.map_keys
>>
>> ub.Timerit
>>
>> ub.Timer
>>
>>
>>
>> Because I built the library, I tend to like all the functions. Its
>> difficult to decide if they are stdlib worthy, so there might be some false
>> positives / negatives.
>>
>> I'm on the fence about:
>> CacheStamp, Cacher, NoParam, argflag, argval, dzip, delete, hash_data,
>> hash_file, memoize, memoize_method, NiceRepr, augpath, userhome,
>> ensure_app_cache_dir, ensure_app_resource_dir, find_exe, find_path,
>> get_app_cache_dir, get_app_resource_dir, platform_cache_dir,
>>  platform_resource_dir, CaptureStdout, codeblock, ensure_unicode, hzcat,
>>  indent, OrderedSet
>>
>>
>> Its my hope that some of these are actually useful. Let me know any of
>> the following: what you think, if there are any questions, if something
>> else needs to be done, or what the next steps are.
>>
>> --
>> -Jon
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>
>
> --
> Stefane Fermigier - http://fermigier.com/ - http://twitter.com/sfermigier
> - http://linkedin.com/in/sfermigier
> Founder & CEO, Abilian - Enterprise Social Software -
> http://www.abilian.com/
> Chairman, Free&OSS Group @ Systematic Cluster -
> https://systematic-paris-region.org/fr/groupe-thematique-logiciel-libre/
> Co-Chairman, National Council for Free & Open Source Software (CNLL) -
> http://cnll.fr/
> Founder & Organiser, PyParis & PyData Paris - http://pyparis.org/ &
> http://pydata.fr/
>


-- 
-Jon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20181114/af25c2a5/attachment-0001.html>


More information about the Python-ideas mailing list