diff --git a/py/noxfile.py b/py/noxfile.py index 1272eda7bd..0e4a68ad90 100644 --- a/py/noxfile.py +++ b/py/noxfile.py @@ -22,8 +22,8 @@ nox.options.default_venv_backend = 'uv|virtualenv' PYTHON_VERSIONS = [ - #'pypy-3.10', # TODO: Fix build failures. - #'pypy-3.11', # TODO: Fix build failures. + # 'pypy-3.10', # TODO: Fix build failures. + # 'pypy-3.11', # TODO: Fix build failures. '3.10', '3.11', '3.12', @@ -51,8 +51,8 @@ def tests(session: nox.Session) -> None: '--isolated', 'pytest', '-v', - #'-vv', - #'--log-level=DEBUG', + # '-vv', + # '--log-level=DEBUG', '.', *session.posargs, external=True, diff --git a/py/plugins/xai/pyproject.toml b/py/plugins/xai/pyproject.toml index 3c37a1cd16..15843b3727 100644 --- a/py/plugins/xai/pyproject.toml +++ b/py/plugins/xai/pyproject.toml @@ -33,10 +33,7 @@ classifiers = [ "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Software Development :: Libraries", ] -dependencies = [ - "genkit", - "xai-sdk>=0.0.1", -] +dependencies = ["genkit", "xai-sdk>=0.0.1"] description = "Genkit xAI Plugin" license = { text = "Apache-2.0" } name = "genkit-plugin-xai" diff --git a/py/pyproject.toml b/py/pyproject.toml index f18cecdeaa..400fa73842 100644 --- a/py/pyproject.toml +++ b/py/pyproject.toml @@ -113,10 +113,10 @@ genkit-plugin-google-cloud = { workspace = true } genkit-plugin-google-genai = { workspace = true } genkit-plugin-ollama = { workspace = true } genkit-plugin-vertex-ai = { workspace = true } +genkit-plugin-xai = { workspace = true } google-genai-hello = { workspace = true } google-genai-image = { workspace = true } prompt-demo = { workspace = true } -genkit-plugin-xai = { workspace = true } [tool.uv.workspace] members = ["packages/*", "plugins/*", "samples/*"] @@ -277,8 +277,8 @@ unauthorized_licenses = [ ] [tool.liccheck.authorized_packages] -aiohttp = "3.13.2" # Apache-2.0 AND MIT (transitive dep of xai-sdk) -aiohappyeyeballs = "2.6.1" # Python Software Foundation (transitive dep of xai-sdk) -certifi = "2025.4.26" # TODO: Verify. -dependencies = true -ollama = "0.5.1" # MIT "https://github.com/ollama/ollama-python/blob/main/LICENSE" +aiohappyeyeballs = "2.6.1" # Python Software Foundation (transitive dep of xai-sdk) +aiohttp = "3.13.2" # Apache-2.0 AND MIT (transitive dep of xai-sdk) +certifi = "2025.4.26" # TODO: Verify. +dependencies = true +ollama = "0.5.1" # MIT "https://github.com/ollama/ollama-python/blob/main/LICENSE" diff --git a/py/samples/xai-hello/src/xai_hello.py b/py/samples/xai-hello/src/xai_hello.py index e8f51919fd..d1c7ccdf06 100644 --- a/py/samples/xai-hello/src/xai_hello.py +++ b/py/samples/xai-hello/src/xai_hello.py @@ -139,21 +139,22 @@ async def calculator_flow(expression: str) -> str: return f'{operation.title()}({a}, {b}) = {result.get("result")}' -if __name__ == '__main__': - import asyncio +async def main(): + result = await say_hi('Alice') + logger.info('say_hi', result=result) + + result = await say_hi_stream('Bob') + logger.info('say_hi_stream', result=result[:150]) - async def main(): - result = await say_hi('Alice') - logger.info('say_hi', result=result) + result = await say_hi_with_config('Charlie') + logger.info('say_hi_with_config', result=result) - result = await say_hi_stream('Bob') - logger.info('say_hi_stream', result=result[:150]) + result = await weather_flow('New York') + logger.info('weather_flow', result=result) - result = await say_hi_with_config('Charlie') - logger.info('say_hi_with_config', result=result) + result = await calculator_flow('add_5_3') + logger.info('calculator_flow', result=result) - result = await weather_flow('New York') - logger.info('weather_flow', result=result) - result = await calculator_flow('add_5_3') - logger.info('calculator_flow', result=result) +if __name__ == '__main__': + ai.run_main(main()) diff --git a/py/tox.ini b/py/tox.ini index c0f123a1dc..664d2c6d09 100644 --- a/py/tox.ini +++ b/py/tox.ini @@ -10,12 +10,14 @@ skipsdist = True # We install editable, so don't build sdist. [testenv] description = Run tests with pytest +allowlist_externals = uv deps = pytest pytest-cov pytest-asyncio pytest-mock PyYAML - -e . +commands_pre = + uv pip install --python {envpython} -e . commands = pytest {posargs}