I wrote a Python script (a .py file) that I'd like to publish and license correctly. My script imports

  • numpy (3-clause BSD)
  • matplotlib.pyplot (Matplotlib license [BSD-compatible])
  • os and argparse (PSF Version 2).

I did not modify any of those modules; I want to publish the .py file only (no binaries).

I'd like to license my script with as little restrictions as possible but of course without violating any licenses.

  • To my (limited) understanding of the above mentioned licenses, and comparing my question to this one, I can license my script under 3-clause BSD OR MIT (both would be fine by me) without violating any licenses. Is that correct?
  • Do I have to include any text of licenses of the imported modules anywhere in my script? I am under the impression that I do not have to include any.

This might seem like an easy question to answer, but searching the web and the module's web pages, I could not find an answer that wasn't too technical.

(Since English is not my native language I have some trouble understanding license texts. I never published any software and I am neither a software engineer nor a lawyer, so I am unfamiliar with technical/legal terms, for example (but not limited to) what counts as 'distributing' software.)

Edit: According to this diagram, MIT is incompatible with BSD. So if I am restricted by the licenses of the software modules I am importing, then I cannot choose MIT if I import BSD software.

1 Answer 1


I did not modify any of those modules; I want to publish the .py file only (no binaries).

If you will not be including copies of numpy and Matplotlib, then you need not concern yourself with their permissive licenses. Neither license imposes restrictions on derivative works such as your script.

To see this, let's start by walking through the BSD license:

Copyright [year] [someone]

This is a standard line indicating that [someone] published this in [year] and they own the copyright. It doesn't make very much legal difference in practice, because that is already the default state of affairs anyway. Under modern law, nearly everywhere on Earth, copyright automatically vests the moment you save a file to your hard drive. A notice such as this does provide a few ancillary legal benefits (such as making it harder for infringers to claim they did not realize the file was copyrighted), but it does not cause the file to become copyrighted, because that is automatic.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

What you are doing (probably) qualifies as "use," so it is permitted if you follow the remaining instructions.

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Inapplicable. You don't plan on redistributing source code. All the source code you will distribute is original.

  1. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Inapplicable. You don't plan on distributing binaries at all.

  1. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

Inapplicable. You have not indicated that you plan to do that.

[A warranty disclaimer in ALL CAPS]

This basically just means "don't sue us if the code causes a problem." You should probably include a similar disclaimer in your publication.

Now, let's do the MIT license:

Copyright [year] [someone]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

This is a bit more explicit than the BSD license, but it clearly grants you permission for the things you want to do.

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Again, you're not distributing a copy or substantial portion of the library, so this does not apply to you.

[Another warranty disclaimer]

Finally, we come to the PSF license, which is slightly longer, but ultimately it comes down to the same legal analysis we've seen twice already: You are not doing anything which would trigger any of the specific requirements of the license.

TL;DR: You can distribute your script under whatever terms you choose. If you want to package numpy or Matplotlib with your script, then you need to include their licenses, but they do not "infect" the rest of your distribution.

  • Thank you for your answer! Not only was it very helpful and very detailed, but it was also the answer I was hoping for: I can distribute my script under whatever terms I choose, perfect!
    – Grond
    Nov 30, 2020 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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