feat(k-radius): Only bring pydantic from python-updates
This commit is contained in:
parent
0e776c909f
commit
5c19f7a787
7 changed files with 219 additions and 18 deletions
|
@ -5,11 +5,10 @@ let
|
||||||
|
|
||||||
settingsFormat = pkgs.formats.toml { };
|
settingsFormat = pkgs.formats.toml { };
|
||||||
|
|
||||||
python3 = (import sources.nixos-python { }).python311;
|
py-pkgs = import ./packages/python { inherit pkgs; };
|
||||||
|
pykanidm =
|
||||||
pykanidm = pkgs.callPackage ./packages/pykanidm.nix { inherit python3; };
|
pkgs.callPackage ./packages/pykanidm.nix { inherit (py-pkgs) pydantic; };
|
||||||
rlm_python =
|
rlm_python = pkgs.callPackage ./packages/rlm_python.nix { inherit pykanidm; };
|
||||||
pkgs.callPackage ./packages/rlm_python.nix { inherit python3 pykanidm; };
|
|
||||||
|
|
||||||
cfg = config.services.k-radius;
|
cfg = config.services.k-radius;
|
||||||
in {
|
in {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ lib, fetchFromGitHub, python3 }:
|
{ lib, fetchFromGitHub, python3, pydantic }:
|
||||||
|
|
||||||
let
|
let
|
||||||
pname = "kanidm";
|
pname = "kanidm";
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
diff --git a/pyproject.toml b/pyproject.toml
|
||||||
|
index 1602e32..507048d 100644
|
||||||
|
--- a/pyproject.toml
|
||||||
|
+++ b/pyproject.toml
|
||||||
|
@@ -72,13 +72,6 @@ filterwarnings = [
|
||||||
|
]
|
||||||
|
timeout = 30
|
||||||
|
xfail_strict = true
|
||||||
|
-# min, max, mean, stddev, median, iqr, outliers, ops, rounds, iterations
|
||||||
|
-addopts = [
|
||||||
|
- '--benchmark-columns', 'min,mean,stddev,outliers,rounds,iterations',
|
||||||
|
- '--benchmark-group-by', 'group',
|
||||||
|
- '--benchmark-warmup', 'on',
|
||||||
|
- '--benchmark-disable', # this is enable by `make benchmark` when you actually want to run benchmarks
|
||||||
|
-]
|
||||||
|
|
||||||
|
[tool.coverage.run]
|
||||||
|
source = ['pydantic_core']
|
12
machines/compute01/k-radius/packages/python/default.nix
Normal file
12
machines/compute01/k-radius/packages/python/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{ pkgs }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs) lib;
|
||||||
|
|
||||||
|
callPackage = lib.callPackageWith (pkgs // pkgs.python3.pkgs // self);
|
||||||
|
|
||||||
|
self = builtins.listToAttrs (builtins.map (name: {
|
||||||
|
inherit name;
|
||||||
|
value = callPackage (./. + "/${name}.nix") { };
|
||||||
|
}) [ "pydantic" "pydantic-core" ]);
|
||||||
|
in self
|
|
@ -0,0 +1,88 @@
|
||||||
|
{ stdenv
|
||||||
|
, lib
|
||||||
|
, buildPythonPackage
|
||||||
|
, fetchFromGitHub
|
||||||
|
, cargo
|
||||||
|
, rustPlatform
|
||||||
|
, rustc
|
||||||
|
, libiconv
|
||||||
|
, typing-extensions
|
||||||
|
, pytestCheckHook
|
||||||
|
, hypothesis
|
||||||
|
, pytest-timeout
|
||||||
|
, pytest-mock
|
||||||
|
, dirty-equals
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
pydantic-core = buildPythonPackage rec {
|
||||||
|
pname = "pydantic-core";
|
||||||
|
version = "2.14.5";
|
||||||
|
format = "pyproject";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "pydantic";
|
||||||
|
repo = "pydantic-core";
|
||||||
|
rev = "refs/tags/v${version}";
|
||||||
|
hash = "sha256-UguZpA3KEutOgIavjx8Ie//0qJq+4FTZNQTwb/ZIgb8=";
|
||||||
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
./01-remove-benchmark-flags.patch
|
||||||
|
];
|
||||||
|
|
||||||
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
||||||
|
inherit src;
|
||||||
|
name = "${pname}-${version}";
|
||||||
|
hash = "sha256-mMgw922QjHmk0yimXfolLNiYZntTsGydQywe7PTNnwc=";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
cargo
|
||||||
|
rustPlatform.cargoSetupHook
|
||||||
|
rustPlatform.maturinBuildHook
|
||||||
|
rustc
|
||||||
|
typing-extensions
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = lib.optionals stdenv.isDarwin [
|
||||||
|
libiconv
|
||||||
|
];
|
||||||
|
|
||||||
|
propagatedBuildInputs = [
|
||||||
|
typing-extensions
|
||||||
|
];
|
||||||
|
|
||||||
|
pythonImportsCheck = [ "pydantic_core" ];
|
||||||
|
|
||||||
|
# escape infinite recursion with pydantic via dirty-equals
|
||||||
|
doCheck = false;
|
||||||
|
passthru.tests.pytest = pydantic-core.overrideAttrs { doCheck = true; };
|
||||||
|
|
||||||
|
nativeCheckInputs = [
|
||||||
|
pytestCheckHook
|
||||||
|
hypothesis
|
||||||
|
pytest-timeout
|
||||||
|
dirty-equals
|
||||||
|
pytest-mock
|
||||||
|
];
|
||||||
|
|
||||||
|
disabledTests = [
|
||||||
|
# RecursionError: maximum recursion depth exceeded while calling a Python object
|
||||||
|
"test_recursive"
|
||||||
|
];
|
||||||
|
|
||||||
|
disabledTestPaths = [
|
||||||
|
# no point in benchmarking in nixpkgs build farm
|
||||||
|
"tests/benchmarks"
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
changelog = "https://github.com/pydantic/pydantic-core/releases/tag/v${version}";
|
||||||
|
description = "Core validation logic for pydantic written in rust";
|
||||||
|
homepage = "https://github.com/pydantic/pydantic-core";
|
||||||
|
license = licenses.mit;
|
||||||
|
maintainers = with maintainers; [ blaggacao ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in pydantic-core
|
96
machines/compute01/k-radius/packages/python/pydantic.nix
Normal file
96
machines/compute01/k-radius/packages/python/pydantic.nix
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
{ lib
|
||||||
|
, buildPythonPackage
|
||||||
|
, fetchFromGitHub
|
||||||
|
, pythonOlder
|
||||||
|
|
||||||
|
# build-system
|
||||||
|
, hatchling
|
||||||
|
, hatch-fancy-pypi-readme
|
||||||
|
|
||||||
|
# native dependencies
|
||||||
|
, libxcrypt
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
, annotated-types
|
||||||
|
, pydantic-core
|
||||||
|
, typing-extensions
|
||||||
|
|
||||||
|
# tests
|
||||||
|
, cloudpickle
|
||||||
|
, email-validator
|
||||||
|
, dirty-equals
|
||||||
|
, faker
|
||||||
|
, pytestCheckHook
|
||||||
|
, pytest-mock
|
||||||
|
}:
|
||||||
|
|
||||||
|
buildPythonPackage rec {
|
||||||
|
pname = "pydantic";
|
||||||
|
version = "2.5.2";
|
||||||
|
pyproject = true;
|
||||||
|
|
||||||
|
disabled = pythonOlder "3.7";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "pydantic";
|
||||||
|
repo = "pydantic";
|
||||||
|
rev = "refs/tags/v${version}";
|
||||||
|
hash = "sha256-D0gYcyrKVVDhBgV9sCVTkGq/kFmIoT9l0i5bRM1qxzM=";
|
||||||
|
};
|
||||||
|
|
||||||
|
buildInputs = lib.optionals (pythonOlder "3.9") [
|
||||||
|
libxcrypt
|
||||||
|
];
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
hatch-fancy-pypi-readme
|
||||||
|
hatchling
|
||||||
|
];
|
||||||
|
|
||||||
|
propagatedBuildInputs = [
|
||||||
|
annotated-types
|
||||||
|
pydantic-core
|
||||||
|
typing-extensions
|
||||||
|
];
|
||||||
|
|
||||||
|
passthru.optional-dependencies = {
|
||||||
|
email = [
|
||||||
|
email-validator
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeCheckInputs = [
|
||||||
|
cloudpickle
|
||||||
|
dirty-equals
|
||||||
|
faker
|
||||||
|
pytest-mock
|
||||||
|
pytestCheckHook
|
||||||
|
] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
|
||||||
|
|
||||||
|
preCheck = ''
|
||||||
|
export HOME=$(mktemp -d)
|
||||||
|
substituteInPlace pyproject.toml \
|
||||||
|
--replace "'--benchmark-columns', 'min,mean,stddev,outliers,rounds,iterations'," "" \
|
||||||
|
--replace "'--benchmark-group-by', 'group'," "" \
|
||||||
|
--replace "'--benchmark-warmup', 'on'," "" \
|
||||||
|
--replace "'--benchmark-disable'," ""
|
||||||
|
'';
|
||||||
|
|
||||||
|
disabledTestPaths = [
|
||||||
|
"tests/benchmarks"
|
||||||
|
|
||||||
|
# avoid cyclic dependency
|
||||||
|
"tests/test_docs.py"
|
||||||
|
];
|
||||||
|
|
||||||
|
pythonImportsCheck = [ "pydantic" ];
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "Data validation and settings management using Python type hinting";
|
||||||
|
homepage = "https://github.com/pydantic/pydantic";
|
||||||
|
changelog = "https://github.com/pydantic/pydantic/blob/v${version}/HISTORY.md";
|
||||||
|
license = licenses.mit;
|
||||||
|
maintainers = with maintainers; [ wd15 ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -108,18 +108,6 @@
|
||||||
"url": "https://releases.nixos.org/nixos/23.11/nixos-23.11.1697.781e2a9797ec/nixexprs.tar.xz",
|
"url": "https://releases.nixos.org/nixos/23.11/nixos-23.11.1697.781e2a9797ec/nixexprs.tar.xz",
|
||||||
"hash": "0c8pky6klmm21m3n659rwa1ls7qk2wjjw2qzxfcagb97kvf5dq58"
|
"hash": "0c8pky6klmm21m3n659rwa1ls7qk2wjjw2qzxfcagb97kvf5dq58"
|
||||||
},
|
},
|
||||||
"nixos-python": {
|
|
||||||
"type": "Git",
|
|
||||||
"repository": {
|
|
||||||
"type": "GitHub",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs"
|
|
||||||
},
|
|
||||||
"branch": "python-updates",
|
|
||||||
"revision": "16874860fc550ef58f3da5ebb8e4fed9c4a26f21",
|
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/16874860fc550ef58f3da5ebb8e4fed9c4a26f21.tar.gz",
|
|
||||||
"hash": "1dfdgvaisbxf39027n671393ly6n5rmjbq1l54ac9jn691kxm0w6"
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"type": "Channel",
|
"type": "Channel",
|
||||||
"name": "nixpkgs-unstable",
|
"name": "nixpkgs-unstable",
|
||||||
|
|
Loading…
Reference in a new issue