Copyright and licences
Proprietary and open source software, common licences, and Creative Commons.
Do this lesson in the simulatorSoftware is protected by copyright, so using someone else's code means following the licence they released it under. The licence says what you may do: run it, read it, change it, share it, sell it. This lesson covers the kinds of licence, what open source really means, and how to check whether a use is allowed.
Proprietary software
Proprietary (closed source) software is owned by a company that keeps the source code secret. You buy a licence to use it, not the software itself.
- It is usually supported, tested and documented by the company.
- You cannot see or change how it works, you must accept its terms, and you depend on the company continuing it.
Open source software
Open source software comes with its source code, and a licence that lets anyone read, change and share it.
- Anyone can fix it, adapt it, or learn from it; it is usually free of charge; it is not tied to one company.
- Support may be from volunteers, quality varies, and some licences demand that anything you build on it is shared the same way.
Python itself is open source, and so is the code behind these lessons' simulator.
| Proprietary | Open source | |
|---|---|---|
| Source code | secret | published |
| Change it? | no | yes, under the licence |
| Cost | usually paid | usually free |
| Support | from the company | community, or paid separately |
Reading a licence
Common software licences, roughly from most to least permissive:
- MIT: do almost anything, including selling it, as long as you keep the copyright notice.
- GPL: you may change and share it, but anything you distribute built on it must also be open source under the GPL. This is called copyleft.
- Proprietary / All rights reserved: only what the company's terms allow.
For pictures, music and writing, Creative Commons licences do the same job. CC BY means use it with credit; CC BY-NC adds "not commercially"; CC BY-SA adds "share your version the same way".
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
# what each licence allows: (may change it, may sell it, must share changes)
LICENCES = {"MIT": (True, True, False), "GPL": (True, True, True), "All rights reserved": (False, False, False)}
for name, (change, sell, share) in LICENCES.items():
print(f"{name}: change={change} sell={sell} must share changes={share}")
Doing it properly
- Check the licence before using code, images, music or fonts in your work.
- Keep the credit the licence asks for, in the code and in the finished product.
- Never paste code from the web into work you hand in without saying where it came from: in a controlled assessment it is also academic malpractice.
- Releasing your own work? Choosing a licence tells others what they may do.
Task: may I use it?
Write allowed(licence, use) that returns True or False for a proposed use, given LICENCES where each entry is (may change, may sell, must share changes). A use of "change" needs may change; "sell" needs may sell; "use as is" is always allowed. For each (licence, use) in requests, print <licence> / <use>: yes or : no. If the licence is not in LICENCES, print <licence> / <use>: unknown licence. At the end print allowed: <n> of <total>.
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
# licence: (may change, may sell, must share changes)
LICENCES = {"MIT": (True, True, False), "GPL": (True, True, True), "All rights reserved": (False, False, False)}
requests = [
("MIT", "change"),
("MIT", "sell"),
("GPL", "change"),
("All rights reserved", "change"),
("All rights reserved", "use as is"),
("CC BY", "sell"),
]
Challenges
- Add a message for GPL saying changes must be shared.
- You build a program on GPL code and want to sell it without sharing your source. What does the licence say?
- Find the licence of a program you use. What does it let you do?