FOSSLight Reuse

License Current python package version. REUSE status

FOSSLight Reuse is a tool that can be used to comply with the copyright/license writing rules in the source code using reuse-tool.

Github Repository :
License : GPL-3.0-only


๐Ÿ“‹ Prerequisite

FOSSLight Reuse needs a Python 3.6+.

๐ŸŽ‰ How to install

It can be installed using pip3.
It is recommended to install it in the python 3.6 + virtualenv environment.

$ pip3 install fosslight_reuse

๐Ÿš€ How to run

FOSSLight Reuse has 3 modes as following:

  1. lint โ€” Check whether the source code's copyright and license writing rules are complied with.
  2. convert โ€” Convert oss-pkg-info.yaml to FOSSLight-Report.xlsx and vice versa.
    • It converts oss-pkg-info.yaml to SRC Sheet of FOSSLight Report or
    • BIN (Android) and BOM Sheet of FOSSLight Report to oss-pkg-info.yaml.
  3. add โ€” Add copyright and license to source code which is missing copyright and license
fosslight_reuse [Mode] [option1] <arg1> [option2] <arg2>...

How to run by mode & Parameters

  • Required parameter : Mode
  • Optional parameter : Options
    lint                  Check REUSE compliance
    convert               Convert oss_pkg_info.yaml <-> FOSSLight-Report
    add                   Add missing license and copyright
    -h                    Print help message
    -p <path>             Path to check
    -f <file1,file2,..>   List of files to check
    -o <file_name>        Output file name
    -n                    Don't exclude venv*, node_modules, and .*/ from the analysis
Options for only 'add' mode
    -l <license>          License name(SPDX format) to add
    -c <copyright>        Copyright to add(ex, 2015-2021 LG Electronics Inc.)

(Only for Windows) Run using executable file
1. Download fosslight_reuse_windows.exe from FOSSLight Reuse - Release.
2. Move the executable file to the path where oss-pkg-info.yaml file or FOSSLight-OSS-Report.xlsx file is located.
3. Double-click the executable file to run it.

๐Ÿ“ Result

๐Ÿ”– lint mode

1) Analyze for specific folder

(venv)$ fosslight_reuse lint -p /home/test/reuse-example -o result.xml
  • Result
      # SUMMARY
      # Open Source Package info: File to which OSS Package information is written.
      # Used licenses: License detected in the path.
      # Files with copyright information: Number of files with copyright / Total number of files.
      # Files with license information: Number of files with license / Total number of files.
      * Open Source Package info: /home/test/reuse-example/
      * Used licenses: CC-BY-4.0, CC0-1.0, GPL-3.0-or-later
      * Files with copyright information: 6 / 7
      * Files with license information: 6 / 7 

2) Analyze for specific files

(venv)$ fosslight_reuse lint -p /home/soimkim/test/reuse-example -f "src/load.c,src/dummy.c,src/main.c"
  • Result
          # src/load.c
          * License:
          * Copyright: SPDX-FileCopyrightText: 2019 Jane Doe <>
          # src/dummy.c
          * License:
          * Copyright:
          # src/main.c
          * License: GPL-3.0-or-later
          * Copyright: SPDX-FileCopyrightText: 2019 Jane Doe <> 
Demo Video (lint) demo video for lint mode

๐Ÿ”– convert mode

1) Convert all oss-pkg-info.yaml or oss-pkg-info.yml in the path recursively.

$ fosslight_reuse convert -p /home/test/source

2) Convert FOSSLight Report to oss-pkg-info.yaml

$ fosslight_reuse convert -f src/FOSSLight-Report.xlsx

3) Result file example

Open Source Software Package:
    - name: glibc
    version: 2.3
    - GPL-3.0
    - LGPL-2.1
    file : 
    - a.c
    - b.c
    - name : dbus
    version : 1.3
    source :
    license : GPL-2.0
    file : src/*
    copyright : |
        Copyright (c) 2020 Test
        Copyright (c) 2020 Test
    - name : reuse-tool
    source :
    homepage :
    license : MIT
    copyright: Copyright (c) 2020 Test
    - name : build-tool
    source :
    license : Apache-2.0
    exclude : True

FOSSLight Report

Demo Video (convert)

demo video for convert mode

๐Ÿ”– add mode

1) Add copyright and license to file(s) in the input path

(venv)$ fosslight_reuse add -p tests/add -c "2019-2021 LG Electronics Inc." -l "GPL-3.0-only"

2) Add copyright and license to input file(s)

(venv)$ fosslight_reuse add -f "tests/add/,tests/add/,tests/add/,tests/add/" -c "2019-2021 LG Electronics Inc." -l "GPL-3.0-only"

3) Result โ–ช๏ธ Changes in the file - Added copyright or license at the top of the file

Before After
Before After
    # File list that have both license and copyright : 3 / 7
    * License:
    * Copyright:

    * License: GPL-3.0-only
    * Copyright: SPDX-FileCopyrightText: Copyright 2019-2021 LG Electronics Inc.

    * License: MIT
    * Copyright: SPDX-FileCopyrightText: Copyright (c) 2011 LG Electronics Inc.

    # Missing license File(s)
    * Your input license : GPL-3.0-only
    Successfully changed header of tests/add_result/

    # Missing Copyright File(s)
    * Your input Copyright : Copyright 2019-2021 LG Electronics Inc.
    Successfully changed header of tests/add_result/
Demo Video (add) demo video for add mode

๐Ÿ” How it works

๐Ÿ”– lint mode

  1. Find a OSS Package Information file.
    Check if at least one of the following files exists (case-free)
    • oss-pkg-info.yaml
    • oss-pkg-info.yml
    • requirement.txt
    • requirements.txt
    • package.json
    • pom.xml
    • build.gradle
    • Podfile.lock
    • Cartfile.resolved
    • File started with "MODULE_LICENSE_ "
  2. Run fsfe-reuse lint
    2-1. When running on a project basis. (without -f parameter)
    • If there is no ./reuse/dep5 file in the Root Path, it is created.
    • If it already exists, copy it to bk file and append the default config value to the existing dep file.
    • By creating dep5 files, exclude binary or .json, venv /, node_modules/,. */ from reuse.
    • Run fsfe-reuse lint (If the OSS Package Information file exists, the list of missing license files is not printed.)
    • Recover to existing dep5-related file if it originally existed, delete if it doesn't exist.

    2-2. When executing in file unit (with -f option)

    • Print the copyright text and license text extraction by file.
    • However, if the file does not exist or the file is binary or .json, copyright text and license text are not printed.
  3. Print the execution result and save it in xml format.

๐Ÿ”– convert mode

  1. Check if there is an OSS Package Information or FOSSLight Report file.
  1. Convert oss-pkg-info.yaml file โ†” FOSSLight Report
    2-1. When running on a project basis. (without -f option)
    • Convert all files in the path (oss-pkg-info.yaml file โ†” FOSSLight Report)

    2-2. When running in file unit (with -f option)

    • Convert the input file (oss-pkg-info.yaml โ†” FOSSLight-Report.xlsx)
    • However, if an output file name is specified with -o, a result file is created with that name.

๐Ÿ”– add mode

  1. Confirm to add copyright and license to missing file
  2. Add copyright and license to missing file(s) using -c and -l option
    • Print file list that both has copyright and license(excluded from Adding)
    • Add input copyright and license to missing file(s) using -c and -l option