pyton312Packages.arelle: 18.3 -> 2.30.25, unbreak, refactor (#337284)

This commit is contained in:
Austin Horstman 2024-11-09 16:17:08 -06:00 committed by GitHub
commit 2b3acacf08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 199 additions and 66 deletions

View File

@ -1,87 +1,160 @@
{
gui ? true,
lib,
buildPythonPackage,
fetchFromGitHub,
lib,
sphinx,
lxml,
setuptools,
setuptools-scm,
certifi,
filelock,
isodate,
lxml,
numpy,
openpyxl,
tkinter ? null,
py3to2,
isPy3k,
python,
...
pyparsing,
python-dateutil,
regex,
gui ? true,
tkinter,
pycryptodome,
pg8000,
pymysql,
pyodbc,
rdflib,
holidays,
pytz,
tinycss2,
graphviz,
cheroot,
cherrypy,
tornado,
sphinxHook,
sphinx-autodoc2,
myst-parser,
sphinx-copybutton,
furo,
pytestCheckHook,
boto3,
}:
buildPythonPackage rec {
pname = "arelle${lib.optionalString (!gui) "-headless"}";
version = "18.3";
format = "setuptools";
version = "2.30.25";
pyproject = true;
disabled = !isPy3k;
# Releases are published at http://arelle.org/download/ but sadly no
# tags are published on github.
src = fetchFromGitHub {
owner = "Arelle";
repo = "Arelle";
rev = "edgr${version}";
sha256 = "12a94ipdp6xalqyds7rcp6cjwps6fbj3byigzfy403hlqc9n1g33";
rev = "refs/tags/${version}";
hash = "sha256-xzTrFie97HDIqPZ4nzCh+0p/w0bTK12cS0FSsuIi7tY=";
};
outputs = [
"out"
"doc"
];
patches = [ ./tests.patch ];
postPatch = "rm testParser2.py";
nativeBuildInputs = [
sphinx
py3to2
postPatch = ''
substituteInPlace pyproject.toml --replace-fail \
'requires = ["setuptools~=73.0", "wheel~=0.44", "setuptools_scm[toml]~=8.1"]' \
'requires = ["setuptools", "wheel", "setuptools_scm[toml]"]'
# Darwin currently doesn't have the native `_decimal` module
# Instead, we'll use the wrapper `decimal` module that can fall back to python based implementation
# These lines can be removed after https://github.com/NixOS/nixpkgs/pull/354125 hits master
substituteInPlace arelle/Validate{DuplicateFacts,XbrlCalcs}.py tests/unit_tests/arelle/test_{xmlvalidate,validatexbrlcalcs}.py \
--replace-fail 'from _decimal import' 'from decimal import'
'';
build-system = [
setuptools
setuptools-scm
];
propagatedBuildInputs = [
lxml
dependencies = [
certifi
filelock
isodate
lxml
numpy
openpyxl
pyparsing
python-dateutil
regex
] ++ lib.optionals gui [ tkinter ];
# arelle-gui is useless without gui dependencies, so delete it when !gui.
postInstall =
lib.optionalString (!gui) ''
find $out/bin -name "*arelle-gui*" -delete
''
+
# By default, not the entirety of the src dir is copied. This means we don't
# copy the `images` dir, which is needed for the gui version.
lib.optionalString (gui) ''
targetDir=$out/${python.sitePackages}
cp -vr $src/arelle $targetDir
'';
optional-dependencies = {
crypto = [ pycryptodome ];
db = [
pg8000
pymysql
pyodbc
rdflib
];
efm = [
holidays
pytz
];
esef = [ tinycss2 ];
objectmaker = [ graphviz ];
webserver = [
cheroot
cherrypy
tornado
];
};
# Documentation
postBuild = ''
(cd apidocs && make html && cp -r _build $doc)
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
'';
doCheck = false;
nativeCheckInputs = [
pytestCheckHook
boto3
] ++ lib.flatten (lib.attrValues optional-dependencies);
checkPhase = ''
py.test
preCheck = ''
export HOME=$(mktemp -d)
'';
meta = with lib; {
description =
''
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";
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"}.
'';
mainProgram = "arelle";
homepage = "http://arelle.org/";
license = licenses.asl20;
platforms = platforms.all;
maintainers = with maintainers; [ roberth ];
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [
tomasajt
roberth
];
};
}

View File

@ -1,14 +0,0 @@
diff --git c/arelle/CntlrProfiler.py i/arelle/CntlrProfiler.py
index a64bb1b..dc0299d 100644
--- c/arelle/CntlrProfiler.py
+++ i/arelle/CntlrProfiler.py
@@ -1,5 +1,6 @@
-import Cntlr, ModelManager, FileSource, time
+from arelle import Cntlr, ModelManager, FileSource
+import time
from optparse import OptionParser
import cProfile
import gettext
diff --git c/arelle/ValidateFilingText.py i/arelle/ValidateFilingText.py
index 12dbbbb..c0e98c3 100644

View File

@ -0,0 +1,72 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
pythonOlder,
flit-core,
astroid,
typing-extensions,
typer,
pytestCheckHook,
pytest-regressions,
sphinx,
defusedxml,
}:
buildPythonPackage rec {
pname = "sphinx-autodoc2";
version = "0.5.0";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "sphinx-extensions2";
repo = "sphinx-autodoc2";
rev = "refs/tags/v${version}";
hash = "sha256-Wu079THK1mHVilD2Fx9dIzuIOOYOXpo/EMxVczNutCI=";
};
build-system = [ flit-core ];
dependencies = [
astroid
typing-extensions
# cli deps
typer
] ++ typer.optional-dependencies.standard;
preCheck = ''
# make sphinx_path an alias of pathlib.Path, since sphinx_path was removed in Sphinx v7.2.0
substituteInPlace tests/test_render.py --replace-fail \
'from sphinx.testing.util import path as sphinx_path' \
'sphinx_path = Path'
'';
nativeCheckInputs = [
pytestCheckHook
pytest-regressions
sphinx
defusedxml
];
disabledTests = [
# some generated files differ in newer versions of Sphinx
"test_sphinx_build_directives"
];
pythonImportsCheck = [ "autodoc2" ];
meta = {
changelog = "https://github.com/sphinx-extensions2/sphinx-autodoc2/releases/tag/v${version}";
homepage = "https://github.com/sphinx-extensions2/sphinx-autodoc2";
description = "Sphinx extension that automatically generates API documentation for your Python packages";
license = lib.licenses.mit;
mainProgram = "autodoc2";
maintainers = with lib.maintainers; [ tomasajt ];
};
}

View File

@ -15013,6 +15013,8 @@ self: super: with self; {
sphinx-autodoc-typehints = callPackage ../development/python-modules/sphinx-autodoc-typehints { };
sphinx-autodoc2 = callPackage ../development/python-modules/sphinx-autodoc2 { };
sphinx-basic-ng = callPackage ../development/python-modules/sphinx-basic-ng { };
sphinx-copybutton = callPackage ../development/python-modules/sphinx-copybutton { };