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

python311Packages.kserve: init at 0.12.1 #304646

Merged
merged 3 commits into from
Apr 25, 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
55 changes: 55 additions & 0 deletions pkgs/development/python-modules/cloudevents/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, wheel
, deprecation
, flask
, pydantic
, pytestCheckHook
, requests
, sanic
, sanic-testing
}:

buildPythonPackage rec {
pname = "cloudevents";
version = "1.10.1";
pyproject = true;

src = fetchFromGitHub {
owner = "cloudevents";
repo = "sdk-python";
rev = "refs/tags/${version}";
hash = "sha256-YIvEAofWmnUblRd4jV3Zi3VdfocOnD05CMVm/abngyg=";
};

build-system = [
setuptools
wheel
];

pythonImportsCheck = [ "cloudevents" ];

nativeCheckInputs = [
deprecation
flask
pydantic
pytestCheckHook
requests
sanic
sanic-testing
];

disabledTestPaths = [
"samples/http-image-cloudevents/image_sample_test.py"
];

meta = with lib; {
description = "Python SDK for CloudEvents";
homepage = "https://github.com/cloudevents/sdk-python";
changelog = "https://github.com/cloudevents/sdk-python/blob/${src.rev}/CHANGELOG.md";
license = licenses.asl20;
maintainers = with maintainers; [ GaetanLepage ];
};
}
119 changes: 119 additions & 0 deletions pkgs/development/python-modules/kserve/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, deprecation
, poetry-core
, pythonRelaxDepsHook
, async-timeout
, cloudevents
, fastapi
, grpcio
, httpx
, kubernetes
, numpy
, orjson
, pandas
, prometheus-client
, protobuf
, psutil
, python-dateutil
, ray
, six
, tabulate
, timing-asgi
, uvicorn
, avro
, azure-storage-blob
, azure-storage-file-share
, boto3
, botocore
, google-cloud-storage
, pytestCheckHook
, tomlkit
}:

buildPythonPackage rec {
pname = "kserve";
version = "0.12.1";
pyproject = true;

src = fetchFromGitHub {
owner = "kserve";
repo = "kserve";
rev = "refs/tags/v${version}";
hash = "sha256-gKJkG8zJY1sGGpI27YZ/QnEPU8J7KHva3nI+JCglQaQ=";
};

sourceRoot = "${src.name}/python/kserve";

build-system = [
deprecation
poetry-core
];

nativeBuildInputs = [
pythonRelaxDepsHook
];

dependencies = [
async-timeout
cloudevents
fastapi
grpcio
httpx
kubernetes
numpy
orjson
pandas
prometheus-client
protobuf
psutil
python-dateutil
ray
six
tabulate
timing-asgi
uvicorn
] ++ ray.passthru.optional-dependencies.serve-deps;

pythonRelaxDeps = [
"fastapi"
"httpx"
"prometheus-client"
"protobuf"
"ray"
"uvicorn"
];

pythonImportsCheck = [ "kserve" ];

nativeCheckInputs = [
avro
azure-storage-blob
azure-storage-file-share
boto3
botocore
google-cloud-storage
pytestCheckHook
tomlkit
];

disabledTestPaths = [
# Looks for a config file at the root of the repository
"test/test_inference_service_client.py"
];

disabledTests = [
# Require network access
"test_health_handler"
"test_infer"
"test_infer_v2"
];

meta = with lib; {
description = "Standardized Serverless ML Inference Platform on Kubernetes";
homepage = "https://github.com/kserve/kserve/tree/master/python/kserve";
license = licenses.asl20;
maintainers = with maintainers; [ GaetanLepage ];
};
}
48 changes: 48 additions & 0 deletions pkgs/development/python-modules/timing-asgi/default.nix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but unfortunately they are not present in the pypi archive:

Executing pytestCheckPhase
total 28
drwxr-xr-x 3 nixbld nixbld 4096 Apr 22 19:09 .
drwx------ 3 nixbld nixbld 4096 Apr 22 19:09 ..
-rw-r--r-- 1 nixbld nixbld 3657 Jan  2  1980 PKG-INFO
-rw-r--r-- 1 nixbld nixbld 2973 Jul 18  2023 README.md
-rw-r--r-- 1 nixbld nixbld  670 Apr 22 19:09 pyproject.toml
-rw-r--r-- 1 nixbld nixbld 3697 Jan  2  1980 setup.py
drwxr-xr-x 3 nixbld nixbld 4096 Apr 22 19:09 timing_asgi

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dp we have to care about pypi?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used fetchPypi here because there are no releases on Github.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right.
Unfortunately, the tests can't run because the required dependency asynctest is "not supported by python 3.11" :')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I switched to fetchFromGithub nonetheless).

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, poetry-core
, asynctest
, pytestCheckHook
}:

buildPythonPackage rec {
pname = "timing-asgi";
version = "0.3.1";
pyproject = true;

src = fetchFromGitHub {
owner = "steinnes";
repo = "timing-asgi";
rev = "refs/tags/v${version}";
hash = "sha256-oEDesmy9t2m51Zd6Zg87qoYbfbDnejfrbjyBkZ3hF58=";
};

postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail poetry.masonry.api poetry.core.masonry.api \
--replace-fail "poetry>=" "poetry-core>="
'';

build-system = [
poetry-core
];

pythonImportsCheck = [ "timing_asgi" ];

# Tests rely on asynctest which is not supported by python 3.11
doCheck = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be pythonOlder "3.12"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately no, because ray is not available for Python 3.12.
ray-project/ray#40211


nativeCheckInputs = [
# asynctest-0.13.0 not supported for interpreter python3.11
# asynctest
pytestCheckHook
];

meta = with lib; {
description = "ASGI middleware to emit timing metrics with something like statsd";
homepage = "https://pypi.org/project/timing-asgi";
license = licenses.mit;
maintainers = with maintainers; [ GaetanLepage ];
};
}
6 changes: 6 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2264,6 +2264,8 @@ self: super: with self; {

clldutils = callPackage ../development/python-modules/clldutils { };

cloudevents = callPackage ../development/python-modules/cloudevents { };

cloudflare = callPackage ../development/python-modules/cloudflare { };

cloudpathlib = callPackage ../development/python-modules/cloudpathlib { };
Expand Down Expand Up @@ -6407,6 +6409,8 @@ self: super: with self; {

krfzf-py = callPackage ../development/python-modules/krfzf-py { };

kserve = callPackage ../development/python-modules/kserve { };

kubernetes = callPackage ../development/python-modules/kubernetes { };

kurbopy = callPackage ../development/python-modules/kurbopy { };
Expand Down Expand Up @@ -15053,6 +15057,8 @@ self: super: with self; {

timezonefinder = callPackage ../development/python-modules/timezonefinder { };

timing-asgi = callPackage ../development/python-modules/timing-asgi { };

timm = callPackage ../development/python-modules/timm { };

tiny-cuda-nn = toPythonModule (pkgs.tiny-cuda-nn.override {
Expand Down