python egg
1. install egg packages
- python setup.py bdist_egg
*add directors
-project_directoty
-dist
-build
2. project files
*files archietacture
-project_directoty
-setup.py
-module_name
--__init__.py
--demo.py
###setup.py###
from setuptools import setup, find_packages
setup(
name="project_name",
version="0.1",
packages=find_packages(),
zip_safe=False,
description="demo egg",
long_description="demo egg.",
author="una",
license="GPL",
# keywords=("test", "egg"),
platforms="Independant",
url="",
)
################
3. package project to egg
- [...] python setup.py bdist_egg
-project_directoty
-dist
--xxx.egg
4. install egg to others project
- [...] easy_install xxx.egg
===================================================
***notice when import def issue
installs egg then import def:
- situation 1: You do not set others.
- from module_name.module_name import demo
- situation 2: The init file adds the import.
- from module_name import demo
### project_directoty/module_name/__init__.py ###
from module_name import demo
################
### project_directoty/module_name/demo.py ###
def hello():
print('Hello.')
################
留言
張貼留言