I"m new to Python and I"m just trying to understand how its packages work. Presumably
eggs are some sort of packaging mechanism, but what would be a quick overview of what role they play and may be some information on why they"re useful and how to create them?
Same concept as a
.jar file in Java, it is a
.zip file with some metadata files renamed
.egg, for distributing code as bundles.
A "Python egg" is a logical structure embodying the release of a specific version of a Python project, comprising its code, resources, and metadata. There are multiple formats that can be used to physically encode a Python egg, and others can be developed. However, a key principle of Python eggs is that they should be discoverable and importable. That is, it should be possible for a Python application to easily and efficiently find out what eggs are present on a system, and to ensure that the desired eggs" contents are importable.
.eggformat is well-suited to distribution and the easy uninstallation or upgrades of code, since the project is essentially self-contained within a single directory or file, unmingled with any other projects" code or resources. It also makes it possible to have multiple versions of a project simultaneously installed, such that individual programs can select the versions they wish to use.
.egg file is a distribution format for Python packages. It‚Äôs just an alternative to a source code distribution or Windows
exe. But note that for pure
.egg file is completely cross-platform.
.egg file itself is essentially a
.zip file. If you change the extension to ‚Äú
zip‚Äù, you can see that it will have folders inside the archive.
Also, if you have an
.egg file, you can install it as a package using
To create an
.egg file for a directory say
mymath which itself may have several python scripts, do the following step:
# setup.py from setuptools import setup, find_packages setup( name = "mymath", version = "0.1", packages = find_packages() )
Then, from the terminal do:
$ python setup.py bdist_egg
This will generate lot of outputs, but when it‚Äôs completed you‚Äôll see that you have three new folders: build, dist, and mymath.egg-info. The only folder that we care about is the dist folder where you"ll find your
mymath-0.1-py3.5.egg with your default python (installation) version number(mine here: 3.5)
Source: Python library blog
ig Data applications are growing very rapidly around the globe. This new approach to decision making takes into account data gathered from multiple sources. Here my goal is to show how these diverse s...
Topics on Big Data are growing rapidly. From the first 3 V’s that originally characterized Big Data, the industry now has identified 42 V’s associated with Big Data. The list of how we characteriz...
Shabbir Challawala has over 8 years of rich experience in providing solutions based on MySQL and PHP technologies. He is currently working with KNOWARTH Technologies. He has worked in various PHP-base...
The role of adaptation, learning and optimization are becoming increasingly essen- tial and intertwined. The capability of a system to adapt either through modification of its physiological structure ...