English
Summary
Conclusions
An import package and a distribution are different concepts: an sdist contains the sources for building, while a wheel contains ready-made files for installation, but it is not a self-contained executable. pyproject.toml describes the metadata, dependencies, entry point, and build method without paths to the author's environment. The src/ layout and installing the built wheel into a clean environment reveal missing modules and resources that editable mode hides. A lock file helps reproduce the environment, and updating dependencies is a separate, tested change. Generic types link input and output, and Protocol defines a structural contract without inheritance. Annotations, TypedDict, and cast do not validate external data at run time, so validation remains mandatory. pytest, mypy, and Ruff check different properties of the code, and CI repeats these checks in a clean environment. PyInstaller builds an executable application, which is tested on the target system and from a different working directory.
Self-check questions
- How does an import package differ from a distribution?
- Why is a wheel not the same as an executable file?
- Which dependencies belong to
build-system, runtime, and dev? - Which error does the
src/layout help detect? - How does an entry point from
[project.scripts]work? - What does the constraint
~=2.4mean, and why is a lock file needed? - Why does an editable install not replace checking the wheel?
- How does
--onedirdiffer from--onefilein PyInstaller? - How does a type parameter link a function's input and output?
- How does a structural
Protocoldiffer from a base class? - Why do
TypedDictandcastnot validate external data? - How does
**Ppreserve a function's parameters in a decorator? - What do mypy, Ruff, and pytest check?
- Why is a green CI status not permission to publish?
- How do you check the resources of a built GUI application?
Official sources: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/, https://docs.python.org/3.14/library/typing.html, https://mypy.readthedocs.io/en/stable/, https://docs.astral.sh/ruff/, https://docs.astral.sh/uv/guides/projects/, https://pyinstaller.org/en/stable/runtime-information.html.