'What is top_level.txt and when is it created?

Background

From The Internal Structure of Python Eggs (hosted by python.org), I learned that there's a file called top_level.txt that is installed alongside Python eggs that says what top-level modules or packages are installed.

packaging.python.org does not list top_level.txt as a file that is to be created and added to dist-info. However when I manually inspect dependencies inside of site-packages, I haven't run across a case yet where that file doesn't exist.

Question

In short, where and when is this file created?

I've observed that it always seems to exist when I install a package (either in .egg-info or .dist-info), but is this a pattern I can expect to generally be the case?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source