目录

PyPI version CI

Open Targets JSON validator

The opentargets-validator tool in this repository validates JSON files which are submitted to Open Targets by various data sources against the Open Targets JSON schemas.

Installation

pip install --upgrade opentargets-validator

Requirements

  • Python 3.8.1 or higher
  • Compatible with Python 3.8, 3.9, 3.10, 3.11, 3.12, and 3.13

Usage examples

Validating a local gzipped file against the latest schema version from GitHub:

opentargets_validator \
  --schema https://raw.githubusercontent.com/opentargets/json_schema/master/schemas/disease_target_evidence.json \
  evidence.json.gz

Validating a portion of the local file against a local copy of the schema:

zcat evidence.json.gz | head -n 100 | opentargets_validator --schema evidence_schema.json

Input files

The validator has to be provided with two inputs:

  1. Data to validate. It has to contain exactly one complete JSON object per line.
  2. Schema to validate against. It can be any valid JSON Draft 7 schema.

Either of the input files (data and schema) can be read from:

Development

# Install uv and dependencies
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync --dev

# Run tests and linting
uv run pytest
uv run ruff check opentargets_validator tests

Using pip

python -m venv env && source env/bin/activate
pip install -e ".[dev]"
python -m pytest

CI/CD and Releases

This repository uses GitHub Actions for continuous integration.

Releases are automatically published to PyPI via GitHub Actions when tags are created.

Modern Python Tooling

This project has been modernized with:

  • uv for fast dependency management and builds
  • ruff for lightning-fast linting and formatting
  • hatchling as the modern build backend
  • importlib.resources instead of deprecated pkg_resources
  • GitHub Actions for CI/CD instead of Travis CI
  • pyproject.toml for modern Python project configuration
关于

用于验证和校验数据格式与结构的工具

291.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802047560号