This Python project implements the REST API of SW360 and allows an easy way to interact with SW360.
Have a look at the documentation: https://sw360.github.io/sw360python/
This project is available as Python package on PyPi.org.
Install sw360 and required dependencies:
pip install sw360 requests
-
Get a REST API token from your SW360 server
-
Export required environment variables (optionally but recommended):
export SW360ProductionToken=<your_api_token>
-
Start using the API:
import sw360 client = sw360.SW360(sw360_url, sw360_api_token)
- All contributions in form of bug reports, feature requests or merge requests!
- Use proper docstrings to document
functions and classes - Extend the testsuite poetry run pytest with the new functions/classes
- The documentation website can automatically be generated by the Sphinx autodoc extension
The documentation of the project is built using Sphinx:
poetry run sphinx-build ./docs-source/ ./docs/
For building the library, you need Poetry.
The build is then triggered using
poetry build
This creates the source and wheel files in dist/
subdirectory -- which can then be
uploaded or installed locally using pip
.
Start the complete test suite or a specific test case (and generate coverage report):
poetry run pytest
or
poetry run coverage run -m pytest
poetry run coverage report -m --omit "*/site-packages/*.py"
poetry run coverage html --omit "*/site-packages/*.py"
The script check_project.py
shows how to use the library to retrieve some information
of a given project on SW360. This requires colorama>=0.4.1.
Copyright 2019-2024 Siemens
The project is licensed under the MIT license. SPDX-License-Identifier: MIT
For an up-to-date CycloneDX SBOM, please have a look at the SBOM folder.