requirements/openstack_requirements
Stephen Finucane a968919ebe Allow backports to have arbitrary python_version markers
There are a number of backport packages in place for packages in stdlib
that are still evolving. One such package is 'importlib-metadata' which
is a backport of 'importlib.metadata'. The README [1] for this package
shows a mapping of versions of the 'importlib-metadata' third party
library to versions of stdlib 'importlib.metadata':

  importlib_metadata  stdlib
  4.8                 3.11
  4.4                 3.10
  1.4                 3.8

A project may want to use a shiny new feature only found in the Python
3.11 stdlib version while continuing to support Python 3.8, 3.9 and
3.10. If so, they could specify something like so:

  importlib-metadata>=4.8;python_version<3.11

Meanwhile, other packages might require features found in the Python
3.10 stdlib version. They would want to specify something like so:

  importlib-metadata>=4.4;python_version<3.10

Currently this is not possible as it is not possible to specify
arbitrary 'python_version' markers. Since 'importlib-metadata' does not
have a 'python_version' marker in 'global-requirements.txt' (not since
change I5febaed02e95ff27accd946abc32f3bcbb1a5ead anyway), both projects
would have to specify

  importlib-metadata>={required_version}

Which means they'll use importlib-metadata even where they don't need
it.

Fix this issue by allowing a list of particular modules to specify a
project-specific 'python_version' marker. Currently this list only
includes 'importlib-metadata', but in the future we may wish to enhance
it to include other rolling backport libraries (e.g. mock).

[1] https://pypi.org/project/importlib-metadata/

Change-Id: I85501b4bff97d1c1e1873c3329ef998a8e501134
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2022-08-02 19:07:10 +10:00
..
cmds Updated from generate-constraints 2021-08-09 09:29:24 -05:00
tests Replace assertItemsEqual with assertCountEqual 2021-05-23 17:14:44 +09:00
__init__.py Move tests into openstack_requirements. 2015-06-08 22:07:01 +12:00
check.py Allow backports to have arbitrary python_version markers 2022-08-02 19:07:10 +10:00
constraints.py Add check for prerelease and further clean up error message. 2019-01-29 15:34:07 -06:00
project.py Fix the warning to read the configuration file. 2020-01-16 15:28:22 +01:00
project_config.py Update project-config validation 2017-10-25 12:22:43 +00:00
requirement.py mark regex as regex for pycodestyle 2019-12-13 23:17:32 -06:00