def get_package_release_from_pypi(pkg_name, version, pypi_json_api_url, allowed_classifiers):
matching_releases = get_package_releases_matching_version(pkg_name, version, pypi_json_api_url)<EOL>src_releases = [release for release in matching_releases if release['<STR_LIT>'] == '<STR_LIT:source>']<EOL>if src_releases:<EOL><INDENT>return select_src_release(src_releases, pkg_name, target_classifiers=('<STR_LIT>',), select_arbitrary_version_if_none_match=True)<EOL><DEDENT>if allowed_classifiers:<EOL><INDENT>return select_src_release(matching_releases, pkg_name, target_classifiers=allowed_classifiers)<EOL><DEDENT>raise PypiQueryError('<STR_LIT>'.format(pkg_name, version))<EOL>
No classifier-based selection of Python packages is currently implemented: for now we don't fetch any .whl or .egg
Eventually, we should select the best release available, based on the classifier & PEP 425: https://www.python.org/dev/peps/pep-0425/
E.g. a wheel when available but NOT for tornado 4.3 for example, where available wheels are only for Windows.
Note also that some packages don't have .whl distributed, e.g. https://bugs.launchpad.net/lxml/+bug/1176147