Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

OSLiLi - Open Source License Identification Library

Open Source License Identification Library is an experimental code, that use Scikit-learn to implement a Multinomial Naive Bayes classifier trained with SPDX data to identify Open Source Licenses. This should be consider as a proof of concept for identify Open Source licenses using Machine Learning.

This is an experimental project, please don't use it for production. For a more robust implementation, please check the project Askalono https://github.com/jpeddicord/askalono

Usage

On the command line

You can use OSLiLi in your terminal as command line, please install the oslili-cli package:

$ pip3 install oslili-cli
$ oslili-cli LICENSE
License: MIT (0.89 probability)
Copyright: ('2021', '(c)  Andrew Barrier')

As a library

In order to use the library, you need to import and use identify_license or identify_copyright.

import argparse
from oslili import LicenseAndCopyrightIdentifier


def main():
    msg = 'Identify open source license and copyright statements'
    parser = argparse.ArgumentParser(description=msg)
    parser.add_argument('file_path', help='Path to the file to analyze')
    args = parser.parse_args()
    file_path = args.file_path

    with open(args.file_path, 'r') as f:
        text = f.read()

    identifier = LicenseAndCopyrightIdentifier()
    license_spdx_code, license_proba = identifier.identify_license(text)
    print(f'License: {license_spdx_code} ({license_proba:.2f} probability)')
    year_range, statement = identifier.identify_copyright(text)
    if statement:
        if None not in statement:
            print(f'Copyright: {statement}')


if __name__ == '__main__':
    main()

Notice

This tool does not provide legal advice; I'm not a lawyer.

The code is an experimental implementation to match your input to a database of similar license texts and tell you if it's a close match. Refrain from relying on the accuracy of the output of this tool.

Remember: The tool can't tell you if a license works for your project or use case. Please should seek independent legal advice for any licensing questions.

Where do the licenses come from?

License SPDX dataset is sourced directly from SPDX: https://github.com/spdx/license-list-data.

Datasets for ML training were generated scanning different sources, and inspired by two academic publications:

Contributing

Contributions are very welcome! See CONTRIBUTING for more info.

License

This library is licensed under the Apache 2.0 License.

Metadata

Release files for oslili 0.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oslili 0.15
File Size Uploaded Provenance Actions
oslili-0.15.tar.gz 911.6 kB Without provenance Details for oslili-0.15.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for oslili 0.15
File Interpreter ABI Platform Actions
oslili-0.15-py3-none-any.whl Python 3 none any Details for oslili-0.15-py3-none-any.whl

Total release size: 2.5 MB

Release files / oslili-0.15.tar.gz

Download URL oslili-0.15.tar.gz
Size 911.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a8165575bcc618da7dbc4353871c2b70264c4dd73cc055569608cf9a17134248
BLAKE2b-256 checksum
How to use checksums
2eb60afdd6f9881359937116b00475859113407e957346daa5281ecdc38a0742
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / oslili-0.15-py3-none-any.whl

Download URL oslili-0.15-py3-none-any.whl
Size 1.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
d1d5899c755ac6f1c19dbc4044be2f3ca4cdc5c6bd10d390a784f4156ff232ef
BLAKE2b-256 checksum
How to use checksums
8da270bb3fef060675b0dc8f079524e667cbdde21b4d603b10aeeba59433d291
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Security for oslili 0.15

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page