How to specify collection versions in requirements.yml that are compatible with my versions of ansible/python

How to install collections that are compatible with the version of ansible-core and python in my EE container.

IIRC, for a python requirements.txt file you can specify a python module version restriction that is compatible with the version of python used to install the module.

I am looking for the same type of functionality (if it exists) to limit the versions of collections installed using the collections\requirements.yml file.

I know I can specify limits on a collection version with:

---
collections:
  - name: foo.bar
    version: ">=2.2.0,<3.0.0"

This will install newest version of foo.bar that is less than version 3.

Is there a way to have ansible-galaxy also limit a collection version to what is compatible with the version of ansible-core and python that is installed in the container? For instance:

collections:
  - name: foo.bar
    version: ">=2.2.0,<3.0.0,ansible=2.15,python=3.9"

This doesn’t work but should illustrate my point.

Follow-on question. How do you keep track of what collection versions are compatible with your version of Ansible and Python?

Thank you!