python3Packages.arelle: 2.30.25 -> 2.37.59 (#444607)
* python3Packages.arelle: 2.30.25 -> 2.37.59 Diff: https://github.com/Arelle/Arelle/compare/2.30.25...2.37.59 Changelog: https://github.com/Arelle/Arelle/releases/tag/2.37.59 * arelle: Add tests.cli --------- Co-authored-by: Robert Hensing <robert@roberthensing.nl> Co-authored-by: TomaSajt <62384384+TomaSajt@users.noreply.github.com>
This commit is contained in:
co-authored by
Robert Hensing
TomaSajt
parent
b6877eb3e1
commit
47cbdfb1c7
@@ -1,21 +1,26 @@
|
||||
{
|
||||
callPackage,
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
pythonAtLeast,
|
||||
fetchFromGitHub,
|
||||
|
||||
setuptools,
|
||||
setuptools-scm,
|
||||
|
||||
bottle,
|
||||
certifi,
|
||||
filelock,
|
||||
isodate,
|
||||
jsonschema,
|
||||
lxml,
|
||||
numpy,
|
||||
openpyxl,
|
||||
pillow,
|
||||
pyparsing,
|
||||
python-dateutil,
|
||||
regex,
|
||||
truststore,
|
||||
typing-extensions,
|
||||
|
||||
gui ? true,
|
||||
tkinter,
|
||||
@@ -43,116 +48,131 @@
|
||||
boto3,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "arelle${lib.optionalString (!gui) "-headless"}";
|
||||
version = "2.30.25";
|
||||
pyproject = true;
|
||||
# ideally we'd use finalAttrs.finalPackage instead of lib.fix for self-reference,
|
||||
# but buildPythonPackage doesn't support it yet
|
||||
lib.fix (
|
||||
self:
|
||||
buildPythonPackage rec {
|
||||
pname = "arelle${lib.optionalString (!gui) "-headless"}";
|
||||
version = "2.37.59";
|
||||
pyproject = true;
|
||||
|
||||
disabled = pythonAtLeast "3.13"; # Note: when updating, check if this is still needed
|
||||
src = fetchFromGitHub {
|
||||
owner = "Arelle";
|
||||
repo = "Arelle";
|
||||
tag = version;
|
||||
hash = "sha256-ao4OKe3e1V3Df7396gVn4nqmpKNAbs5ny2y/GsxQwcE=";
|
||||
};
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Arelle";
|
||||
repo = "Arelle";
|
||||
tag = version;
|
||||
hash = "sha256-xzTrFie97HDIqPZ4nzCh+0p/w0bTK12cS0FSsuIi7tY=";
|
||||
};
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"doc"
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace pyproject.toml --replace-fail \
|
||||
'requires = ["setuptools~=73.0", "wheel~=0.44", "setuptools_scm[toml]~=8.1"]' \
|
||||
'requires = ["setuptools", "wheel", "setuptools_scm[toml]"]'
|
||||
'';
|
||||
|
||||
build-system = [
|
||||
setuptools
|
||||
setuptools-scm
|
||||
];
|
||||
|
||||
dependencies = [
|
||||
certifi
|
||||
filelock
|
||||
isodate
|
||||
lxml
|
||||
numpy
|
||||
openpyxl
|
||||
pyparsing
|
||||
python-dateutil
|
||||
regex
|
||||
]
|
||||
++ lib.optionals gui [ tkinter ];
|
||||
|
||||
optional-dependencies = {
|
||||
crypto = [ pycryptodome ];
|
||||
db = [
|
||||
pg8000
|
||||
pymysql
|
||||
pyodbc
|
||||
rdflib
|
||||
outputs = [
|
||||
"out"
|
||||
"doc"
|
||||
];
|
||||
efm = [
|
||||
holidays
|
||||
pytz
|
||||
];
|
||||
esef = [ tinycss2 ];
|
||||
objectmaker = [ graphviz ];
|
||||
webserver = [
|
||||
cheroot
|
||||
cherrypy
|
||||
tornado
|
||||
];
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
# deps for docs
|
||||
sphinxHook
|
||||
sphinx-autodoc2
|
||||
myst-parser
|
||||
sphinx-copybutton
|
||||
furo
|
||||
];
|
||||
|
||||
# the arelleGUI executable doesn't work when the gui option is false
|
||||
postInstall = lib.optionalString (!gui) ''
|
||||
find $out/bin -name "*arelleGUI*" -delete
|
||||
'';
|
||||
|
||||
nativeCheckInputs = [
|
||||
pytestCheckHook
|
||||
boto3
|
||||
]
|
||||
++ lib.flatten (lib.attrValues optional-dependencies);
|
||||
|
||||
preCheck = ''
|
||||
export HOME=$(mktemp -d)
|
||||
'';
|
||||
|
||||
disabledTestPaths = [
|
||||
"tests/integration_tests"
|
||||
]
|
||||
++ lib.optionals (!gui) [
|
||||
# these tests import tkinter
|
||||
"tests/unit_tests/arelle/test_updater.py"
|
||||
"tests/unit_tests/arelle/test_import.py"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Open source XBRL platform";
|
||||
longDescription = ''
|
||||
An open source facility for XBRL, the eXtensible Business Reporting
|
||||
Language supporting various standards, exposed through a Python or
|
||||
REST API ${lib.optionalString gui " and a graphical user interface"}.
|
||||
postPatch = ''
|
||||
substituteInPlace pyproject.toml --replace-fail \
|
||||
'requires = ["setuptools>=80.9,<81", "wheel>=0.45,<1", "setuptools_scm[toml]>=9.2,<10"]' \
|
||||
'requires = ["setuptools", "wheel", "setuptools_scm[toml]"]'
|
||||
'';
|
||||
mainProgram = "arelle";
|
||||
homepage = "http://arelle.org/";
|
||||
license = lib.licenses.asl20;
|
||||
maintainers = with lib.maintainers; [
|
||||
tomasajt
|
||||
roberth
|
||||
|
||||
build-system = [
|
||||
setuptools
|
||||
setuptools-scm
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
dependencies = [
|
||||
bottle
|
||||
certifi
|
||||
filelock
|
||||
isodate
|
||||
jsonschema
|
||||
lxml
|
||||
numpy
|
||||
openpyxl
|
||||
pillow
|
||||
pyparsing
|
||||
python-dateutil
|
||||
regex
|
||||
truststore
|
||||
typing-extensions
|
||||
]
|
||||
++ lib.optionals gui [ tkinter ];
|
||||
|
||||
optional-dependencies = {
|
||||
crypto = [ pycryptodome ];
|
||||
db = [
|
||||
pg8000
|
||||
pymysql
|
||||
pyodbc
|
||||
rdflib
|
||||
];
|
||||
efm = [
|
||||
holidays
|
||||
pytz
|
||||
];
|
||||
esef = [ tinycss2 ];
|
||||
objectmaker = [ graphviz ];
|
||||
webserver = [
|
||||
cheroot
|
||||
cherrypy
|
||||
tornado
|
||||
];
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
# deps for docs
|
||||
sphinxHook
|
||||
sphinx-autodoc2
|
||||
myst-parser
|
||||
sphinx-copybutton
|
||||
furo
|
||||
];
|
||||
|
||||
# the arelleGUI executable doesn't work when the gui option is false
|
||||
postInstall = lib.optionalString (!gui) ''
|
||||
find $out/bin -name "*arelleGUI*" -delete
|
||||
'';
|
||||
|
||||
nativeCheckInputs = [
|
||||
pytestCheckHook
|
||||
boto3
|
||||
]
|
||||
++ lib.flatten (lib.attrValues optional-dependencies);
|
||||
|
||||
preCheck = ''
|
||||
export HOME=$(mktemp -d)
|
||||
'';
|
||||
|
||||
disabledTestPaths = [
|
||||
"tests/integration_tests"
|
||||
]
|
||||
++ lib.optionals (!gui) [
|
||||
# these tests import tkinter
|
||||
"tests/unit_tests/arelle/test_updater.py"
|
||||
"tests/unit_tests/arelle/test_import.py"
|
||||
];
|
||||
|
||||
passthru.hasGUI = gui;
|
||||
|
||||
passthru.tests = {
|
||||
cli = callPackage ./test-cli.nix { arelle = self; };
|
||||
};
|
||||
|
||||
meta = {
|
||||
changelog = "https://github.com/Arelle/Arelle/releases/tag/${src.tag}";
|
||||
description = "Open source XBRL platform";
|
||||
longDescription = ''
|
||||
An open source facility for XBRL, the eXtensible Business Reporting
|
||||
Language supporting various standards, exposed through a Python or
|
||||
REST API ${lib.optionalString gui " and a graphical user interface"}.
|
||||
'';
|
||||
mainProgram = "arelle";
|
||||
homepage = "http://arelle.org/";
|
||||
license = lib.licenses.asl20;
|
||||
maintainers = with lib.maintainers; [
|
||||
tomasajt
|
||||
roberth
|
||||
];
|
||||
};
|
||||
}
|
||||
)
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
# Run with:
|
||||
# cd nixpkgs
|
||||
# nix-build -A python3Packages.arelle.passthru.tests.cli
|
||||
#
|
||||
# Note: These are uninteresting generated smoke tests to verify basic functionality
|
||||
{
|
||||
lib,
|
||||
runCommand,
|
||||
arelle,
|
||||
}:
|
||||
|
||||
runCommand "arelle-test-cli${lib.optionalString (!arelle.hasGUI) "-headless"}"
|
||||
{
|
||||
nativeBuildInputs = [ arelle ];
|
||||
}
|
||||
''
|
||||
# Set up temporary home directory
|
||||
export HOME=$(mktemp -d)
|
||||
|
||||
# Test basic CLI commands work with proper assertions
|
||||
arelleCmdLine --version --disablePersistentConfig 2>&1 | grep "Arelle(r) 2.37.59" > /dev/null
|
||||
arelleCmdLine --help --disablePersistentConfig 2>&1 | grep "Usage: arelleCmdLine \[options\]" > /dev/null
|
||||
arelleCmdLine --about --disablePersistentConfig 2>&1 | grep "An open source XBRL platform" > /dev/null
|
||||
|
||||
${lib.optionalString arelle.hasGUI ''
|
||||
# check if the arelleGUI command is available
|
||||
command -v arelleGUI
|
||||
''}
|
||||
|
||||
# Create a simple but valid XBRL instance for testing validation functionality
|
||||
cat > test-instance.xbrl << 'EOF'
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xbrl xmlns="http://www.xbrl.org/2003/instance"
|
||||
xmlns:link="http://www.xbrl.org/2003/linkbase"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<link:schemaRef xlink:href="http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd" xlink:type="simple"/>
|
||||
|
||||
<context id="test_context">
|
||||
<entity>
|
||||
<identifier scheme="http://example.com/entities">TEST_ENTITY</identifier>
|
||||
</entity>
|
||||
<period>
|
||||
<instant>2023-12-31</instant>
|
||||
</period>
|
||||
</context>
|
||||
|
||||
</xbrl>
|
||||
EOF
|
||||
|
||||
# Also create a minimal test schema for more comprehensive testing
|
||||
cat > test-schema.xsd << 'EOF'
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schema xmlns="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xbrli="http://www.xbrl.org/2003/instance"
|
||||
xmlns:link="http://www.xbrl.org/2003/linkbase"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:test="http://example.com/test"
|
||||
targetNamespace="http://example.com/test"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<import namespace="http://www.xbrl.org/2003/instance"
|
||||
schemaLocation="http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd"/>
|
||||
|
||||
<element name="TestElement" type="xbrli:stringItemType"
|
||||
substitutionGroup="xbrli:item" xbrli:periodType="instant"/>
|
||||
|
||||
</schema>
|
||||
EOF
|
||||
|
||||
# Test XBRL validation functionality
|
||||
arelleCmdLine \
|
||||
--file test-instance.xbrl \
|
||||
--validate \
|
||||
--disablePersistentConfig \
|
||||
--internetConnectivity=offline \
|
||||
--logLevel=info 2>&1 | grep "\[info\] validated in .* secs - .*test-instance.xbrl" > /dev/null
|
||||
|
||||
# Test with the built-in empty instance from arelle config
|
||||
arelleCmdLine \
|
||||
--file "${arelle}/lib/python3.13/site-packages/arelle/config/empty-instance.xml" \
|
||||
--validate \
|
||||
--disablePersistentConfig \
|
||||
--internetConnectivity=offline \
|
||||
--logLevel=info 2>&1 | grep "\[info\] validated in .* secs - .*empty-instance.xml" > /dev/null
|
||||
|
||||
# Test formula functionality (without running - just checking it loads)
|
||||
arelleCmdLine \
|
||||
--file test-instance.xbrl \
|
||||
--formula=none \
|
||||
--disablePersistentConfig \
|
||||
--internetConnectivity=offline 2>&1 | grep "\[info\] loaded in .* secs.*test-instance.xbrl" > /dev/null
|
||||
|
||||
# Test facts output functionality
|
||||
TEMP_DIR=$(mktemp -d)
|
||||
arelleCmdLine \
|
||||
--file test-instance.xbrl \
|
||||
--facts="$TEMP_DIR/test-facts.csv" \
|
||||
--disablePersistentConfig \
|
||||
--internetConnectivity=offline 2>&1 | grep "\[info\] loaded in .* secs.*test-instance.xbrl" > /dev/null
|
||||
|
||||
# Test schema validation
|
||||
arelleCmdLine \
|
||||
--file test-schema.xsd \
|
||||
--validate \
|
||||
--disablePersistentConfig \
|
||||
--internetConnectivity=offline \
|
||||
--logLevel=info 2>&1 | grep "\[info\] validated in .* secs - .*test-schema.xsd" > /dev/null
|
||||
|
||||
# Test disclosure system validation option
|
||||
arelleCmdLine \
|
||||
--disclosureSystem=help \
|
||||
--disablePersistentConfig 2>&1 | grep "Disclosure system choices:" > /dev/null
|
||||
|
||||
# Create success marker
|
||||
touch $out
|
||||
''
|
||||
Reference in New Issue
Block a user