For the collection of the set of dependent packages from a given Python application, the package management tool (commonly pip) will first collect the direct dependencies and then query a PyPI APIs to collect the dependencies of each dependency.
For each dependency, there can be a version "requirement" that can be a simple exact version, a version expression (aka. version specifier) as defined in https://www.python.org/dev/peps/pep-0440/ and additional tags and constraints as specified in https://www.python.org/dev/peps/pep-0508/
In particular the required Python version of a package (or version specifier) can be set for the whole package (with the python_requires
attribute) or as a marker for a given dependency, either direct or indirect.