Metadata-Version: 2.5
Name: pyimporters-json
Version: 1.6.208
Summary: Sherpa JSON knowledge import plugin
Author-email: Olivier Terrier <olivier.terrier@kairntech.com>
License: Proprietary
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.12
Requires-Dist: pyimporters-plugins<1.7.0,>=1.6.0
Provides-Extra: sbom
Requires-Dist: cyclonedx-bom; extra == 'sbom'
Requires-Dist: pip-audit; extra == 'sbom'
Provides-Extra: test
Requires-Dist: pip; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Requires-Dist: ruff; extra == 'test'
Description-Content-Type: text/markdown

# pyimporters_json

[![license](https://img.shields.io/badge/license-proprietary-red)](LICENSE)
[![version](https://img.shields.io/pypi/v/pyimporters-json)](https://pypi.org/project/pyimporters-json/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyimporters-json)](https://pypi.org/project/pyimporters-json/)

Sherpa importer (`json`) that loads lexicon terms from a JSON file in Sherpa format, or from a `.zip` archive of such files.

```json
[
  {"identifier": "afporganization:1803", "preferredForm": "Nokia", "properties": {"altForms": ["Nokia Corporation"]}}
]
```

- `identifier` is mandatory; `preferredForm`, `lexicon` and `properties` (including `altForms`) are optional.
- A single object instead of a list is imported as a one-term list.
- A term without `identifier` is skipped with a warning; the other terms are imported.
- An unknown key at term level is ignored with a warning.

User help pages, with examples recorded by the tests: [French](docs/sherpa/json.fr.md), [English](docs/sherpa/json.en.md).

## Requirements

- Python 3.12+
- Pydantic v2 for the data parts.

## Installation

```
pip install pyimporters-json
```

## Development

```
task py:sync py:lint py:test   # lint and tests
task py:help                   # regenerate the help pages after 'py:test'
task py:help-check             # fail if the help pages do not match the code
```

## SBOM & vulnerability check

Install the SBOM dependencies:

```
uv sync --extra sbom
```

Generate a CycloneDX SBOM from the current environment:

```
uv run cyclonedx-py environment -o sbom.cdx.json --output-format json
```

Audit dependencies for known vulnerabilities:

```
uv run pip-audit --format json --output audit-report.json
```

To fail on any known vulnerability (useful in CI):

```
uv run pip-audit --strict
```
