patroni: cleanup and split deps into optional-dependencies

This commit is contained in:
DESPsyched
2026-02-23 01:37:18 -05:00
parent 39552aec52
commit cd28ed9229
+66 -36
View File
@@ -1,55 +1,84 @@
{
lib,
python3Packages,
fetchFromGitHub,
versionCheckHook,
nixosTests,
lib,
nix-update-script,
writableTmpDirAsHomeHook,
nixosTests,
python3Packages,
versionCheckHook,
extras ? [
# upstream requires one of: psycopg, psycopg2
"psycopg2"
# distributed configuration stores
"consul"
"etcd"
"etcd3"
"exhibitor"
"kubernetes"
"raft"
"zookeeper"
],
}:
python3Packages.buildPythonApplication (finalAttrs: {
pname = "patroni";
version = "4.1.0";
format = "setuptools";
pyproject = true;
src = fetchFromGitHub {
owner = "zalando";
repo = "patroni";
tag = "v${finalAttrs.version}";
sha256 = "sha256-iY5QLbJXfQtfkzpQxvqSOzYQwgfFsBh8HPYujqxU44k=";
hash = "sha256-iY5QLbJXfQtfkzpQxvqSOzYQwgfFsBh8HPYujqxU44k=";
};
dependencies = with python3Packages; [
boto3
click
consul
dnspython
kazoo
kubernetes
prettytable
psutil
psycopg2
pysyncobj
python-dateutil
python-etcd
pyyaml
tzlocal
urllib3
ydiff
build-system = with python3Packages; [ setuptools ];
pythonRelaxDeps = [
"ydiff" # requires <1.5
];
dependencies =
(with python3Packages; [
click
consul
prettytable
psutil
python-dateutil
pyyaml
urllib3
ydiff
])
++ lib.attrVals extras finalAttrs.passthru.optional-dependencies;
optional-dependencies = with python3Packages; {
aws = [ boto3 ];
consul = [ consul ];
etcd = [ python-etcd ];
etcd3 = [ python-etcd ];
exhibitor = [ kazoo ];
jsonlogger = [ python-json-logger ];
kubernetes = [ ];
psycopg2 = [ psycopg2 ];
psycopg2-binary = [ psycopg2-binary ];
psycopg3 = [ psycopg ];
raft = [
cryptography
pysyncobj
];
systemd = [ systemd-python ];
zookeeper = [ kazoo ];
};
pythonImportsCheck = [ "patroni" ];
nativeCheckInputs = with python3Packages; [
flake8
mock
pytestCheckHook
pytest-cov-stub
requests
versionCheckHook
writableTmpDirAsHomeHook
];
nativeCheckInputs =
(with python3Packages; [
pytestCheckHook
versionCheckHook
])
++ lib.concatAttrValues finalAttrs.passthru.optional-dependencies;
__darwinAllowLocalNetworking = true;
@@ -60,14 +89,15 @@ python3Packages.buildPythonApplication (finalAttrs: {
};
meta = {
homepage = "https://patroni.readthedocs.io/en/latest/";
changelog = "https://github.com/patroni/patroni/blob/${finalAttrs.src.tag}/docs/releases.rst";
description = "Template for PostgreSQL HA with ZooKeeper, etcd or Consul";
changelog = "https://github.com/patroni/patroni/blob/v${finalAttrs.version}/docs/releases.rst";
homepage = "https://patroni.readthedocs.io/en/latest/";
license = lib.licenses.mit;
platforms = lib.platforms.unix;
mainProgram = "patroni";
maintainers = with lib.maintainers; [
de11n
despsyched
];
platforms = lib.platforms.unix;
};
})