Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

Open source licensing by the numbers

Open source licensing by the numbers

A look at how GitHub users license their code (or in all practicality, don’t)

Ben Balter

July 22, 2015
Tweet

More Decks by Ben Balter

Other Decks in Technology

Transcript

  1. ! Open source licensing by the numbers A look at

    how GitHub users license their code (or in all practicality, don’t) @BenBalter [email protected]
  2. Roadmap 1. Why do we care about open source licensing?

    2. How the GitHub licensing API works 3. The numbers
  3. ! Open Source (software)
 software that can be freely used,

    modified, and shared (in both modified and unmodified form) by anyone help.github.com/articles/github-glossary/#open-source
  4. ! Open Source
 a philosophy of collaboration in which working

    materials are made available online for anyone to fork, modify, discuss, and contribute to.
  5. ‣ There’s a bajillion different options ‣ Every discussion results

    in a holy war ‣ Open source licensing isn’t taught in law school ‣ Devs today grew up in a world in which open source has won
  6. ! What’s necessary to license a project? ‣ LICENSE file

    with the full text of the license ‣ LICENSE file with the license name or abbreviation ‣ README which links to the full license text ‣ README which references the license ‣ Human readable references within a file ‣ Machine-readable package manager config file Halp? github.com/licensee/issues/4
  7. ! Licensee has 4 matching “strategies” 1. Copyright matcher 2.

    Exact matcher 3. Git matcher 4. Levenshtein matcher
  8. license = Licensee.license "/path/to/a/project" => #<Licensee::License name="MIT" match=0.9842154131847726> license.key =>

    "mit" license.name => "MIT License" license.meta["source"] => "http://opensource.org/licenses/MIT" license.meta["description"] => "A permissive license that is short and to the point. It lets people do anything with your code with proper attribution and without warranty." license.meta["permitted"] => ["modifications","distribution","sublicense","private-use"] Ruby
  9. [ { "key": "agpl-3.0", "name": "GNU Affero General Public License

    v3.0", "url": "https://api.github.com/licenses/agpl-3.0", "featured": false }, { "key": "apache-2.0", "name": "Apache License 2.0", "url": "https://api.github.com/licenses/apache-2.0", "featured": true }, ... $ curl -H 'Accept: application/vnd.github.drax-preview+json' \ https://api.github.com/licenses
  10. $ curl -H 'Accept: application/vnd.github.drax-preview+json' \ https://api.github.com/licenses/mit { "key": "mit",

    "name": "MIT License", "url": "https://api.github.com/licenses/mit", "featured": true, "html_url": "http://choosealicense.com/licenses/mit/", "description": "A permissive license that is short and to the point. It lets people do anything with your code with proper attribution and without warranty.", "category": "MIT", "implementation": "Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file. Replace [year] with the current year and [fullname] with the name (or names) of the copyright holders.", "required": [ "include-copyright" ], "permitted": [ "commercial-use", "modifications", "distribution",
  11. { "id": 12325212, "name": "gman", "full_name": “benbalter/gman", ... "license": {

    "key": "mit", "name": "MIT License", "url": "https://api.github.com/licenses/mit", "featured": true }, ... "network_count": 38, "subscribers_count": 5 } $ curl -H 'Accept: application/vnd.github.drax-preview+json' \ https://api.github.com/repos/benbalter/gman
  12. ! Audit your org’s 
 open source license usage $

    curl -H 'Accept: application/vnd.github.drax-preview+json' \ https://api.github.com/orgs/github/repos
  13. 5 apache-2.0 1 bsd-3-clause 2 cc0-1.0 1 gpl-2.0 56 mit

    12 other curl -s -H 'Accept: application/vnd.github.drax-preview+json' \ ‘https://api.github.com/orgs/github/repos?per_page=100' | \ grep -A1 '"license"' | grep '"key"' | cut -d'"' -f4 | \ sort | uniq -c h/t @mislav
  14. #!/bin/bash set -e { ruby -rbundler -e 'puts Bundler.load.specs.map(&:gem_dir)' ls

    -d node_modules/* bower_components/* } | while read dir; do echo -n "${dir##*/}: " licensee "$dir" | grep 'License:\|Unknown' | sed 's/License: //' done Audit all project dependencies h/t @mislav
  15. minitest-5.4.2 : Unknown thread_safe-0.3.4 : no license tzinfo-1.2.2 : MIT

    License activesupport-4.1.6 : MIT License coderay-1.1.0 : Unknown ffi-1.9.10 : BSD 3-clause "New" or "Revised" License levenshtein-ffi-1.1.0 : Unknown rugged-0.23.0b4 : MIT License licensee : MIT License method_source-0.8.2 : MIT License slop-3.6.0 : MIT License pry-0.10.1 : MIT License ruby-prof-0.15.1 : BSD 2-clause "Simplified" License shoulda-context-1.2.1 : MIT License shoulda-matchers-2.7.0: MIT License shoulda-3.5.0 : MIT License bundler-1.6.9 : MIT License Audit all project dependencies
  16. A couple of caveats ‣ Only looking at public repos

    ‣ Only looking at non-fork repos ‣ Only looking at non-spammy users ‣ Excludes some edge cases like Project GITinberg ‣ I’m terrible at math (at even worse at MySQL)
  17. ! Forks Pull Requests Stars 0 27.50% 14.97% 13.71% 1-100

    35.60% 35.83% 25.44% 101-500 64.26% 63.76% 64.58% 501-1000 72.11% 73.34% 72.31% 1000+ 69.43% 77.05% 77.23% Percent licensed by use
  18. ! Open source licensing by the numbers A look at

    how GitHub users license their code (or in all practicality, don’t) @BenBalter [email protected]