Generates an :class:`~pip._internal.req.req_install.InstallRequirement`.

    Create an InstallRequirement from the supplied metadata.

    :param name: The requirement's name.
    :type name: str
    :param version: The requirement version (must be pinned).
    :type version: str.
    :param extras: The desired extras.
    :type extras: list[str]
    :param markers: The desired markers, without a preceding semicolon.
    :type markers: str
    :param constraint: Whether to flag the requirement as a constraint, defaults to False.
    :param constraint: bool, optional
    :return: A generated InstallRequirement
    :rtype: :class:`~pip._internal.req.req_install.InstallRequirement`

def make_install_requirement(name, version, extras, markers, constraint=False):
    """
    Generates an :class:`~pip._internal.req.req_install.InstallRequirement`.

    Create an InstallRequirement from the supplied metadata.

    :param name: The requirement's name.
    :type name: str
    :param version: The requirement version (must be pinned).
    :type version: str.
    :param extras: The desired extras.
    :type extras: list[str]
    :param markers: The desired markers, without a preceding semicolon.
    :type markers: str
    :param constraint: Whether to flag the requirement as a constraint, defaults to False.
    :param constraint: bool, optional
    :return: A generated InstallRequirement
    :rtype: :class:`~pip._internal.req.req_install.InstallRequirement`
    """

    # If no extras are specified, the extras string is blank
    from pip_shims.shims import install_req_from_line

    extras_string = ""
    if extras:
        # Sort extras for stability
        extras_string = "[{}]".format(",".join(sorted(extras)))

    if not markers:
        return install_req_from_line(
            str("{}{}=={}".format(name, extras_string, version)), constraint=constraint
        )
    else:
        return install_req_from_line(
            str("{}{}=={}; {}".format(name, extras_string, version, str(markers))),
            constraint=constraint,
        )