Can I add more modules to the Python Standard Library??? I am aware that one can add more modules in Python, but while using one should install that package using pip. Whereas the modules in Python Standard Library like math, statistics, os, sys, etc. are by default available in one's device once Python is downloaded from web.
Is there any way to include one of my new modules in that Python Standard Library???
If you want to add a module to the Python Standard Library, you essentially have to convince the Python Software Foundation to add it.
Questions you need to be prepared to answer are, among other things:
Once you have answered those questions, you have to write up a Python Enhancement Proposal (PEP) that specifies the exact behavior of your module, documents the API, explains why the module is useful, how to use it, and why this particular solution is the "right" one and others don't solve the problem. In the PEP, you should also justify why the problem is impossible to solve outside of the standard library. If you are not already a well-known active contributor to Python, you will probably also need to find some sort of sponsor or mentor that speaks up for you and helps you navigate the process.
Here is an example of such a PEP for adding a new module to the stdlib: PEP 603 – Adding a frozenmap type to collections.
The whole process is outlined in chapter 19 Adding to the stdlib, more precisely subsection 19.2 Adding a new module of the Python Developer's Guide.
Here are some of the things to look out for, all mentioned in the Python Developer's Guide [bold emphasis mine]:
It must be stated upfront that getting a new module into the stdlib is very difficult. Adding any significant amount of code to the stdlib increases the burden placed upon core developers. It also means that the module somewhat becomes “sanctioned” by the core developers as a good way to do something, typically leading to the rest of the Python community to using the new module over other available solutions. All of this means that additions to the stdlib are not taken lightly.
Typically two types of modules get added to the stdlib. One type is a module which implements something that is difficult to get right.
The example given for this type of module is multiprocessing.
The second type of module is one that implements something that people re-implement constantly.
itertools is an example for this type.
The following hard requirements are listed:
making sure the coding style guides are followed and that the proper tests have been written
The module needs to have been out in the community for at least a year.
The module needs to be considered best-of-breed.
Someone involved with the development of the module must promise to help maintain the module in the stdlib for two years.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With