rdbtools does not only provide a CLI, but also a python library for
parsing Redis dump.rdb files from other python code [1]:
```
❯ $(nix-build -E 'with import ./. {}; python3.withPackages (p: [p.rdbtools])')/bin/python
Python 3.12.9 (main, Feb 4 2025, 14:38:38) [GCC 14.2.1 20241116] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import rdbtools
>>> rdbtools.VERSION
(0, 1, 15)
```
This exposes/moves it in the python package set, and uses a
toPythonApplication stub in pkgs/by-name, as in the nixpkgs
documentation.
We also fix (some of) the tests, which were previously skipped
alltogether.
[1]: https://github.com/sripathikrishnan/redis-rdb-tools?tab=readme-ov-file#using-the-parser
55 lines
1.2 KiB
Nix
55 lines
1.2 KiB
Nix
{
|
|
lib,
|
|
fetchFromGitHub,
|
|
buildPythonPackage,
|
|
setuptools,
|
|
distutils,
|
|
redis,
|
|
unittestCheckHook,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "rdbtools";
|
|
version = "0.1.15";
|
|
pyproject = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "sripathikrishnan";
|
|
repo = "redis-rdb-tools";
|
|
tag = "rdbtools-${version}";
|
|
hash = "sha256-6Ht8NuyvzbS7+MeJoVC/AtlXgKwtWwUQ+n5v+mtv/2g=";
|
|
};
|
|
|
|
patches = [
|
|
# https://github.com/sripathikrishnan/redis-rdb-tools/pull/205
|
|
./0001-parser_tests-replace-self.assert_-with-specific-asse.patch
|
|
./0002-tests-self.assertEquals-self.assertEqual.patch
|
|
|
|
# These seem to be broken
|
|
./0001-callback_tests-skip-test_all_dumps.patch
|
|
];
|
|
|
|
build-system = [
|
|
setuptools
|
|
];
|
|
|
|
dependencies = [
|
|
distutils
|
|
redis
|
|
];
|
|
|
|
nativeCheckInputs = [
|
|
unittestCheckHook
|
|
];
|
|
|
|
pythonImportsCheck = [ "rdbtools" ];
|
|
|
|
meta = {
|
|
description = "Parse Redis dump.rdb files, Analyze Memory, and Export Data to JSON";
|
|
homepage = "https://github.com/sripathikrishnan/redis-rdb-tools";
|
|
changelog = "https://github.com/sripathikrishnan/redis-rdb-tools/blob/rdbtools-${version}/CHANGES";
|
|
license = lib.licenses.mit;
|
|
maintainers = with lib.maintainers; [ offline ];
|
|
};
|
|
}
|