License Guide for Device Classes

From SweepMe! Wiki
Jump to: navigation, search

To make sure that uploaded Device Classes can be used and modified for the widest variety of devices possible, the Device Classes should be published under the terms of the MIT License. That way, everyone can use your Device Class, adapt it for similar devices and functionality, or redistribute it. You will still be the author / copyright holder and the copyright notice is required to be included in every copy or substantial potion of your work. However, you also need to pay attention to the license of of other work you might use in your Device Class.


  • This is just a short overview which cannot cover the depth and variety of all licenses.
  • When using code from others, always respect their copyright and their license which must be adhered to.
  • Ask the authors and copyright holders when uncertain about the licenses.

Choice of a License for Device Classes

  • MIT License is one of the most often used Open Source Licenses.
  • Author retains copyright and attribution is required in all redistributed copies or substantial potions of the work.
  • Highly compatible license, can be combined with a variety of work with other licenses. This is a big advantage over licenses with strong copyleft (like GPL). Device Classes regularly need to be combined with proprietary libraries from the hardware manufacturer which is impossible with GPL code (but allowed with MIT licensed code).

Own Work

Written from Scratch

  • For code that has been written completely by yourself or your team, you are the copyright holder and can license this work under the terms of the MIT License without any problems.

Based on another MIT licensed Device Class

  • As the MIT License allows modifications and redistributions, you are allowed to create your Device Class based on another one.
  • The original copyright notice must still be present, i.e. the original authors must be attributed.
  • In the header of the file, you can add a second copyright line.
  • In the upload form, you need to list all authors, the original ones, your name, and the names of all authors in your team (if any).

Based on the template from the Device Class Assistant

  • The code that is created by the Device Class Assistant is provided under the terms of the MIT License. The same items as for MIT licensed Device Classes from other contributors apply.

Third-Party Libraries and Tools


  • When including third-party libraries, you must make sure that this is allowed (usually true for open source licenses).
  • The third-party library or tool will then be redistributed within the Device Class Package with its original license (no relicensing).
  • Only your own work will be MIT licensed.
  • For clarity and separation, third-party work should be placed in a separate subdirectory.

Permissive Licenses and Licenses with Weak Copyleft

  • E.g. MIT, BSD, Apache license
  • Can be redistributed with its original license and attribution in a subdirectory.
  • If you only use a library ("import <module>" in Python) without modifying or redistributing that library, you do not have any obligations for common permissive licenses.

Licenses with Strong Copyleft

  • E.g. GPL
  • Combined work is fully required to be licensed under GPL, making it incompatible with all proprietary code (like libraries for the hardware communication from the manufacturer) or even other open source licenses.
  • Your code is already "infected" by the GPL copyleft when importing such a module in Python.
  • Due to that problem, strong copyleft licenses should be avoided. Luckily, this license is rarely used for hardware related code and libraries (probably because of this issue).

Libraries and Tools without Redistribution Permissions

  • Contact the original authors and copyright holders and ask for a redistribution permission. This permission must not only grant you the right to redistribute, but also a permission to publish the library together with the Device Class on is necessary.
  • If your request is denied or unanswered, you must not include the library in the Device Class Package!
  • When this library is mandatory, provide instructions to the end user how to obtain this library (e.g. from the driver setup of the hardware).
  • To prevent a crash of the measurement, the Device Class should check for the presence of the required library.

Quick Chart

The following table gives an overview of what to do if you use or distribute libraries with various licenses in your Device Class. This summary does not replace reading and understanding the various licenses and may be incorrect. This table assumes that you do not modify the used library but use and redistribute an unmodified version.

MIT BSD PSF Apache LGPL GPL Commercial / Unknown
Use, but no redistribution (for modules already included in SweepMe!) nothing to do nothing to do nothing to do nothing to do nothing to do not allowed supply information on how to obtain the library, as the Device Class would not work without
Use and redistribution add original license to redistributed library add original license to redistributed library add original license to redistributed library add original license to redistributed library add original license to redistributed library, the user must be able to replace the LGPL library with his own library version/code add original license to redistributed library, your own code must also be GPL, no commercial libraries or libraries with GPL-incompatible licenses must be used ask the author / copyright holder for permission and include that permission

Modifications of Third-Party Code

  • If third-party code is a MIT licensed Device Class or template from another contributor or the Device Class Assistant, see above.
  • Otherwise, modifications of third-party libraries should be avoided and actually should not be necessary.
  • If such a modification is inevitable, you must make sure that this is allowed and the resulting derivative work (which in most cases will have the same license as the original work) is then treated similar to a third-party library.

Best Practices for Device Classes

Own Code

  • For your own code and your modifications of other MIT licensed Device Classes (from other contributors or the Device Class Assistant).
  • Place a copyright notice and the MIT License as a comment in the header of all your code files.
  • There is no need to include a separate license.txt file as the upload process will automatically generate this file (and overwrite any existing license.txt).
  • In the upload form, specify the year and all authors that contributed to the Device Class. If the Device Class was based on another MIT licensed work (like another Device Class or a template from the Device Class Assistant), all authors of this work have to be included, as well.

Third-Party Code

  • Verify that you are allowed to redistribute the third-party work and that the license permits a combination with your MIT licensed work.
  • It is recommended to place all third-party libraries and tools in a separate subdirectory each. This supports the structure of your Device Class and also satisfies the separation requirement of most open source licenses with weak copyleft, as the subdirectory could be easily exchanged by the user.
  • Include all required files (including licenses and other copyright notices). Do not place a third-party library license with the name license.txt in the main directory (where the is) of the Device Class, as this file will be overwritten during the upload process.
  • If you are not allowed to redistribute the third-party library, include a check in the __init__ function of your Device Class if the library is present and inform the user if not (including instructions how to obtain the library).