def get_ireq_version(ireq):
    """
    Get version of a requirement even if it's editable.

    :type ireq: InstallRequirement|str
    """
    if not ireq.req or not ireq.specifier or not ireq.specifier._specs:
        return None

    specs = (x._spec for x in ireq.specifier._specs)
    versions = set(
        version for (op, version) in specs
        if (op == '==' or op == '===') and not version.endswith('.*'))
    good_versions = ireq.specifier.filter(versions, prereleases=True)
    return next(iter(good_versions), None)