Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trapi1 5 #42

Merged
merged 3 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pip install kp-registry

KP Registry will also use an environment variable:
```
KP_TRAPI_VERSION=1.3.0
KP_TRAPI_VERSION=1.5.0
```

## Usage:
Expand Down
14 changes: 12 additions & 2 deletions kp_registry/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""KP registry."""

import asyncio
import httpx
import json
Expand Down Expand Up @@ -205,7 +206,7 @@ async def retrieve_kp_endpoints_from_smartapi(self):
)
continue
regex = re.compile("[0-9]\.[0-9]")
target_trapi_version = os.getenv("KP_TRAPI_VERSION", "1.3.0")
target_trapi_version = os.getenv("KP_TRAPI_VERSION", "1.5.0")
trapi_version = regex.match(target_trapi_version)
if not version.startswith(trapi_version.group() + "."):
LOGGER.info(
Expand Down Expand Up @@ -265,7 +266,7 @@ async def retrieve_kp_endpoints_from_smartapi(self):
"version": version,
}
)
except (KeyError):
except KeyError:
LOGGER.warning(
"No servers for %s (https://smart-api.info/registry?q=%s)",
title,
Expand All @@ -274,3 +275,12 @@ async def retrieve_kp_endpoints_from_smartapi(self):
continue

return endpoints


async def main():
registry = Registry()
await registry.retrieve_kps()


if __name__ == "__main__":
asyncio.run(main())
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black==22.12.0
black==24.4.0
pytest==6.2.4
pytest-asyncio==0.15.1
pytest-cov==2.12.0
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
httpx==0.16.1
reasoner-pydantic==3.0.0
reasoner-pydantic==5.0.2
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Setup file for kp-registry package."""

from setuptools import setup

setup(
name="kp-registry",
version="3.0.0",
version="4.0.0",
author="CoVar",
url="https://github.com/ranking-agent/kp_registry",
description="Translator KP Registry",
Expand Down
5 changes: 3 additions & 2 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test KP registry."""

import pytest

from kp_registry.main import Registry
Expand All @@ -17,7 +18,7 @@
"info": {
"title": "Test KP",
"x-translator": {"component": "KP"},
"x-trapi": {"version": "1.3.0", "operations": ["lookup"]},
"x-trapi": {"version": "1.5.0", "operations": ["lookup"]},
},
"paths": {"/meta_knowledge_graph": {}},
},
Expand All @@ -32,7 +33,7 @@
"info": {
"title": "Test KP 2",
"x-translator": {"component": "KP"},
"x-trapi": {"version": "1.3.0", "operations": ["lookup"]},
"x-trapi": {"version": "1.5.0", "operations": ["lookup"]},
},
"paths": {"/meta_knowledge_graph": {}},
},
Expand Down
Loading