Whats the purpose of package.egg-info folder?

2024/9/22 13:41:19

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?

Answer

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.

https://en.xdnf.cn/q/71943.html

Related Q&A

Implement Causal CNN in Keras for multivariate time-series prediction

This question is a followup to my previous question here: Multi-feature causal CNN - Keras implementation, however, there are numerous things that are unclear to me that I think it warrants a new quest…

How to decode a numpy array of dtype=numpy.string_?

I need to decode, with Python 3, a string that was encoded the following way:>>> s = numpy.asarray(numpy.string_("hello\nworld")) >>> s array(bhello\nworld, dtype=|S11)I tri…

Cosine similarity of word2vec more than 1

I used a word2vec algorithm of spark to compute documents vector of a text. I then used the findSynonyms function of the model object to get synonyms of few words. I see something like this: w2vmodel.f…

Handling empty case with tuple filtering and unpacking

I have a situation with some parallel lists that need to be filtered based on the values in one of the lists. Sometimes I write something like this to filter them:lista = [1, 2, 3] listb = [7, 8, 9] f…

pip3 install pyautogui fails with error code 1 Mac OS

I tried installing the autogui python extension:pip3 install pyautoguiAnd this installation attempt results in the following error message:Collecting pyautoguiUsing cached PyAutoGUI-0.9.33.zipComplete …

BERT get sentence embedding

I am replicating code from this page. I have downloaded the BERT model to my local system and getting sentence embedding. I have around 500,000 sentences for which I need sentence embedding and it is t…

Python Subversion wrapper library

In Subversions documentation theres an example of using Subversion from Python#!/usr/bin/python import svn.fs, svn.core, svn.reposdef crawl_filesystem_dir(root, directory):"""Recursively…

How to convert a selenium webelement to string variable in python

from selenium import webdriver from time import sleep from selenium.common.exceptions import NoSuchAttributeException from selenium.common.exceptions import NoSuchElementException from selenium.webdriv…

Why are session methods unbound in sqlalchemy using sqlite?

Code replicating the error:from sqlalchemy import create_engine, Table, Column, Integer from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmakerBase = declarative…

Combining Tkinter and win32ui makes Python crash on exit

While building a basic app using the winapi with Python 2.7 (Im on Windows 8.1), I tried to add a small Tkinter gui to the program. The problem is, whenever I close the app window, Python crashes compl…