flit "Missing version or docstring" in CI
flit derives the distribution version from your module's __version__ and the summary from its top-level docstring. If either is missing and not declared dynamic, flit refuses to build because it cannot fill required metadata.
What this error means
The flit build fails with "Missing version or docstring" (or a message that version/description are required) pointing at your package's __init__.py.
Missing version or docstring in module mypkg
# flit reads __version__ and the module docstring for metadataCommon causes
No __version__ in the module
flit looks for __version__ = "..." at module level. Without it, there is no version to publish.
No module docstring for the summary
flit uses the first line of the module docstring as the package summary; an undocumented module leaves description empty.
How to fix it
Add __version__ and a docstring
- Add a top-level docstring to your package module.
- Define
__version__at module scope. - Re-run the flit build.
"""A small example package."""
__version__ = "0.3.1"Declare metadata as dynamic
If you provide version and description elsewhere, mark them dynamic so flit does not require them in the module.
[project]
name = "mypkg"
dynamic = ["version", "description"]How to prevent it
- Keep
__version__and a module docstring in your package entry module. - Use
dynamicconsistently when metadata lives elsewhere. - Build with flit in CI to catch missing metadata.