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

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

Open
wants to merge 2 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
173 changes: 120 additions & 53 deletions pkgs/development/python-modules/arelle/default.nix
Original file line number Diff line number Diff line change
@@ -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
TomaSajt marked this conversation as resolved.
Show resolved Hide resolved
''
+
# 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
];
};
}
14 changes: 0 additions & 14 deletions pkgs/development/python-modules/arelle/tests.patch

This file was deleted.

72 changes: 72 additions & 0 deletions pkgs/development/python-modules/sphinx-autodoc2/default.nix
Original file line number Diff line number Diff line change
@@ -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 ];
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 { };
Expand Down