python-dateutil
(PyPI: 50M downloads/month)setuptools
(PyPI: 62M downloads/month)Website: https://ganssle.io | Github / Twitter: @pganssle |
Blog: https://blog.ganssle.io | Fediverse: @pganssle@qoto.org |
✨ My Trip to Hyderabad ✨
The smaller the user base, the harder it is to design an appropriate interface, but the larger the user base, the harder it is to change your interface.
Given enough eyeballs, all bugs are shallow.
>>> def f():
... if 0:
... break # This is a syntax error!
... print("Hello")
...
>>> f()
Hello
>>> from datetime import datetime, timedelta, timezone
>>> class DatetimeSubclass(datetime): pass
...
>>> DatetimeSubclass.fromtimestamp(1607167800.0)
DatetimeSubclass(2020, 12, 5, 6, 30)
>>> DatetimeSubclass.fromtimestamp(1607167800.0, timezone.utc)
datetime.datetime(2020, 12, 5, 11, 30, tzinfo=datetime.timezone.utc)
No battle plan survives contact with the enemy. [N]o plan of operations extends with any certainty beyond the first contact with the main hostile force.
From @_saljam's April 2020 Twitter Thread on RTL bugs.
With a sufficient number of users of an API, it does not matter what you promise in the contract: all observable behaviors of your system will be depended on by somebody.
The real-word implications from my world are this: if your code has "if 0:" clauses in it, and you measure its coverage, then because the lines have not been optimized away, coverage.py will think the lines are a possible execution path, and will be considered a miss because they are not executed. This will reduce your coverage percentage.
def f() -> int:
if 0:
print("This code is unreachable!")
if not __debug__:
print("Running in optimized mode!")
return 3
In Python 2.0, distutils
was added to the standard library. This allowed distro maintainers:
Package authors would write a setup.py
that runs distutils.core.setup()
, and end users would execute any number of commands via setup.py <command>
(e.g. setup.py install
and setup.py test
).
The sheer amount of features that Setuptools brings to the table must be stressed: namespace packages, optional dependencies, automatic manifest building by inspecting version control systems, web scraping to find packages in unusual places, recognition of complex version numbering schemes, and so on, and so on. Some of these features perhaps seem esoteric to many, but complex projects use many of them.
$ pip install attrs
Collecting attrs
Downloading attrs-20.3.0.tar.gz (164 kB)
|████████████████████████████████| 164 kB 6.1 MB/s
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Building wheels for collected packages: attrs
Building wheel for attrs (PEP 517) ... done
Created wheel for attrs: filename=attrs-20.3.0-py2.py3-none-any.whl size=49337
sha256=a6b44de70bcc7834e967dbea0b96c5f1ad03d438227c1e78f5dcbfbeb338607c
Stored in directory: ~/.cache/pip/wheels/a4/3a/c7/ae1b7ae92f377604b64cab81594eb43ea843376139f34cc8a5
Successfully built attrs
Installing collected packages: attrs
Successfully installed attrs-20.3.0
The smaller the user base, the harder it is to design an appropriate interface, but the larger the user base, the harder it is to change your interface.