https://github.com/sdruskat/pyswh
Python wrapper around the Software Heritage API
https://github.com/sdruskat/pyswh
Last synced: about 1 month ago
JSON representation
Python wrapper around the Software Heritage API
- Host: GitHub
- URL: https://github.com/sdruskat/pyswh
- Owner: sdruskat
- License: other
- Created: 2022-10-10T15:01:09.000Z (over 2 years ago)
- Default Branch: develop
- Last Pushed: 2023-05-23T05:00:58.000Z (about 2 years ago)
- Last Synced: 2025-03-25T01:47:57.426Z (about 2 months ago)
- Language: Python
- Homepage: https://pyswh.readthedocs.io
- Size: 285 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Citation: CITATION.cff
Awesome Lists containing this project
README
# *pyswh* - a Python wrapper library for the Software Heritage API
*pyswh* aims to wrap interactions with the [Software Heritage REST API](https://archive.softwareheritage.org/api/1/) into a comfortable Python API.
[](https://sonarcloud.io/summary/new_code?id=sdruskat_pyswh)
[](https://pyswh.readthedocs.io/en/latest/?badge=latest)
[](https://codecov.io/gh/sdruskat/pyswh)
[](https://api.reuse.software/info/github.com/sdruskat/pyswh)## Getting started
Install `pyswh` via pip:
```bash
pip install pyswh
```Include `pyswh` in your project by adding a respective dependency to your project, e.g.,
```bash
# requirements.txt
pyswh==0.1.0
``````toml
# Poetry pyproject.toml
[tool.poetry.dependencies]
pyswh = "^0.1.0"
```You can now use `pyswh`:
```python
from pyswh import swh
from pyswh import errors as swh_errorstry:
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](https://pyswh.readthedocs.io/en/latest/) to learn more about using `pyswh`.
## Set up for development
**Requirements:** Python >= 3.10.0.
1. Install [Poetry](https://python-poetry.org).
2. Clone the repository:
```bash
git clone [email protected]:sdruskat/pyswh.git
```3. Create a virtual environment in `.venv`:
```bash
python3.10 -m venv .venv
```4. Activate the Poetry shell and install project:
```bash
poetry shell
poetry install
```## Testing
`pyswh` uses `pytest` for testing. To run all tests, do:
```bash
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`](LICENSE.md)