Summary
Mako 1.4.0 installs a top-level tools package (site-packages/tools/ containing toxnox.py and warn_tox.py) alongside mako/. This appears unintentional: tools/ looks like an internal repo directory that got picked up by package discovery. 1.3.x does not install it.
Because tools is an extremely common name, this shadows project-local tools packages for anyone who installs Mako, including the very large number of projects that get it transitively via Alembic. It is especially disruptive for projects whose tools is a namespace package (no __init__.py), since a regular package always wins over a namespace package regardless of sys.path order, so the usual "put your project first on the path" workaround does not help.
Reproduction
docker run --rm python:3.12-slim bash -c '
python -m venv /tmp/v
/tmp/v/bin/pip install -q "Mako==1.4.0"
ls /tmp/v/lib/python3.12/site-packages/tools/
'
Output:
__init__.py
toxnox.py
warn_tox.py
The files are recorded in mako-1.4.0.dist-info/RECORD under tools/.
With Mako==1.3.12 the same commands produce no site-packages/tools/.
Impact example
A project with its own tools/ namespace package started failing at import as soon as 1.4.0 was published, via alembic -> Mako:
ImportError: cannot import name 'cell_image_cleanup' from 'tools'
(/…/site-packages/tools/__init__.py)
ModuleNotFoundError: No module named 'tools.agent_report'
No code or dependency declaration changed on our side; only the upstream resolve did.
Suggested fix
Exclude tools* from package discovery (or move those helpers outside the packaged tree) and release a 1.4.1. As a workaround, downstream projects can pin Mako<1.4.0.
Versions
- Mako 1.4.0 (installed by pip 25.0.1, Python 3.12.13, linux/amd64,
python:3.12-slim)
- Mako 1.3.12: unaffected
Summary
Mako 1.4.0 installs a top-level
toolspackage (site-packages/tools/containingtoxnox.pyandwarn_tox.py) alongsidemako/. This appears unintentional:tools/looks like an internal repo directory that got picked up by package discovery. 1.3.x does not install it.Because
toolsis an extremely common name, this shadows project-localtoolspackages for anyone who installs Mako, including the very large number of projects that get it transitively via Alembic. It is especially disruptive for projects whosetoolsis a namespace package (no__init__.py), since a regular package always wins over a namespace package regardless ofsys.pathorder, so the usual "put your project first on the path" workaround does not help.Reproduction
Output:
The files are recorded in
mako-1.4.0.dist-info/RECORDundertools/.With
Mako==1.3.12the same commands produce nosite-packages/tools/.Impact example
A project with its own
tools/namespace package started failing at import as soon as 1.4.0 was published, viaalembic->Mako:No code or dependency declaration changed on our side; only the upstream resolve did.
Suggested fix
Exclude
tools*from package discovery (or move those helpers outside the packaged tree) and release a 1.4.1. As a workaround, downstream projects can pinMako<1.4.0.Versions
python:3.12-slim)