Search code examples
pythonpython-3.xsetuptoolslicensingpython-wheel

setuptools warning: Failed to find the configured license file 'L'


I am building a wheel using python setup.py bdist_wheel Basically setuptools library.

My project contains LICENSE.txt file in root directory of the repository.

Aim:

Properly include this particular license file in the wheel

Relevant Code:

setup(
...,
license_files='LICENSE.txt',
...
)

Error:

warning: Failed to find the configured license file 'L'
warning: Failed to find the configured license file 'C'
warning: Failed to find the configured license file 'N'
warning: Failed to find the configured license file 't

Solution

  • https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html#metadata

    Setuptools official doc states the datatype of license_file to be "str" and license_files to be list-comma

    Solution 1: Use license_file with str

    setup(
    ...,
    license_file='LICENSE.txt',
    ...
    )
    

    Solution 2a: Use license_files with comma separated list

    setup(
    ...,
    license_file=LICENSE.txt,
    ...
    )
    

    Solution 2b setup.cfg with license_files

    I instead created a new file setup.cfg and upgraded my setuptools to allow it to pick up metadata from setup.cfg

    [metadata]
    license_files = <name-of-license-file>
    

    Thanks to: https://stackoverflow.com/a/48691876/5157515 enter image description here