lark-parser / lark

Lark is a parsing toolkit for Python, built with a focus on ergonomics, performance and modularity.
MIT License
4.77k stars 404 forks source link

Standalone license clarification #1255

Open LynnKirby opened 1 year ago

LynnKirby commented 1 year ago

A generated standalone parser contains the user's dumped grammar data plus code extracted from Lark which is otherwise under the MIT license. Given that, how is the generated parser licenced as MPL-2.0?

MegaIng commented 1 year ago

The standalone generator is not under MIT, but under MPL-2.0. It also generates extra code inside the resulting file that is not from anywhere else in Lark. So while the file includes code that was MIT, the resulting file is not MIT.

LynnKirby commented 1 year ago

In that case the result should be MIT and MPL-2.0 (unless all contributors have agreed to dual licence their code).

Regardless, it seems odd to licence the generator this way considering it would be trivial to create your own version that does the exact same thing.

MegaIng commented 1 year ago

Whether or not contributors agree doesn't matter, since MIT allows relicensing this way without problems.

Yeah, you can create a tool that does this. I wouldn't call it trivial. Make sure to not copy any code from the standalone tool. Check #247 and #507 for discussions as to why it's not MIT

LynnKirby commented 1 year ago

MIT allows sublicencing, which is not the same thing as completely replacing the license.

Just to be clear, I have no problem with the MPL (in fact the project I am evaluating Lark for will be MPL anyways). I just want to ensure the license situation is crystal clear.

MegaIng commented 1 year ago

The only problem I see that might exists is that the generated standalone file potentially should contain the MIT license notice, although it wouldn't apply to code. But also, since erezsh is the copyright holder (and for sure still has a larger majority of the codebase as his solo creation), the terms of the MIT license don't have to apply to this anyway.

I am not a legal expert, I am basing it on the discussion here: https://opensource.stackexchange.com/questions/5832/relicensing-an-mit-licensed-project-under-the-gpl-that-has-non-code-contribution

LynnKirby commented 1 year ago

For info from a lawyer, see Lawrence Rosen's Open Source Licensing ch. 5, page 87 (https://www.rosenlaw.com/oslbook.htm).

the generated standalone file potentially should contain the MIT license notice

That sounds about right.

MegaIng commented 1 year ago

Just to be clear:

Right?

So the only remaining question is whether or not the license text for MIT needs to be included in the generated file. It doesn't apply to the file. So what is the point of it being included? My argument here is that erezsh is the copyright owner and can therefore give it out under a different license without respecting this term of the MIT license. But maybe this is wrong.

LynnKirby commented 1 year ago

We are sublicensing not relicensing

The user could sublicence the MIT part of the generated code. The Lark developers could sublicence the MIT part of Lark source code and distribute it as MIT and MPL-2.0 from now on. But simply using the generator doesn't sublicence the result since it's a mechanical process, not a person.

We don't need to have the resulting file also be under MIT license

The conditions of the license can't be removed. For example, a hypothetical sublicensable 2-clause BSD could be sublicensed directly as 3-clause BSD because the conditions are only being extended. However MIT requires the license text to be distributed which is an additional condition on top of MPL-2.0.

My argument here is that erezsh is the copyright owner and can therefore give it out under a different license without respecting this term of the MIT license.

There are multiple contributors and (as far as I know) no agreement to transfer copyright to erezsh so this isn't the case.

ethindp commented 1 year ago

Wouldn't the MPL conflict with the MIT license? The MIT license is extremely permissive, whereas the MPL is not. And the MIT license is not on the list of secondary licenses as defined in the MPL (the MPL only lists the GPL and LGPL).