[Distutils] Idea: Using Trove classifiers for platform compatibility warnings

Nick Coghlan ncoghlan at gmail.com
Fri Apr 7 22:17:25 EDT 2017


PyPI already has a reasonably extensive component tagging system in
https://pypi.python.org/pypi?%3Aaction=list_classifiers but we don't
really *use* it all that much for programmatic purposes.

That means the incentives for setting tags correctly are weak, since
there isn't much pay-off in the form of tooling-intermediated
communication of constraints and testing limitations to end users.

What I'm starting to wonder is whether or not it may make sense to
start recommending that installation tools emit warnings in the
following cases:

1. At least one "Operating System" tag is set, but the tags don't
include any that cover the *current* operating system
2. At least one "Programming Language :: Python" tag is set, but the
tags don't include any that cover the *current* Python version

The "at least one relevant tag is set" pre-requisite would be to avoid
emitting false positives for projects that don't provide any platform
compatibility guidance at all.

Instead, the goal would be to eliminate the cases where *incorrect*
guidance is currently provided - no guidance at all would be fine,
correct guidance would be fine, but incorrect guidance would result in
install time warnings on nominally unsupported platforms.

Checking for applicable tags at run time would then be a matter of
defining two things:

- for a given platform, figure out the list of applicable tags that
indicate compatibility
- for a given platform, figure out the list of applicable tags that
indicate *in*compatibility

I'm bringing this idea up now as it came up twice for me this week:

- in my current work project, where even though the project itself is
pure Python, we're manipulating Linux containers and local VM
hypervisors, so I put a "Operating System :: POSIX :: Linux" tag on it
- in a discussion of using absolute paths in "data_files" where it can
be an entirely reasonable thing to do, as long as you're OK with
making the affected library or application platform specific:
https://github.com/pypa/python-packaging-user-guide/pull/212#issuecomment-292686566

It's also quite applicable to some of the enhancements Daniel would
like to make to the wheel format to support more of the GNU autotools
paths (https://www.gnu.org/prep/standards/html_node/Directory-Variables.html),
which become a lot more palatable if there's a defined machine
readable way of saying "Hey, this project assumes POSIX directory
layout conventions" (which would be to set "Operating System :: POSIX"
or one of it's more specific variants, given the definitions above).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Distutils-SIG mailing list