diff --git a/misc/Makefile b/misc/Makefile index 6a4e99d739e9..408f3511b4d5 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -512,6 +512,7 @@ SUBDIR += py-google-ai-generativelanguage SUBDIR += py-google-genai SUBDIR += py-gpiozero + SUBDIR += py-groq SUBDIR += py-gymnasium SUBDIR += py-halo SUBDIR += py-haystack_ai diff --git a/misc/py-groq/Makefile b/misc/py-groq/Makefile new file mode 100644 index 000000000000..a3c801057a5e --- /dev/null +++ b/misc/py-groq/Makefile @@ -0,0 +1,42 @@ +PORTNAME= groq +DISTVERSION= 1.5.0 +CATEGORIES= misc python # machine-learning +MASTER_SITES= PYPI +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} + +MAINTAINER= yuri@FreeBSD.org +COMMENT= Official Python library for the Groq API +WWW= https://groq.com/ \ + https://github.com/groq/groq-python + +LICENSE= APACHE20 +LICENSE_FILE= ${WRKSRC}/LICENSE + +BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}hatchling>0:devel/py-hatchling@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}hatch-fancy-pypi-readme>0:devel/py-hatch-fancy-pypi-readme@${PY_FLAVOR} +RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}anyio>=3.5.0:devel/py-anyio@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}distro>=1.7.0:sysutils/py-distro@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}httpx>=0.23.0:www/py-httpx@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}pydantic2>=1.9.0:devel/py-pydantic2@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}sniffio>=0:devel/py-sniffio@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}typing-extensions>=4.14:devel/py-typing-extensions@${PY_FLAVOR} +TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}dirty-equals>=0.6.0:devel/py-dirty-equals@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}importlib-metadata>=6.7.0:devel/py-importlib-metadata@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}pytest-asyncio>=0:devel/py-pytest-asyncio@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}pytest-xdist>=3.6.1:devel/py-pytest-xdist@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}respx>=0:www/py-respx@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}rich>=13.7.1:textproc/py-rich@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}time-machine>=0:devel/py-time-machine@${PY_FLAVOR} + +USES= python +USE_PYTHON= pep517 autoplist pytest + +NO_ARCH= yes + +TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} +TEST_ARGS= tests/test_client.py tests/test_models.py + +# tests as of 1.5.0: 203 passed, 2 skipped in 8.28s +# (api_resources tests fail with the respx/httpx versions in ports) + +.include diff --git a/misc/py-groq/distinfo b/misc/py-groq/distinfo new file mode 100644 index 000000000000..5a8dfab7309c --- /dev/null +++ b/misc/py-groq/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1784049278 +SHA256 (groq-1.5.0.tar.gz) = 8648388f8668629490bb0eab11252b4cc43316149fda9c6343e9a9577fe7df88 +SIZE (groq-1.5.0.tar.gz) = 158239 diff --git a/misc/py-groq/files/patch-pyproject.toml b/misc/py-groq/files/patch-pyproject.toml new file mode 100644 index 000000000000..50097c129101 --- /dev/null +++ b/misc/py-groq/files/patch-pyproject.toml @@ -0,0 +1,34 @@ +-- Two small pyproject.toml adjustments for FreeBSD: +-- 1. Relax the exact hatchling version pin so the port builds with the +-- hatchling version currently available in the FreeBSD ports tree. +-- 2. Allow pytest-benchmark's PytestBenchmarkWarning when pytest-xdist is +-- active; upstream turns all warnings into errors, which makes the test +-- runner abort before any tests run. + +--- pyproject.toml.orig 2020-02-02 00:00:00 UTC ++++ pyproject.toml +@@ -90,7 +90,7 @@ typecheck = { chain = [ + "typecheck:mypy" = "mypy ." + + [build-system] +-requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme"] ++requires = ["hatchling>=1.26.3", "hatch-fancy-pypi-readme"] + build-backend = "hatchling.build" + + [tool.hatch.build] +@@ -129,12 +129,13 @@ testpaths = ["tests"] + + [tool.pytest.ini_options] + testpaths = ["tests"] +-addopts = "--tb=short -n auto" ++addopts = "--tb=short" + xfail_strict = true + asyncio_mode = "auto" + asyncio_default_fixture_loop_scope = "session" + filterwarnings = [ +- "error" ++ "error", ++ "ignore::pytest_benchmark.logger.PytestBenchmarkWarning" + ] + + [tool.pyright] diff --git a/misc/py-groq/pkg-descr b/misc/py-groq/pkg-descr new file mode 100644 index 000000000000..5e2fd9b7132e --- /dev/null +++ b/misc/py-groq/pkg-descr @@ -0,0 +1,4 @@ +The official Python library for the Groq API. + +Groq builds fast AI inference technology and provides an OpenAI-compatible +API for running large language models.