简体   繁体   中英

How to organize wheels as pypi distributions in order to ensure compatibility

I'm developing a python package which uses f2py to compile a couple of FORTRAN modules. When porting it to Windows, I've realized using a source distribution to upload it to pypi would not be an option thanks to windows not possessing any default compiler with which it's shipped. Therefore, I'm going to produce machine-specific wheels in order to upload them to PyPi.

My questions are: 1. Should I specify the code as OS specific on setup.py before building each bdist_wheel, in order to identify which distribution pip should fetch when installing for a certain machine? Or should I leave it as os independent? 2. Can I upload both wheels as the same distribution to pypi? If so, how can I do it? Will just

twine upload dist/*

Work?

So, I've done my research about the topic, which I'll explain briefly below. Hope it helps any other beginner with the same question.

On package platform compatibility specifications for pip and PyPi

My question was essentially: "can I still set classifiers=['Operating System:: OS Independent'] for a PyPi package on setup.py even if what I'm doing with setup.py is generating OS-specific.whl distributions?"

The answer is yes. classifiers argument should contain information on compatibility to be displayed for the user on PyPi or other distributing service, but it doesn't affect compatibility for individual machine-specific wheels and should reflect the package in general.

Checking setup.py file for scipy, for example, we get:

CLASSIFIERS = """A :: Bunch :: Of :: Other :: Non-OS related info
    Operating System :: Microsoft :: Windows
    Operating System :: POSIX
    Operating System :: Unix
    Operating System :: MacOS"""

The OS compatibility of a wheel distribution checked when installed via pip - which effectively limits your wheel's compatibility to different operational systems - is set rather by information specified within the wheel itself, based on your host system when compiling for itself or for a guest specified for wheel by option --platform-name , such as when using cross compilation for wheels between Windows machines .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM