admin管理员组

文章数量:1414879

I have a Python package with two variations: a CPU-only, and a GPU-enabled build. I would like to distribute both versions on PyPI, where users could maybe do something like the following (it doesn't have to be this exact syntax, as long as its reasonably easy to work with for users, it's OK):

pip install mypkg-cpu for the CPU-only build,

pip install mypkg for the GPU-enabled build.

Users must be able to have the same import statements in Python regardless of which version they have downloaded.

I've thought about maybe using versioning for this purpose. At least in the past, PyTorch seemed to take this approach: pip install torch==1.9.0+cpu. However, I'm worried about a case where another package starts depending on my package, and in their requirements, they have something like mypackage>=1.23 -- would that dependency be satisfied by mypackage==1.23+cpu?

本文标签: pythonHow to distribute multiple variations of a package on PyPIStack Overflow