How to declare a python package as incompatible with a specific platform or architecture?

Where this has come up in other topics recently, it’s been pointed
out that some projects with this particular need work around the
problem by only publishing platform-specific wheels to PyPI (no
sdists, nor pure-Python wheels). This prevents installation on
unsupported platforms, but doesn’t necessarily provide the user with
a clear explanation. It also, for actual pure-Python projects, means
publishing a bunch of redundant wheels that have the same contents
with different filenames.

In the case of a pure-Python application like ansible-lint which may
be at least nominally runnable, another popular solution is to
detect the platform at runtime and report a user-friendly error
message (of course it’s not so friendly that the user has gotten all
the way through installing to running it before discovering they
didn’t pay attention to any big bold warnings in the project’s
documentation).

This lacking feature is also yet another example of how Python
packages are not really well adapted for application distribution,
but rather more focused on solving library dependency needs with the
unspoken assumption that installing an application is going to
happen some other way (e.g. from a curated distribution like an app
store, or perhaps a container image, where coupling to the platform
is more clearly indicated).

5 Likes