1{ lib, python3Packages, fetchpatch }:
2
3python3Packages.buildPythonApplication rec {
4 pname = "pgcli";
5 version = "2.0.2";
6
7 # Python 2 won't have prompt_toolkit 2.x.x
8 # See: https://github.com/NixOS/nixpkgs/blob/f49e2ad3657dede09dc998a4a98fd5033fb52243/pkgs/top-level/python-packages.nix#L3408
9 disabled = python3Packages.isPy27;
10
11 src = python3Packages.fetchPypi {
12 inherit pname version;
13 sha256 = "1p4j2dbcfxd3kz86qi519jkqjx1mg5wdgn1gxdjx3lk1vpsd7x04";
14 };
15
16 patches = [
17 (fetchpatch {
18 # TODO: Remove with next pgcli release. Fixes TypeError in tests
19 # https://github.com/dbcli/pgcli/pull/1006
20 url = https://github.com/dbcli/pgcli/commit/351135b61ef9ad3184c49a406544708daf589fe3.patch;
21 sha256 = "08131y0lv1v760i0ypcx2hljx066ks93kp96xkv3bycxnavvcl53";
22 excludes = [ "changelog.rst" ];
23 })
24 ];
25
26 propagatedBuildInputs = with python3Packages; [
27 cli-helpers click configobj humanize prompt_toolkit psycopg2
28 pygments sqlparse pgspecial setproctitle keyring
29 ];
30
31 checkInputs = with python3Packages; [ pytest mock ];
32
33 checkPhase = ''
34 pytest
35 '';
36
37 meta = with lib; {
38 description = "Command-line interface for PostgreSQL";
39 longDescription = ''
40 Rich command-line interface for PostgreSQL with auto-completion and
41 syntax highlighting.
42 '';
43 homepage = https://pgcli.com;
44 license = licenses.bsd3;
45 maintainers = with maintainers; [ dywedir ];
46 };
47}