Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python312Packages.beancount3: init at 3.0.0 #371541

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions pkgs/by-name/fa/fava/package.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
lib,
python3Packages,
fetchPypi,
python3Packages,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is very cumbersome to override python3Packages to build fava with beancount3 due to the strange design in python3Packages. Can we just build fava with beancount3? May this cause compatibility issues?

Copy link
Contributor Author

@alapshin alapshin Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it help if, instead of accepting python3Packages, the package accepted beancount dependency directly? I think this wouldn't work since package uses buildPythonApplication

It is possible to build Fava either with v2 or v3, but as far as I understand depending on version used Fava uses different approach for importers under the hood

https://github.com/beancount/fava/blob/main/CHANGES

For importers, this sticks to beancount.ingest on v2 and used beangulp for v3.
Due to changes related to duplicate detection, duplicate detection is not
automatically done by Fava here but can still be manually specified as hooks.

Also, I'm not sure if it is a good idea to mix-match beancount version between different packages (fava, beanprice, beanquery, beangulp, etc.).

}:

python3Packages.buildPythonApplication rec {
pname = "fava";
version = "1.29";
version = "1.30";
pyproject = true;

src = fetchPypi {
inherit pname version;
hash = "sha256-UZZ142FchYXqPtHb6EWnKjV+xtJ0Gvu+SovTH6+kVn8=";
hash = "sha256-HBvsFflKGPVlHc9pHB8VCGGD1WLDT9TbjL1V41C3hKU=";
};

postPatch = ''
Expand All @@ -24,6 +24,8 @@ python3Packages.buildPythonApplication rec {
dependencies = with python3Packages; [
babel
beancount
beangulp
beanquery
cheroot
click
flask
Expand All @@ -39,9 +41,14 @@ python3Packages.buildPythonApplication rec {

nativeCheckInputs = [ python3Packages.pytestCheckHook ];

preCheck = ''
export HOME=$TEMPDIR
'';
preCheck =
''
export HOME=$TEMPDIR
''
# Disable some tests when building with beancount2
+ lib.optionalString (lib.versions.major python3Packages.beancount.version == "2") ''
export SNAPSHOT_IGNORE=true
'';

meta = with lib; {
description = "Web interface for beancount";
Expand Down
66 changes: 66 additions & 0 deletions pkgs/development/python-modules/beancount/3.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
lib,
beautifulsoup4,
buildPythonPackage,
click,
fetchPypi,
isPy3k,
meson,
meson-python,
pytestCheckHook,
python-dateutil,
regex,
}:

buildPythonPackage rec {
version = "3.0.0";
pname = "beancount";
pyproject = true;

disabled = !isPy3k;

src = fetchPypi {
inherit pname version;
hash = "sha256-z2aGhpx+o+78CU7hPthmv196K7DGHk1PXfPjX4Rs/98=";
};

# Tests require files not included in the PyPI archive.
# Also there is an import error after migration to meson build.
doCheck = false;

build-system = [
meson
meson-python
];

depedencies = [
click
python-dateutil
regex
];

nativeCheckInputs = [
pytestCheckHook
];

propagatedBuildInputs = [
beautifulsoup4
click
python-dateutil
regex
];

pythonImportsCheck = [ "beancount" ];

meta = with lib; {
homepage = "https://github.com/beancount/beancount";
description = "Double-entry bookkeeping computer language";
longDescription = ''
A double-entry bookkeeping computer language that lets you define
financial transaction records in a text file, read them in memory,
generate a variety of reports from them, and provides a web interface.
'';
license = licenses.gpl2Only;
maintainers = with maintainers; [ bhipple ];
};
}
57 changes: 57 additions & 0 deletions pkgs/development/python-modules/beangulp/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
lib,
beancount,
buildPythonPackage,
chardet,
click,
fetchFromGitHub,
lxml,
petl,
python-magic,
pytestCheckHook,
regex,
setuptools,
}:
buildPythonPackage {
pname = "beangulp";
version = "0.2.0-unstable-2025-01-02";
pyproject = true;

src = fetchFromGitHub {
owner = "beancount";
repo = "beangulp";
rev = "f8d2bc5da40e74461772dcb8e8394fa3c1b2a65d";
hash = "sha256-uAVsZI+yKdtkS7b9sUIxzzrqouYVwYHopqSIrKF5mmw=";
};

build-system = [ setuptools ];

dependencies = [
beancount
chardet
click
lxml
python-magic
];

nativeCheckInputs = [
petl
pytestCheckHook
regex
];

pythonImportsCheck = [
"beangulp"
];

meta = {
homepage = "https://github.com/beancount/beangulp";
description = "Importers framework for Beancount";
longDescription = ''
Beangulp provides a framework for importing transactions into a Beancoount
ledger from account statements and other documents and for managing documents.
'';
license = lib.licenses.gpl2Only;
maintainers = with lib.maintainers; [ alapshin ];
};
}
42 changes: 42 additions & 0 deletions pkgs/development/python-modules/petl/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
lib,
buildPythonPackage,
fetchPypi,
pytestCheckHook,
setuptools,
setuptools-scm,
}:
buildPythonPackage rec {
pname = "petl";
version = "1.7.15";
pyproject = true;

src = fetchPypi {
inherit pname version;
hash = "sha256-jjFDg4CtUVUlOYZa07GrZV3htTG9A5gMhx7Cz/SoxBQ=";
};

build-system = [
setuptools
setuptools-scm
];

nativeCheckInputs = [
pytestCheckHook
];

pythonImportsCheck = [
"petl"
];

meta = {
homepage = "https://github.com/petl-developers/petl";
description = "Python Extract Transform and Load Tables of Data";
longDescription = ''
A general purpose Python package for extracting, transforming and loading
tables of data.
'';
license = lib.licenses.mit;
mainProgram = "petl";
};
}
1 change: 1 addition & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16148,6 +16148,7 @@ with pkgs;
samplv1 = libsForQt5.callPackage ../applications/audio/samplv1 { };

beancount = with python3.pkgs; toPythonApplication beancount;
beancount3 = with python3.pkgs; toPythonApplication beancount3;

beancount-black = with python3.pkgs; toPythonApplication beancount-black;

Expand Down
6 changes: 6 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,8 @@ self: super: with self; {

beancount = callPackage ../development/python-modules/beancount { };

beancount3 = callPackage ../development/python-modules/beancount/3.nix { };

beancount-black = callPackage ../development/python-modules/beancount-black { };

beancount-parser = callPackage ../development/python-modules/beancount-parser { };
Expand All @@ -1583,6 +1585,8 @@ self: super: with self; {

beancount-plugin-utils = callPackage ../development/python-modules/beancount-plugin-utils { };

beangulp = callPackage ../development/python-modules/beangulp { };

beanhub-cli = callPackage ../development/python-modules/beanhub-cli { };

beanhub-extract = callPackage ../development/python-modules/beanhub-extract { };
Expand Down Expand Up @@ -9427,6 +9431,8 @@ self: super: with self; {

nxt-python = callPackage ../development/python-modules/nxt-python { };

petl = callPackage ../development/python-modules/petl { };

plugp100 = callPackage ../development/python-modules/plugp100 {};

python-bugzilla = callPackage ../development/python-modules/python-bugzilla { };
Expand Down