This project has been archived by its maintainers, and is no longer receiving any updates.
Python Library for quering OSS Index
ℹ️ As of May 2026, this community project has been archived.
See also this announcement concerning OSS Index being subsumed into Sonatype Guide.
There are better alternatives today:
- Guide API Clients: https://github.com/sonatype-nexus-community/sonatype-guide-api-client
🚧 This community project will receive no further updates or maintenance.
This OSSIndex module for Python provides a common interface to querying the OSS Index.
This module is not designed for standalone use. If you're looking for a tool that can detect your application's dependencies and assess them for vulnerabilities against the OSS Index, perhaps you should check out Jake.
You can of course use this library in your own applications.
Installation
Install from pypi.org as you would any other Python module:
pip install ossindex-lib
Usage
First create an instance of OssIndex, optionally enabling local caching
o = OssIndex()
Then supply a List of PackageURL objects that you want to ask
OSS Index about. If you don't want to care about generating this list yourself, perhaps look to a tool like Jake
(which uses this library) and will do all the hard work for you!
As a quick test, you could run:
from ossindex.ossindex import OssIndex, PackageURL
from ossindex.model import OssIndexComponent, Vulnerability
o = OssIndex()
results: List[OssIndexComponent] = o.get_component_report(packages=[
PackageURL.from_string(purl='pkg:pypi/pip@23.1.2')
])
for r in results:
print("{}: {} known vulnerabilities".format(r.coordinates, len(r.vulnerabilities)))
v: Vulnerability
for v in r.vulnerabilities:
print(' - {}'.format(str(v)))
... which would output something like ...
pkg:pypi/pip@23.1.2: 1 known vulnerabilities
- <Vulnerability id=CVE-2018-20225, name=CVE-2018-20225, cvss_score=7.8>
Logging
This library send log events to a standard Python logger named ossindex. You can configure the logger to output as
required through the standard Python logging configuration.
Todos
- Support authentication against OSS Index
Python Support
We endeavour to support all functionality for all current actively supported Python versions. However, some features may not be possible/present in older Python versions due to their lack of support.
Changelog
See our CHANGELOG.
The Fine Print
Remember:
It is worth noting that this is NOT SUPPORTED by Sonatype, and is a contribution of ours to the open source community (read: you!)
- Use this contribution at the risk tolerance that you have
- Do NOT file Sonatype support tickets related to
ossindex-lib - DO file issues here on GitHub, so that the community can pitch in
Phew, that was easier than I thought. Last but not least of all - have fun!
Metadata
Release files for ossindex-lib 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ossindex_lib-1.1.2.tar.gz | 15.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ossindex_lib-1.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.7 kB
Release files / ossindex_lib-1.1.2.tar.gz
| Download URL | ossindex_lib-1.1.2.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95104edd69466fe07d1b5748d8eda4dbc95b3e8e3bf400440680e79d30c664cb
|
|
BLAKE2b-256 checksum How to use checksums |
f21d6674b44a63461e63771028f18acc5c834c233213dced3c8609f990547d1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.8.10
|
Release files / ossindex_lib-1.1.2-py3-none-any.whl
| Download URL | ossindex_lib-1.1.2-py3-none-any.whl |
|---|---|
| Size | 20.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
04c993d44f59c6a220896a9a2026d0760219e6a0a6d53bbb8af77a4ec65672ec
|
|
BLAKE2b-256 checksum How to use checksums |
5c8e17239ffe149569df0d1a109a265bb59019cb1376f3c1a23b2740ccfed81b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.8.10
|