setup.py 2.04 KB
Newer Older
BO ZHANG's avatar
BO ZHANG committed
1
2
import setuptools

BO ZHANG's avatar
BO ZHANG committed
3
# 读取README.md作为长描述
4
5
with open("README.md", "r") as f:
    long_description = f.read()
BO ZHANG's avatar
BO ZHANG committed
6

7
# 读取依赖列表requirements.txt
BO ZHANG's avatar
BO ZHANG committed
8
# 忽略#开头或者版本号不明确指定的条目
9
with open("requirements.txt", "r") as f:
BO ZHANG's avatar
BO ZHANG committed
10
11
12
13
14
    requirements = [
        req.strip()
        for req in f.readlines()
        if not req.startswith("#") and req.__contains__("==")
    ]
15
16

# 配置、安装
BO ZHANG's avatar
BO ZHANG committed
17
setuptools.setup(
BO ZHANG's avatar
BO ZHANG committed
18
19
20
21
22
23
24
25
    name="csst_proto",  # 包名
    version="0.0.1",  # 版本号
    author="Bo Zhang",  # 作者
    author_email="bozhang@nao.cas.cn",  # 邮箱
    description="The CSST L1 pipeline - prototype",  # 短描述
    long_description=long_description,  # 长描述
    long_description_content_type="text/markdown",  # 长描述类型
    url="https://csst-tb.bao.ac.cn/code/csst-l1/csst_proto",  # 主页
BO ZHANG's avatar
BO ZHANG committed
26
    packages=setuptools.find_packages(where="."),  # 用setuptools工具自动发现带有__init__.py的包
BO ZHANG's avatar
BO ZHANG committed
27
28
29
30
31
32
33
34
35
36
    license="MIT",  # 证书类型
    classifiers=[  # 程序分类, 参考 https://pypi.org/classifiers/
        # How mature is this project?
        #   3 - Alpha
        #   4 - Beta
        #   5 - Production/Stable
        "Development Status :: 3 - Alpha",
        "Intended Audience :: Science/Research",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
BO ZHANG's avatar
BO ZHANG committed
37
        "Programming Language :: Python :: 3",
BO ZHANG's avatar
BO ZHANG committed
38
39
40
        "Topic :: Scientific/Engineering :: Physics",
        "Topic :: Scientific/Engineering :: Astronomy",
    ],
BO ZHANG's avatar
BO ZHANG committed
41
42
    include_package_data=True,  # 设置包含随包数据
    package_data={  # 具体随包数据路径
BO ZHANG's avatar
BO ZHANG committed
43
44
        "csst_proto": ["data/*"],
    },
BO ZHANG's avatar
BO ZHANG committed
45
46
    # 请注意检查,防止临时文件或其他不必要的文件被提交到仓库,否则会一同安装
    python_requires=">=3.11",  # Python版本要求
47
    install_requires=requirements,
BO ZHANG's avatar
BO ZHANG committed
48
    ext_modules=[  # 如果有随包的C代码,需要在这里定义扩展
BO ZHANG's avatar
BO ZHANG committed
49
        setuptools.Extension(
BO ZHANG's avatar
BO ZHANG committed
50
51
            name="csst_proto.cext.helloworld",
            sources=["cextern/helloworld.c"],
BO ZHANG's avatar
BO ZHANG committed
52
        )
BO ZHANG's avatar
BO ZHANG committed
53
54
    ],
)