Skip to main content

Simple Python library to use the SCANOSS APIs.

Project description

SCANOSS Python Package

The SCANOSS python package provides a simple easy to consume library for interacting with SCANOSS APIs/Engine.

Installation

To install (from pypi.org), please run:

pip3 install scanoss

To upgrade an existing installation please run:

pip3 install --upgrade scanoss

Docker

Alternatively, there is a docker image of the compiled package. It can be found here. Details of how to run it can be found here.

Usage

The package can be run from the command line, or consumed from another Python script.

CLI Usage

The Python package manager (pip), will register the following command during installation:

scanoss-py

It is also possible to launch it using:

python3 -m scanoss.cli

Running the bare command will list the available sub-commands:

> scanoss-py

usage: scanoss-py [-h] {version,ver,scan,sc,fingerprint,fp,wfp,dependencies,dp,dep} ...

SCANOSS Python CLI. Ver: 0.9.0, License: MIT

optional arguments:
  -h, --help            show this help message and exit

Sub Commands:
  valid subcommands

  {version,ver,scan,sc,fingerprint,fp,wfp,dependencies,dp,dep}
                        sub-command help
    version (ver)       SCANOSS version
    scan (sc)           Scan source code
    fingerprint (fp, wfp)
                        Fingerprint source code
    dependencies (dp, dep)
                        Scan source code for dependencies

From there it is possible to scan a source code folder:

> scanoss-py scan -o scan-output.json <source-folder>

Scanning for Dependencies

The SCANOSS CLI supports dependency decoration. In order for this to work, it requires the installation of scancode:

pip install scancode-toolkit

Dependencies can then be decorated by adding the --dependencies option to the scanner:

> scanoss-py scan --dependencies -o scan-output.json <source-folder>

Package Usage

The scanoss package can also be used in other Python projects/scripts. A good example of how to consume it can be found here.

In general the easiest way to consume it is to import the required module as follows:

from scanoss.scanner import Scanner

def main():
    scanner = Scanner()
    scanner.scan_folder( '.' )
    
if __name__ == "__main__":
    main()

Scanning URL and API Key

By Default, scanoss uses the API URL endpoint for SCANOSS OSS KB: https://osskb.org/api/scan/direct. This API does not require an API key.

These values can be changed from the command line using:

> scanoss-py scan --apiurl <URL> --key <KEY>

From code, it would look like this:

from scanoss.scanner import Scanner

def main():
    scanner = Scanner(url='new-url', api_key='key')
    scanner.scan_folder( '.' )
    
if __name__ == "__main__":
    main()

Requirements

Python 3.7 or higher.

Source code

The source for this package can be found here.

Documentation

For client usage help please look here.

Changelog

Details of each release can be found here.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

scanoss-1.3.2.tar.gz (52.6 kB view details)

Uploaded Source

Built Distribution

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

scanoss-1.3.2-py3-none-any.whl (107.3 kB view details)

Uploaded Python 3

File details

Details for the file scanoss-1.3.2.tar.gz.

File metadata

  • Download URL: scanoss-1.3.2.tar.gz
  • Upload date:
  • Size: 52.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

File hashes

Hashes for scanoss-1.3.2.tar.gz
Algorithm Hash digest
SHA256 7b4028cea234939691fba166c037b6fe3bd64c7586fc887ed615d7540f48f4d5
MD5 7896d478120d5d7fe2bd9002195f5f99
BLAKE2b-256 4aa483a7e797fd037874e8134f99c0161d2b3aeea946f378b5f4889164409aa0

See more details on using hashes here.

File details

Details for the file scanoss-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: scanoss-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 107.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

File hashes

Hashes for scanoss-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2b130679f87e327e31c7b32d80a52fbc62f3cd778dae3f92a557be9df1b9ad35
MD5 4ad12add2425f5acc900be7e80de7055
BLAKE2b-256 9b9327eb8ef64d114e33f8381b837b9c9c55260ece04f59fe3d95c2fc7301ffa

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