我正在尝试创建一个 sdist,我可以将其上传到 PyPI,然后用户可以成功安装 pip。有问题的项目是https://github.com/ratt-ru/CubiCal,我已经有一个 sdist 上传到 PyPI ( https://pypi.org/project/cubical/ )。文档在这里。
该项目使用 Cython。根据Cython 的文档,分发 Cython 代码的正确方法是捆绑 cythonize 生成的 .c 和 .cpp 文件,我目前正在这样做。
问题在于,两者pip install cubical都pip install path/to/sdist安装了软件包,但没有正确构建和链接扩展。也就是说,不会生成 .so 文件,因此安装的包无法导入其 Cython 模块。我知道 setup.py 脚本在从源代码构建时可以工作(例如 git 克隆存储库、cythonizing 扩展并运行pip install -e CubiCal/)。
总之,如何更改 setup.py 脚本以确保从 sdist 安装时正确处理扩展?
设置.py:
import os
import sys
import glob
import cubical
from setuptools import setup, find_packages
from setuptools.extension import Extension
from setuptools.command.build_ext import build_ext
from setuptools import …Run Code Online (Sandbox Code Playgroud)