Package: scanoss
SCANOSS Python PackageThe SCANOSS python package provides a simple easy to consume library for interacting with SCANOSS APIs/Engine.InstallationTo install (frompypi.org), please run:pip3installscanossTo upgrade an existing installation please run:pip3install--upgradescanossFast WinnowingTo take advantage of faster fingerprinting, please install the optionalscanoss_winnowingpackage:pip3installscanoss_winnowingOr directly using:pip3installscanoss[fast_winnowing]DockerAlternatively, there is a docker image of the compiled package. It can be foundhere.
Details of how to run it can be foundhere.Externally Managed Environments on LinuxIf installing on Ubuntu 2023.04, Fedora 38, Debian 11, etc. a few additional steps are required before installingscanoss-py. More details can be foundhere.The recommended method is to installpipxand use it to installscanoss-py:sudoaptinstallpipx
pipxensurepathThis will install thepipxpackage manager, which can then be used to installscanoss-py:pipxinstallscanoss[fast_winnowing]This will install thescanoss-pyapp in a separate virtual environment and create a link to the local path for execution.UsageThe package can be run from the command line, or consumed from another Python script.CLI UsageThe Python package manager (pip), will register the following command during installation:scanoss-pyIt is also possible to launch it using:python3-mscanoss.cliRunning the bare command will list the available sub-commands:>scanoss-py

usage:scanoss-py[-h][--version]{version,ver,scan,sc,fingerprint,fp,wfp,dependencies,dp,dep,file_count,fc,convert,cv,cnv,cvrt,component,comp,utils,ut}...

SCANOSSPythonCLI.Ver:1.6.1,License:MIT,FastWinnowing:True

options:-h,--helpshowthishelpmessageandexit--version,-vDisplayversiondetails

SubCommands:validsubcommands{version,ver,scan,sc,fingerprint,fp,wfp,dependencies,dp,dep,file_count,fc,convert,cv,cnv,cvrt,component,comp,utils,ut}sub-commandhelpversion(ver)SCANOSSversionscan(sc)Scansourcecodefingerprint(fp,wfp)Fingerprintsourcecodedependencies(dp,dep)Scansourcecodefordependencies,butdonotdecoratethemfile_count(fc)Searchthesourcetreeandproduceafiletypesummaryconvert(cv,cnv,cvrt)Convertfileformatcomponent(comp)Componentsupportcommandsutils(ut)GeneralutilitysupportcommandsFrom there it is possible to scan a source code folder:>scanoss-pyscan-oscan-output.json<source-folder>Scanning for DependenciesThe SCANOSS CLI supports dependency decoration. In order for this to work, it requires the installation of scancode:pipinstallscancode-toolkitDependencies can then be decorated by adding the--dependenciesoption to the scanner:>scanoss-pyscan--dependencies-oscan-output.json<source-folder>Package UsageThescanosspackage can also be used in other Python projects/scripts. A good example of how to consume it can be foundhere.In general the easiest way to consume it is to import the required module as follows:fromscanoss.scannerimportScannerdefmain():scanner=Scanner()scanner.scan_folder('.')if__name__=="__main__":main()Scanning URL and API KeyBy 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-pyscan--apiurl<URL>--key<KEY>From code, it would look like this:fromscanoss.scannerimportScannerdefmain():scanner=Scanner(url='new-url',api_key='key')scanner.scan_folder('.')if__name__=="__main__":main()RequirementsPython 3.7 or higher.Source codeThe source for this package can be foundhere.DocumentationFor client usage help please lookhere.ChangelogDetails of each release can be foundhere.