JRA-VAN Data Lab JV-Link Python client
Project description
PyJVLink
JRA-VAN Data Lab JV-Link を Python から利用するための非同期クライアントライブラリ。
Windows では JVLinkServer.exe の自動起動に対応し、Linux/macOS ではリモート接続モードで利用できます。
オンラインドキュメント | PyPI | Releases
特徴
async/awaitベースの API- NDJSON ストリーミング対応
- typed query / raw query の両系統
RecordEnvelopeで一貫した戻り値Sequence[JVDataSpec | str]を受け取る柔軟な DataSpec 指定- realtime race key helper (
RaceKeyParts,build_race_key*) - SSE イベント監視 (
watch_events,stream_events)
前提条件
- Python 3.10 以上
- 接続先の JVLinkServer
- Windows: ローカル自動起動
- Linux/macOS: Windows 上の JVLinkServer へ接続
インストール
pip install git+https://github.com/nyoki-mtl/JVLinkServer.git#subdirectory=python
クイックスタート
import asyncio
from pyjvlink import Client
async def main() -> None:
async with Client() as client:
result = await client.query_stored(
dataspec=["RACE", "TOKU"],
from_datetime="20240101",
option=1,
record_types=["RA", "TK"],
)
print(result.meta)
async for envelope in result.records:
print(envelope.type)
if __name__ == "__main__":
asyncio.run(main())
主要API
Client.query_stored(...) -> StoredResult[DomainRecord]Client.query_realtime(...) -> RealtimeResult[DomainRecord]Client.query_stored_raw(...) -> StoredResult[WireRecord]Client.query_realtime_raw(...) -> RealtimeResult[WireRecord]Client.watch_events() -> AsyncContextManager[AsyncIterator[JVLinkEvent]]Client.stream_events() -> AsyncIterator[JVLinkEvent]Client.delete_file(filename) -> dictClient.get_uniform(pattern) -> bytesClient.save_uniform(pattern, filepath) -> dictClient.get_course(key) -> tuple[bytes, str]Client.get_course_file(key) -> dictClient.save_course(key, filepath) -> dict
StoredResult / RealtimeResult は次の構造です。
meta: サーバーからのメタ情報records:RecordEnvelopeの非同期イテレータ
realtime 系では key に文字列だけでなく date / datetime / RaceKeyParts も渡せます。
API 方針
公開クライアントは Client を使用します。
CLI
pyjvlink health
pyjvlink version
pyjvlink query-stored RACE 20240101 1 --max-records 10
pyjvlink query-realtime 0B12 --key 202401070511
pyjvlink health が unhealthy を返した場合は、components.jvlink.last_fault_message を確認してください。
開発
Windows ネイティブ環境を前提とします。
uv sync --all-extras
uv run ruff check src tests
uv run ty check src/pyjvlink
uv run pytest tests -v
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyjvlink-0.8.2.tar.gz.
File metadata
- Download URL: pyjvlink-0.8.2.tar.gz
- Upload date:
- Size: 135.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89c9905c673d38ec548ebb103de00f9b656d0a1825fb1230b33560aac6fe3728
|
|
| MD5 |
274c34efb5722ca336682f8e5212526b
|
|
| BLAKE2b-256 |
70e1f19045ebe502b09965eeb3cf0ef95cd687a7c345f49d746e86c6d36c1f8b
|
File details
Details for the file pyjvlink-0.8.2-py3-none-win_amd64.whl.
File metadata
- Download URL: pyjvlink-0.8.2-py3-none-win_amd64.whl
- Upload date:
- Size: 729.2 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aed64877838b5cb649e73638336155431d5673c0fa9c7a1edb8fa8dff738f763
|
|
| MD5 |
42faf03e9c7671d233fde90d089090af
|
|
| BLAKE2b-256 |
c40ca0d7c0c0a7a891a7310b97663e2c56fefe119731425cb77320103c32d7a1
|
File details
Details for the file pyjvlink-0.8.2-py3-none-any.whl.
File metadata
- Download URL: pyjvlink-0.8.2-py3-none-any.whl
- Upload date:
- Size: 179.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b8301f27f756951ca1c961617b331062ed39571393b5cdd4da46e55eae2e968
|
|
| MD5 |
7051ed821b4e1862a8f4795baa750853
|
|
| BLAKE2b-256 |
0215c2b8e1743fc73c194daa3544c98d33741c75704379bde28bf9f7addb542b
|