about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRyan Lahfa <masterancpp@gmail.com>2022-12-23 18:41:20 +0100
committerGitHub <noreply@github.com>2022-12-23 18:41:20 +0100
commitaae7365f9b93b1d24906a113179ce60d0bda093a (patch)
tree3808b43b5e6dd7bbd1ae723134b0ccfe7862e367
parentfccb0aa8081d8ceaf8222ab3070b7772e98a901b (diff)
parentecee71479aa155d0a0c8ab1d6a4af1ed68709c1a (diff)
Merge pull request #169195 from ambroisie/add-beancount-black
python3Packages.beancount-black: init at 0.1.13
-rw-r--r--pkgs/development/python-modules/beancount-black/default.nix48
-rw-r--r--pkgs/development/python-modules/beancount-parser/default.nix46
-rw-r--r--pkgs/top-level/all-packages.nix2
-rw-r--r--pkgs/top-level/python-packages.nix4
4 files changed, 100 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/beancount-black/default.nix b/pkgs/development/python-modules/beancount-black/default.nix
new file mode 100644
index 0000000000000..81bc8bc058222
--- /dev/null
+++ b/pkgs/development/python-modules/beancount-black/default.nix
@@ -0,0 +1,48 @@
+{ lib
+, fetchFromGitHub
+, buildPythonPackage
+, pythonOlder
+, beancount-parser
+, click
+, poetry-core
+, pytestCheckHook
+}:
+
+buildPythonPackage rec {
+  pname = "beancount-black";
+  version = "0.1.13";
+
+  disabled = pythonOlder "3.9";
+  format = "pyproject";
+
+  src = fetchFromGitHub {
+    owner = "LaunchPlatform";
+    repo = "beancount-black";
+    rev = version;
+    sha256 = "sha256-jhcPR+5+e8d9cbcXC//xuBwmZ14xtXNlYtmH5yNSU0E=";
+  };
+
+  buildInputs = [
+    poetry-core
+  ];
+
+  propagatedBuildInputs = [
+    beancount-parser
+    click
+  ];
+
+  checkInputs = [
+    pytestCheckHook
+  ];
+
+  pythonImportsCheck = [
+    "beancount_black"
+  ];
+
+  meta = with lib; {
+    description = "Opinioned code formatter for Beancount";
+    homepage = "https://github.com/LaunchPlatform/beancount-black/";
+    license = with licenses; [ mit ];
+    maintainers = with maintainers; [ ambroisie ];
+  };
+}
diff --git a/pkgs/development/python-modules/beancount-parser/default.nix b/pkgs/development/python-modules/beancount-parser/default.nix
new file mode 100644
index 0000000000000..743fcec49f936
--- /dev/null
+++ b/pkgs/development/python-modules/beancount-parser/default.nix
@@ -0,0 +1,46 @@
+{ lib
+, fetchFromGitHub
+, buildPythonPackage
+, pythonOlder
+, lark
+, poetry-core
+, pytestCheckHook
+}:
+
+buildPythonPackage rec {
+  pname = "beancount-parser";
+  version = "0.1.21";
+
+  disabled = pythonOlder "3.9";
+  format = "pyproject";
+
+  src = fetchFromGitHub {
+    owner = "LaunchPlatform";
+    repo = "beancount-parser";
+    rev = version;
+    sha256 = "sha256-0uhH75OEjC9iA0XD0VX7CGoRIP/hpM4y+53JnyXgZpA=";
+  };
+
+  buildInputs = [
+    poetry-core
+  ];
+
+  propagatedBuildInputs = [
+    lark
+  ];
+
+  checkInputs = [
+    pytestCheckHook
+  ];
+
+  pythonImportsCheck = [
+    "beancount_parser"
+  ];
+
+  meta = with lib; {
+    description = "Standalone Lark based Beancount syntax parser";
+    homepage = "https://github.com/LaunchPlatform/beancount-parser/";
+    license = with licenses; [ mit ];
+    maintainers = with maintainers; [ ambroisie ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e7b2772e18931..00bf151fb5263 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -33972,6 +33972,8 @@ with pkgs;
 
   beancount = with python3.pkgs; toPythonApplication beancount;
 
+  beancount-black = with python3.pkgs; toPythonApplication beancount-black;
+
   beancount-language-server = callPackage ../development/tools/beancount-language-server {};
 
   bean-add = callPackage ../applications/office/beancount/bean-add.nix { };
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 405b9de1c9db8..8f185b18634d7 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -1188,6 +1188,10 @@ self: super: with self; {
 
   beancount = callPackage ../development/python-modules/beancount { };
 
+  beancount-black = callPackage ../development/python-modules/beancount-black { };
+
+  beancount-parser = callPackage ../development/python-modules/beancount-parser { };
+
   beancount_docverif = callPackage ../development/python-modules/beancount_docverif { };
 
   beanstalkc = callPackage ../development/python-modules/beanstalkc { };