this post was submitted on 05 Jul 2026
16 points (94.4% liked)

Open Source

48162 readers
94 users here now

All about open source! Feel free to ask questions, and share news, and interesting stuff!

Useful Links

Rules

Related Communities

Community icon from opensource.org, but we are not affiliated with them.

founded 7 years ago
MODERATORS
 

Say I'm writing a small GPLv3 licensed Python script that I want to release publicly. It would use a few MIT licensed libraries and maybe also some chunks of code from some MIT licensed projects.

As per the MIT license conditions I would have to include the MIT license text in my project. So how would that be done properly? And how about other licenses that require the license text to be included?

Sorry if this has already been answered a million times. I'm relatively new to this stuff and I find the licenses really hard to understand despite my attempts. I tried to also use some other open source projects as examples, but most of them don't seem to include the license texts anywhere but the readme files at least seem to state which libraries they use.

top 9 comments
sorted by: hot top controversial new old
[–] frongt@lemmy.zip 8 points 3 weeks ago (1 children)

There's no formal system. If you put the lib in its own dir, just keep its license intact. If you have to put it alongside your own stuff, you can create a LICENSE-libname.txt file, or have one long LICENSE.txt file with your license at the top, then include each library name and its license, or whatever makes sense in your project that will satisfy the license requirements.

[–] bluewhale_@lemmy.ml 1 points 3 weeks ago

Right, I guess the licenses don't typically give exact instructions on where to put it etc and the requirements can be met in multiple ways. I guess I'm just too stuck trying to understand what's the typical way people do these things in their projects. :'D

[–] jeena@piefed.jeena.net 3 points 3 weeks ago (1 children)

Normally you would have in each file a license header and depending on which license the file ia it would have a different header if the licenses are mixed.

Often we don't copy the library source code into the same git repo but use some package manager which installs them for the user.

In that case if the whole git repo is the same license then often we just have a LICENSE file in the root which ia mentioned in the readme.

Back in the day we made https://github.com/Pelagicore/OpenSourceTemplates

It has links to SPDX descriptions ect which are best practices in this regard.

[–] bluewhale_@lemmy.ml 1 points 3 weeks ago

Thanks! So if I simply use pip to get some libraries for my project, do I need to include the licenses (e.g. MIT) somewhere in my source code?

How about if I statically link them by building a executable that contains everything in a single file, so the user doesn't have to install Python and all the libraries separately?

[–] Ephera@lemmy.ml 3 points 3 weeks ago (1 children)

More of a general tip: https://reuse.software/ can help to get this stuff right.

Pretty sure, it won't be able to help with your use-case of copy-pasting code snippets, though (it's not at all trivial to know which parts you copy-pasted), but it gives you a structure to work with and can automatically annotate new source files.

[–] bluewhale_@lemmy.ml 2 points 3 weeks ago

Okay thanks, this seems informative! I'll take a closer look when I have time.

[–] Marija@lemmy.zip 1 points 3 weeks ago

I believe it's better to be explicit from day one.

[–] leviathan@feddit.org 0 points 3 weeks ago* (last edited 3 weeks ago) (1 children)
[–] bluewhale_@lemmy.ml 1 points 3 weeks ago

Thanks! I had not found this resource before.