(extras_require)
Convert requirements from a setup()-style dictionary to ('Requires-Dist', 'requirement')
    and ('Provides-Extra', 'extra') tuples.

    extras_require is a dictionary of {extra: [requirements]} as passed to setup(),
    using the empty extra {'': [requirements]} to hold install_requires.
Convert requirements from a setup()-style dictionary to ('Requires-Dist', 'requirement')
    and ('Provides-Extra', 'extra') tuples.
Convert requirements from a setup () - style dictionary to ( Requires - Dist requirement ) and ( Provides - Extra extra ) tuples .
def generate_requirements(extras_require):
    """
    Convert requirements from a setup()-style dictionary to ('Requires-Dist', 'requirement')
    and ('Provides-Extra', 'extra') tuples.

    extras_require is a dictionary of {extra: [requirements]} as passed to setup(),
    using the empty extra {'': [requirements]} to hold install_requires.
    """
    for extra, depends in extras_require.items():
        condition = ''
        extra = extra or ''
        if ':' in extra:  # setuptools extra:condition syntax
            extra, condition = extra.split(':', 1)

        extra = pkg_resources.safe_extra(extra)
        if extra:
            yield 'Provides-Extra', extra
            if condition:
                condition = "(" + condition + ") and "
            condition += "extra == '%s'" % extra

        if condition:
            condition = ' ; ' + condition

        for new_req in convert_requirements(depends):
            yield 'Requires-Dist', new_req + condition
def generate_requirements ( extras_require ) : for extra , depends in extras_require . items ( ) : condition = '' extra = extra or '' if ':' in extra : # setuptools extra:condition syntax extra , condition = extra . split ( ':' , 1 ) extra = pkg_resources . safe_extra ( extra ) if extra : yield 'Provides-Extra' , extra if condition : condition = "(" + condition + ") and " condition += "extra == '%s'" % extra if condition : condition = ' ; ' + condition for new_req in convert_requirements ( depends ) : yield 'Requires-Dist' , new_req + condition