yash-rs icon indicating copy to clipboard operation
yash-rs copied to clipboard

Using yash-syntax to create a nushell-posix plugin

Open phreed opened this issue 5 months ago • 5 comments

Mostly letting you know that your library is being used to make nushell more posix aware. https://github.com/phreed/nushell-posix

phreed avatar Jul 03 '25 18:07 phreed

I have a question about the Licensing.

I see that yash-syntax is GPLv3 and nushell is https://github.com/nushell/nushell?tab=MIT-1-ov-file#readme

The https://github.com/phreed/nushell-posix is a plug-in.

So, I think I can make the plug-in GPLv3 which satisfying the yash-syntax license requirement.

The nushell guys seem to think that would not work for them.

I see that 'yash-syntax' is a library in 'yash-rs'.

Could the 'yash-syntax' library be release under LGPLv3 rather than GPLv3?

I think that would allow it to be used in the plugin without contaminating the MID license of nushell.

Here is what the Gemini LLM has to say on the subject:

==========================================

You've hit upon a common point of confusion when mixing open-source licenses, particularly when a copyleft license like GPLv3 is involved with a permissive license like MIT.

Here's a breakdown of why the Nushell developers might be concerned and what the general understanding is:

Understanding the Licenses

MIT License: This is a very permissive license. It allows you to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software with very few restrictions. The main requirement is that you include the original copyright and license notice. Crucially, it does not require derivative works (or works that incorporate MIT-licensed code) to be open-sourced under the same or a compatible license. You can use MIT-licensed code in proprietary (closed-source) projects.

GPLv3 (GNU General Public License v3): This is a strong copyleft license. It's designed to ensure that all modifications and derivative works of GPL-licensed software remain free and open source under the GPL. If you distribute software that incorporates GPLv3-licensed code, the entire combined work (including your code) must also be licensed under GPLv3. This is often referred to as the "viral" nature of the GPL, meaning it "infects" other code it touches in a distributed work.

The Plugin Scenario

The key question is how "tightly coupled" the plugin is to the main application.

Tightly Coupled / Derivative Work: If your nushell-posix plugin is considered a derivative work of Nushell (meaning it relies heavily on Nushell's internal structure, uses its specific APIs in a way that suggests direct modification or extension, or is loaded into the same process and shares data structures extensively), then distributing your GPLv3 plugin along with Nushell would likely trigger the GPLv3's copyleft clause. This would mean that the entire combined work, including Nushell itself, would need to be distributed under GPLv3. This is almost certainly what the Nushell developers want to avoid, as it would force their MIT-licensed project to become GPLv3, limiting its flexibility for users who want to create proprietary extensions or integrate it into closed-source systems.

Separate Work / Loose Coupling: If the plugin interacts with Nushell more like a separate application (e.g., through inter-process communication like sockets, command-line arguments, or standard input/output), and doesn't directly modify or integrate deeply with Nushell's core code in a way that would make it a "derivative work," then you might be able to license the plugin as GPLv3 without forcing Nushell to be GPLv3. However, the interpretation of what constitutes a "separate work" can be legally ambiguous and is often a point of contention with copyleft licenses.

Why Nushell Developers are Concerned

The Nushell project is MIT licensed, which is very permissive. This allows a wide range of uses, including commercial and proprietary applications. If a GPLv3 plugin were to be distributed in a way that "infects" Nushell, it would drastically change the licensing terms for Nushell users, forcing them to open-source their entire project if they distribute it. This goes against the core philosophy of a permissive license like MIT.

Your Options and Considerations

Licensing the Plugin Permissively: The simplest way to avoid any conflict and align with the Nushell project's goals would be to license your nushell-posix plugin under a permissive license (like MIT, Apache, or BSD) that is compatible with both Nushell (MIT) and Yash-syntax (GPLv3).

MIT is compatible with GPLv3: You can incorporate MIT-licensed code into a GPLv3 project. The MIT portion would still carry its MIT license notice, but the combined work would be distributed under GPLv3. However, the reverse is not true without the "viral" effect taking hold.

Understanding "Distribution": The GPL's requirements primarily kick in when you distribute the software. If you're using the GPLv3 plugin for personal use and not distributing it, the GPL's obligations are less stringent. However, if you're distributing a combined work (Nushell + your plugin), then the licensing becomes critical.

Consulting Legal Counsel: For definitive answers on licensing compatibility and the interpretation of "derivative works" in specific scenarios, especially when dealing with distribution, it's always best to consult with a lawyer specializing in open-source licensing. This is a complex area, and interpretations can vary.

In summary, while MIT-licensed code can be incorporated into a GPLv3 project, the GPLv3's copyleft nature means that if your GPLv3 plugin is considered a derivative work of Nushell (or tightly coupled with it), the entire distribution including Nushell would be subject to GPLv3. The Nushell developers' concern is understandable, as this would alter the fundamental terms of use for their permissive MIT-licensed project.

phreed avatar Jul 07 '25 16:07 phreed

If yash-syntax (GPLv3) were released under (LGPLv3) and the nushell plugin library (MIT) are used in the the plugin, under what license could I release the plugin?

=== Gemini =============================

This is a much better scenario! If yash-syntax were released under LGPLv3 instead of GPLv3, the licensing implications for your Nushell plugin change significantly and become much more flexible.

Here's the breakdown:

The Licenses Involved:

  • yash-syntax (LGPLv3): This is a weak copyleft license for libraries. It means that if you modify the yash-syntax code itself and distribute it, those modifications must remain LGPLv3. However, critically, it allows other software to link to and use the LGPLv3 library without requiring that other software to adopt the LGPLv3 or GPLv3.
  • Nushell Plugin's "own code" (MIT): This is a highly permissive license. It allows almost any use, including incorporating it into proprietary projects, as long as the original license text is included.

How They Interact in Your Plugin:

  • Your Plugin uses yash-syntax (LGPLv3):

    • Since yash-syntax is LGPLv3, you can use it in your plugin.
    • If your plugin links to yash-syntax (dynamically or even statically, provided you meet the LGPLv3's terms for static linking, which often involves providing object files or build instructions), your plugin's own code does not have to become LGPLv3.
    • You must still fulfill the LGPLv3's requirements for yash-syntax:
      • Include a copy of the LGPLv3 license.
      • Provide clear notice that yash-syntax is used under LGPLv3.
      • Ensure users can obtain the source code of yash-syntax and, if they modify it, can swap out their modified version for the one your plugin uses.
  • Your Plugin uses Nushell (MIT):

    • MIT is extremely permissive. You can incorporate MIT-licensed code into your plugin, and it places no restrictions on the license of your plugin itself, other than requiring you to retain the MIT license notice for the Nushell portions.

Under What License Can You Release the Plugin?

Given yash-syntax is LGPLv3 and Nushell is MIT, and assuming your plugin is primarily using these libraries (rather than directly modifying and distributing the core of yash-syntax as part of your plugin's source code in a way that makes your code a derivative of yash-syntax in a fundamental sense), you have several viable options for your plugin's license:

  • MIT License: You can license your plugin under the MIT License. This is often the preferred choice when working with permissive upstream licenses like Nushell's, as it maintains maximum flexibility for users of your plugin. You would need to:
    • Include the LGPLv3 license for yash-syntax.
    • Include the MIT license for Nushell (and attribute Nushell as required by its license).
    • Include your plugin's MIT license.
    • Ensure all LGPLv3 requirements are met for yash-syntax (especially the linking/modifiability clauses).
  • LGPLv3 License: You could also choose to license your plugin as LGPLv3. This would be a valid choice.
    • This might be chosen if you want your own contributions to the plugin to also benefit from the LGPL's "weak copyleft" for future users.
    • All MIT-licensed components (Nushell parts) are compatible with LGPLv3 and would retain their MIT license, but the combined work would be under LGPLv3.

Recommendation:

If yash-syntax is LGPLv3 and Nushell is MIT, the most harmonious and flexible licensing choice for your nushell-posix plugin would be MIT License. This respects the permissive nature of Nushell and correctly handles the LGPLv3 dependency by fulfilling its requirements without "infecting" your plugin or Nushell with a stronger copyleft.

phreed avatar Jul 07 '25 16:07 phreed

If I understand correctly, nushell's plugins are separate executables invoked by nushell. In that case, the "Separate Work / Loose Coupling" scenario applies. Since nushell itself does not depend on or derive from anything in your plugin or yash-syntax, nushell cannot be a Derivative Work of them, so it can remain under the MIT license.

magicant avatar Jul 08 '25 15:07 magicant

Which license is yash-syntax GPLv3 or LGPLv3? (Obviously yash is GPLv3) In the former case there is probably no issue, in the latter there is definitely no issue.

phreed avatar Jul 08 '25 18:07 phreed