Where does setup.py get the version from in pytest?

Viewed 19

I'm currently learning about distribution packaging in Python, and while doing so looking at some familiar projects and how they do it.

So I was looking at the source tree of pytest, and I can't figure out how is the version read by running setup.py --version, and also by tools like pip, etc.

Basically, there is the file src/_pytest/_version.py which contains:

__version__ = version = '7.2.0.dev228+g58cf20edf'
__version_tuple__ = version_tuple = (7, 2, 0, 'dev228', 'g58cf20edf')

Then, the __init__.py file imports these variables:

__all__ = ["__version__", "version_tuple"]

try:
    from ._version import version as __version__, version_tuple

But the setup.py and setup.cfg both don't have a version= field, so I can't understand how this information is read by setuptools when I run:

$ py setup.py --version

?

0 Answers
Related