Let's say I'm making a library called X, which has a dependency on requests (which is under the Apache 2.0 license). For X's setup.py, I declare the following:

setup(
    ...
    install_requires=[
        'requests>=2.19.1',
         ...
    ]
)

Now obviously, I understand that the terms of the Apache License state that I need to include the license, state changes, include copyright, etc. However, since I'm not exactly including the dependency myself (the end user installs it when running pip install X), does this really apply?

In addition, taking the example of requests itself, I notice that it has numerous dependencies, but no licenses seem to be included in the repository itself. Other libraries follow similar practices (not including their dependencies' licenses).

Do I need to include the licenses for dependencies declared in a setup.py?

  • A license is only needed for copying and/or redistributing code. For example, if you developed a program that depends on Microsoft Windows, you would be able to distribute your program to others without ever agreeing to any Microsoft license. Of course, if a third party downloads and installs your program, they may out of technical necessity need to install Windows in order to use your program, and to do that legally they must agree to Microsoft's license(s) in order to install Windows. – Brandin Sep 20 at 7:08
up vote 4 down vote accepted

No, you do not need to include licenses for code that isn't part of your repository.

However, as a service to your users, you can consider mentioning the licenses of your dependencies in the documentation. For this service, it is sufficient to have something along the lines of

This library uses the requests library, which is distributed under the Apache 2.0 license.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.