Why does https://pypi.org/project/builtins/ not exist?
The builtins module ships with python and is “built in”,
There is no need for a PyPi package.
What are you trying to do?
Why would you expect it to? What functionality do you think it should implement, and why?
Quicker updates to components, since builtins
is a module like any other, right? It’s like an Android OTA system update versus an update from the package manager (F-Droid, Google Play) to a specific package.
builtins
is “just a module” (scare quotes mine), but as its name implies, it’s built directly into the interpreter and cannot be updated separately.
Also note that no standard library modules receive updates from PyPI. There are some cases where there is a similarly-named and closely related package on PyPI (importlib-metadata
↔ importlib.metadata
comes to mind), but even in those cases the PyPI package is imported differently (e.g., import importlib_metadata as imd
vs from importlib import metadata as imd
).
Thanks, @zware. I wish we had the Q&A module on this Discourse instance, because I’d mark yours as the Answer.
There is one case (turtle
) where a same-named, unrelated package is on PyPI. Current policy is to forbid those, but this one dates to before the policy was enacted… I’m nominally working on that, but the PEP 517 process seems to be very, very slow.
We do now! I’ve solely marked the undermentioned as so in its stead because it includes the entirety of yours, plus additional context.
Relevantly, I’ve since located the undermentioned, which elaborate:
-
Is it possible to get
pip
to install those modules whilepip
is installing my package, or do I just have to trust that because the user has Python installed they will also haveTkinter
andtime
installed? -
Regarding the upgrades of the built-in libraries: NO, you cannot do this. Because they are part of the python setup, not of the application environment. Python is very tightly bound to the specific code in those libraries. All python apps & libs expect the same behavior of those libraries, even if they are buggy.
In addition to that, you cannot install a module/package with the same name as one of the python’s builtins, because it will create the ambiguity on import, and can confuse/break all other libraries which depend on it (or worse, the system applications if you install it into the system python).
I presume that this is partially due to what 76643370/1
explains:
The module
builtins
holds a bunch of “built-in” functions, which are so regularly needed that the language makes them available to your programs implicitly without you needing to explicitlyimport
them. This is merely as a convenience for the programmer. You can explicitlyimport builtins
if you need to, but usually you don’t (because the contents ofbuiltins
is already available in every module).