Skip to content

scanoss/scanoss.py

Repository files navigation

SCANOSS Python Library

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

Build/Test Local Package Build/Test Local Container Publish Package - PyPI Publish GHCR Container

Installation

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

pip3 install scanoss

Usage

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

For more details, please look at PACKAGE.md.

Container Usage

To leverage the CLI from within a container, please look at GHCR.md.

Development

Before starting with development of this project, please read our CONTRIBUTING and CODE OF CONDUCT.

Requirements

Python 3.7 or higher.

The dependencies can be found in the requirements.txt and requirements-dev.txt files.

To install dependencies, run:

pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt

To enable dependency scanning, an extra tool is required: scancode-toolkit

pip3 install -r requirements-scancode.txt

Package Development

More details on Python packaging/distribution can be found here, here, and here.

It is good practice to set up a Virtual Env (venv) to isolate and simplify development/testing. If using PyCharm, please follow these instructions.

In order to develop/test a Python package, it is necessary to register the package locally. This can be done using the following command:

python3 setup.py develop --user

There is also a Makefile in the repository, which provide helpers to achieve this:

make dev_setup

The client now makes use of REST & gRPC. For gRPC specific environment variables please look here.

Package Deployment

Packaging the library for deployment is done using setup.

Versioning

The version of the package is defined in the scanoss init file. Please update this version before packaging/releasing an update.

Packaging

To package the library, please run:

make dist

Deployment

This project uses twine to upload packages to pypi.org. In order to run twine, a user needs to be registered with both TestPyPI and PyPI. Details for using TestPyPI can be found here and PyPI here.

Once the credentials have been stored in $HOME/.pypirc, the following command can be run:

make publish_test

This will deploy the package to TestPyPI. Run some tests to verify everything is ok.

Then deploy to prod:

make publish

This will deploy the package to PyPI.

The package will then be available to install using:

pip3 install scanoss
GitHub Actions

There are a number of workflows setup for this repository. They provide the following:

Bugs/Features

To request features or alert about bugs, please do so here.

Changelog

Details of major changes to the library can be found in CHANGELOG.md.

Background

Details about the Winnowing algorithm used for scanning can be found here.