【问题标题】:Is there a way to publish multiplatform wheels on PyPI with same version number?有没有办法在 PyPI 上发布具有相同版本号的多平台轮子?
【发布时间】:2019-11-16 01:26:06
【问题描述】:

我正在尝试将 Cython 包装的 C++ 模块作为轮子部署到 PyPI。目标是让 I2C 硬件模块在任何 Raspberry Pi 上与 Python 一起工作。到目前为止,我编译了代码,我知道如果我只是将编译的模块从运行 Buster 的 Pi 3B 复制到运行 Stretch 的 Pi 零 W,但是当我将轮子从 Buster 部署到 test.pypi.org 并尝试将其安装在 Stretch 上时,它可以工作我明白了:

Could not find a version that satisfies the requirement pyiArduinoI2Crelay (from versions: )
No matching distribution found for pyiArduinoI2Crelay

如果我只是将轮子从 *_armv7l.whl 重命名为 *_armv6l.whl 模块下载并在 Pi Zero 上工作。但是 Pi 3B 从 PyPI 下载以前的版本(我使用了 --no-cache-dirrm -r .cache/pip/

如果我执行 sdist 并上传它,它会抱怨在安装模块时没有安装 Cython,尽管我知道它已安装,因为它与我之前编译的轮子是同一个 Pi。 (setup_requires 和 install_requires 似乎不起作用)

到目前为止,这些都没有帮助:

https://www.python.org/dev/peps/pep-0425/#platform-tag https://packaging.python.org/guides/distributing-packages-using-setuptools/#platform-wheels https://wheel.readthedocs.io/en/stable/user_guide.html#building-wheels Prepare C-based Cython package to publish on pypi

这是项目的链接:

https://github.com/tremaru/pyiArduinoI2Crelay

这里是 setup.py:

from setuptools import setup
from distutils.extension import Extension
from Cython.Build import cythonize
from Cython.Distutils import build_ext

def readme():
        with open('README.md') as readme:
                return readme.read()

setup(name='pyiArduinoI2Crelay',
        version='1.6.4.dev8',
        description='iarduino.ru module for Raspberry Pi',
        long_description=readme(),
        classifiers=[
                'Programming Language :: Python :: 3',
        ],
        url='http://github.com/tremaru/pyiArduinoI2Crelay',
        author='iarduino.ru',
        author_email='shop@iarduino.ru',
        license='MIT',
        package=['pyiArduinoI2Crelay'],
        ext_modules = [Extension(
                name="pyiArduinoI2Crelay",
                sources=["pyiArduinoI2Crelay/pyiArduinoI2Crelay.cpp"])],
        include_package_data=True,
        python_requires='>=3',
        setup_requires=['Cython'],
        install_requires=['Cython'],
        cmdclass = {
                "build_ext": build_ext
        }
)

我希望能够为所有 Raspberries 发布一个版本的模块。那么,有没有办法将多个 .so 打包到一个轮子上?或者可能是某种用于 arm 架构的 manylinux1 标签?

【问题讨论】:

    标签: raspberry-pi cython pypi platform python-wheel


    【解决方案1】:

    原来我是个傻瓜。生成 cpp 文件后,我的设置中不需要任何 Cython 的东西。我需要做的就是删除 Cython 的东西并删除 cmdclass = { "build_ext": build_ext }。然后在发布和构建作为源分发没有问题。

    【讨论】:

      猜你喜欢
      • 2017-01-30
      • 2019-04-26
      • 2023-03-14
      • 2020-03-09
      • 1970-01-01
      • 2013-07-11
      • 2018-03-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多