From a44e0fe3dc9f51fbd384bb367b72754d1a4a8234 Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Sun, 25 Aug 2024 17:52:28 +0200 Subject: [PATCH 1/2] pyton312Packages.sphinx-autodoc2: init at 0.5.0 --- .../sphinx-autodoc2/default.nix | 72 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 74 insertions(+) create mode 100644 pkgs/development/python-modules/sphinx-autodoc2/default.nix diff --git a/pkgs/development/python-modules/sphinx-autodoc2/default.nix b/pkgs/development/python-modules/sphinx-autodoc2/default.nix new file mode 100644 index 0000000000000..9442a660bc38e --- /dev/null +++ b/pkgs/development/python-modules/sphinx-autodoc2/default.nix @@ -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 ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 1f291567bd9ad..3492016354ec4 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -14950,6 +14950,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 { }; From 7ae87e593c8caf8fa9de2bb7d0d30f1df4eef55e Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Sat, 26 Oct 2024 22:46:54 +0200 Subject: [PATCH 2/2] pyton312Packages.arelle: 18.3 -> 2.30.25, unbreak, refactor --- .../python-modules/arelle/default.nix | 173 ++++++++++++------ .../python-modules/arelle/tests.patch | 14 -- 2 files changed, 120 insertions(+), 67 deletions(-) delete mode 100644 pkgs/development/python-modules/arelle/tests.patch diff --git a/pkgs/development/python-modules/arelle/default.nix b/pkgs/development/python-modules/arelle/default.nix index 7ecdc1bb8a932..6e20880ff8418 100644 --- a/pkgs/development/python-modules/arelle/default.nix +++ b/pkgs/development/python-modules/arelle/default.nix @@ -1,87 +1,154 @@ { - 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"; - - disabled = !isPy3k; + version = "2.30.25"; + pyproject = true; - # 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]"]' + ''; + + 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 - ''; - - # Documentation - postBuild = '' - (cd apidocs && make html && cp -r _build $doc) + 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 ''; - 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 + ]; }; } diff --git a/pkgs/development/python-modules/arelle/tests.patch b/pkgs/development/python-modules/arelle/tests.patch deleted file mode 100644 index e34cda99b2517..0000000000000 --- a/pkgs/development/python-modules/arelle/tests.patch +++ /dev/null @@ -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