python - generate wheel

安装

1
$ pip3 install wheel setuptools

创建 setup.py

1
2
3
4
5
6
7
from setuptools import setup

setup(
name='abtest',
version='1.0',
packages=['.abtest'],
)

setup.py 示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import os.path

from setuptools import setup

REQUIREMENTS = 'requirements.txt'
requires = []
if os.path.isfile(REQUIREMENTS):
with open(REQUIREMENTS, 'r') as f:
requires = f.read().splitlines()

# VERSION i.e. 1.3
with open('VERSION', 'r') as f:
v = f.read()
setup(
name='abtest',
version=v.strip(),
packages=['abtest', 'data', 'model', 'utils'], # 指定 package
install_requires=requires # 指定依赖基本版本
)

打包工程

1
python setup.py bdist_wheel --universal