Your extension can build clean on 4.2 and ship without its __init__.py

If you build add-ons with blender --command extension build, this one cost me
an afternoon and I have not seen it written down anywhere.

The symptom is a build that refuses with the file it is asking for sitting right
there in the folder:

FATAL_ERROR: Not a Python package: missing "__init__.*" file, typically "__init__.py"

__init__.py is there. extension validate says everything’s fine. Build still
refuses.

The check is over the set of files the build is going to package, not over the
directory you are standing in. So anything in a [build] section that drops
__init__.py produces that message. Two ways I hit it by accident:

[build]
paths_exclude_pattern = ["__*"]

which I’d written meaning to skip __pycache__, and:

[build]
paths = ["helper.py", "icons/"]

an allowlist where I forgot to name __init__.py at all.

Both give the exact error above on 4.5.12, 4.5.13, 5.0.1, 5.2.0 and 5.2.1.

Here’s the part that sent me back through every zip I’ve ever shipped. On
4.2.23 neither of those refuses. Both build. The exclude version produced this:

created: "./my_addon-1.0.0.zip", 330

A third of a kilobyte. One member inside, blender_manifest.toml. An add-on
with no Python in it, packaged and announced as complete. Your own number will
differ by a few bytes because it follows your manifest; what matters is that
unzip -l shows one line.

extension validate reads Success parsing TOML in "." in that same broken
folder on every 4.2-and-later build I have, which is why the symptom reads as two
tools disagreeing. Validate is looking at the manifest. Build is looking at the
file list.

So if you support 4.2 LTS, and most of us do, the check that matters is not
whether your build command exited cleanly. It is:

unzip -l my_addon-1.0.0.zip

Look for __init__.py in the output. I do that in CI now, because the failure on
4.2 is silent and the zip it hands you looks perfectly normal right up until
somebody installs it.

Measured on 4.2.23, 4.5.12, 4.5.13, 5.0.1, 5.2.0 and 5.2.1, one machine, on
2026-09-06 and again on 2026-09-09 from a fresh folder. That’s every build I
have with an extension command; 3.6 doesn’t have one. The control builds the
same folder with no [build] section and confirms __init__.py lands in the
zip, six times out of six, at 607 bytes each. With the exclude pattern the 4.2
zip is 329 bytes and the allowlist one is 521 with four members, and neither
has any Python in it. If you get something
different on 4.3 or 4.4 I’d like to hear it, because I haven’t got either to hand.

1 Like