What's the purpose of package.egg-info folder?

Viewed 528

I'm developing a python package foo. My project structure looks like this:

.
├── foo
│   ├── foo
│   │   ├── bar.py
│   │   ├── foo.py
│   │   ├── __init__.py
│   ├── README.md
│   └── setup.py
├── footest
│   ├── test.py

test.py only has 1 line: import foo

In order for test.py to be able to import the package foo I install it with the command pip3 install -e foo.

Now a new folder called foo.egg-info is created under foo/

.
├── foo
│   ├── foo
│   │   ├── bar.py
│   │   ├── foo.py
│   │   ├── __init__.py
│   ├── foo.egg-info
│   │   ├── dependency_links.txt
│   │   ├── PKG-INFO.txt
│   │   ├── requires.txt
│   │   ├── SOURCES.txt
│   │   ├── top_level.txt
│   ├── README.md
│   └── setup.py
├── footest
│   ├── test.py

What's the purpose of this folder? I tried deleting it and test.py still ran properly. Is is just leftover garbage, similar to the .o files when compiling C projects? If so, is there a way to automatically remove it?

1 Answers

The package.egg-info saves meta data about your installed package like version. It is used when you for example uninstall it, or "pip list" to see what is installed.

you can open it and take a look.

Related