Skip to main content

A tool to analyze the compatibility of licenses in a project.

Project description

Liscopelens

A graph-driven license compatibility analyzer for software projects. Liscopelens detects license conflicts by propagating obligations through dependency graphs and checking compatibility using a knowledge base of license rules.

Features

  • Graph-driven analysis: Models software dependencies as graphs for accurate obligation propagation
  • Scope-aware compatibility: Handles conditional compatibility based on usage context (static/dynamic linking, etc.)
  • Configuration-driven: Customize propagation rules for your build system and legal interpretation
  • Library API: Integrate license analysis into your toolchain programmatically
  • 150+ licenses: Built-in knowledge base covering common open-source licenses

Installation

pip install liscopelens

Quick Start

CLI Usage

The CLI entrypoint is liscopelens and expects a project_path first:

Basic analysis (GN + ScanCode):

liscopelens /path/to/project clang \
  --gn-file /path/to/gn.json \
  --scancode-file /path/to/scancode.json \
  --output out

With custom configuration (.toml):

liscopelens /path/to/project clang \
  --gn-file /path/to/gn.json \
  --scancode-file /path/to/scancode.json \
  --output out \
  -c custom.toml

Inspect results (TUI):

# "project_path" is required by the CLI but not used by `inspect`; "." is fine.
liscopelens . inspect out

Rebuild the license compatibility knowledge base:

liscopelens kb --rebuild

Use liscopelens --help for all available options.

Library API Usage

Check compatibility between two licenses:

from liscopelens.api import check_license_compatibility

result = check_license_compatibility("MIT", "GPL-3.0-only")
print(result["compatibility"])  # 0 = UNCONDITIONAL_COMPATIBLE
print(result["message"])

Analyze a project's license compatibility:

from liscopelens.api import check_compatibility
from liscopelens.utils import GraphManager

license_map = {
    "//src/main.c": "GPL-3.0-only",
    "//lib/helper.c": "MIT",
}

graph = GraphManager()
graph.add_node(graph.create_vertex("//src/main.c", type="code"))
graph.add_node(graph.create_vertex("//lib/helper.c", type="code"))
graph.add_edge(graph.create_edge("//src/main.c", "//lib/helper.c", label="deps"))

context, results = check_compatibility(license_map, graph)

Override license detection and ignore specific conflicts:

context, results = check_compatibility(
    license_map,
    graph,
    file_shadow={"//lib/crypto.c": "Apache-2.0"},      # Override detected license
    license_shadow={"GPL-3.0-only": ["OpenSSL"]}       # Ignore specific conflicts
)

Prerequisites (CLI)

For CLI usage with C/C++ projects, generate input files first:

  1. GN Dependency Graph:

    gn gen out/Default --ide=json
    
  2. Scancode License Report:

    scancode -l -c --json-pp scancode.json /path/to/project
    

Documentation

Document Description
Design Philosophy System design, graph-driven propagation, and configuration philosophy
Library API Reference Public Python API, input formats, and end-to-end examples
Configuration Guide Full config reference, enums, and precise behavioral semantics
Reproduction Dataset and reproduction steps for the case study

Output

With --output out, the clang pipeline writes:

  • out/propagated.json: graph after obligation propagation
  • out/compatible_checked.json: graph after compatibility checking
  • out/results.json: conflict groups and involved nodes/licenses

License

Apache License, Version 2.0. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

liscopelens-0.2.18.tar.gz (94.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

liscopelens-0.2.18-py3-none-any.whl (178.8 kB view details)

Uploaded Python 3

File details

Details for the file liscopelens-0.2.18.tar.gz.

File metadata

  • Download URL: liscopelens-0.2.18.tar.gz
  • Upload date:
  • Size: 94.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.7 Windows/11

File hashes

Hashes for liscopelens-0.2.18.tar.gz
Algorithm Hash digest
SHA256 412474890359492b2cac37fae4b8e6703dcdf6cf241bc2e543824884db0e0eed
MD5 0fe4711dea5de251aef8ca49f2613b0d
BLAKE2b-256 753bb1e039fc03627c5c2f9b2b43d20c15e4d7221c6a684deb39078ca56d0ab7

See more details on using hashes here.

File details

Details for the file liscopelens-0.2.18-py3-none-any.whl.

File metadata

  • Download URL: liscopelens-0.2.18-py3-none-any.whl
  • Upload date:
  • Size: 178.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.7 Windows/11

File hashes

Hashes for liscopelens-0.2.18-py3-none-any.whl
Algorithm Hash digest
SHA256 8945d080319dfe8f9557f8d38a0a791848b7103d91ecc1d1d1fb39f8ecf2a252
MD5 76134f002997e3be13114305ac5fdcd8
BLAKE2b-256 19735479491331bbef7c8d6bbf2e2ecb1797b15321e7666bce410c9cc991b0bc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page