Skip to main content

A Python wrapper for the Software Heritage API

Project description

pyswh - a Python wrapper library for the Software Heritage API

pyswh aims to wrap interactions with the Software Heritage REST API into a comfortable Python API.

Quality Gate Status Docs build codecov REUSE status

Getting started

Install pyswh via pip:

pip install pyswh

Include pyswh in your project by adding a respective dependency to your project, e.g.,

# requirements.txt
pyswh==0.1.0
# Poetry pyproject.toml
[tool.poetry.dependencies]
pyswh = "^0.1.0"

You can now use pyswh:

from pyswh import swh
from pyswh import errors as swh_errors

try:
    swh.save('https://github.com/sdruskat/pyswh', False, 'SWH-API-AUTH-TOKEN')
except swh_errors.SwhSaveError as sse:
    raise sse

Refer to the complete documentation to learn more about using pyswh.

Set up for development

Requirements: Python >= 3.10.0.

  1. Install Poetry.

  2. Clone the repository:

git clone git@github.com:sdruskat/pyswh.git
  1. Create a virtual environment in .venv:
python3.10 -m venv .venv 
  1. Activate the Poetry shell and install project:
poetry shell
poetry install

Testing

pyswh uses pytest for testing. To run all tests, do:

poetry shell
poetry run pytest test/

Building documentation locally

Initialize the Poetry virtual environment with poetry shell, go into the docs/ folder and run make html.

Licensing

See LICENSE.md

Project details


Download files

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

Source Distribution

pyswh-0.1.0.tar.gz (14.9 kB view hashes)

Uploaded Source

Built Distribution

pyswh-0.1.0-py3-none-any.whl (25.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page