-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdataframe_image_default.nix
More file actions
117 lines (103 loc) · 3.39 KB
/
Copy pathdataframe_image_default.nix
File metadata and controls
117 lines (103 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{ stdenv, pkgs, lib, buildPythonPackage, fetchFromGitHub, python3Packages
, texlive, chromium, pandoc, playwright-driver, }:
let
version = "0.2.7";
pythonDeps = with python3Packages; [
notebook
ipykernel
pytest
pytest-asyncio
matplotlib
pandas
html2image
nbconvert
aiohttp
requests
pillow
packaging
mistune
lxml
beautifulsoup4
cssutils
playwright
chromium
pandoc
setuptools-scm
cssselect
# selenium
];
testDeps = with python3Packages; [ pytestCheckHook pytest-asyncio ];
systemDeps = [
texlive.combined.scheme-small
playwright-driver.browsers
chromium
pandoc
# pkgs.firefox-unwrapped
# pkgs.geckodriver
];
in python3Packages.buildPythonPackage rec {
pname = "dataframe_image";
inherit version;
format = "pyproject";
src = fetchFromGitHub {
owner = "dexplo";
repo = "dataframe_image";
rev = "v${version}";
hash = "sha256-rX3afHEKGBZHkHPPKZFPiw6lt7lRYkpMhKvZIorXFok=";
};
nativeBuildInputs = testDeps ++ systemDeps;
buildInputs = with python3Packages; [ setuptools ];
propagatedBuildInputs = pythonDeps ++ systemDeps;
nativeCheckInputs = testDeps ++ systemDeps
++ (with python3Packages; [ pytestCheckHook ]);
pythonImportsCheck = [ "dataframe_image" ];
doCheck = true;
preCheck = ''
export HOME=$TMPDIR
export JUPYTER_PLATFORM_DIRS=1
export MPLCONFIGDIR=$TMPDIR/matplotlib
export PLAYWRIGHT_BROWSERS_PATH=${playwright-driver.browsers}
# export PLAYWRIGHT_LAUNCH_OPTIONS="--no-sandbox"
# export PATH="${pkgs.geckodriver}/bin:$PATH"
'';
makeWrapperArgs = [
"--set PLAYWRIGHT_BROWSERS_PATH ${playwright-driver.browsers}"
# "--set PLAYWRIGHT_LAUNCH_OPTIONS '--no-sandbox'"
# "--prefix PATH : ${pkgs.geckodriver}/bin"
];
pytestFlagsArray = [
# SKip because of github CI
"-x"
# "-k 'not selenium and not test_latex[playwright] and not test_huge_df[playwright-300]'"
# The selenium tests are failing as firefox drivers cannot be found.
# test_latex[playwright] is timing out.
#
# As dfi.export( ... ,table_conversion="chrome") works with the current
# build, and therefore selenium seems unnecessary, I'm disabling these
# tests.
#
# More specifically, these are the errors I'm getting:
#
# E selenium.common.exceptions.WebDriverException: Message:
# Unsupported platform/architecture combination: linux/aarch64
#
# E selenium.common.exceptions.NoSuchDriverException: Message: Unable
# to obtain driver for firefox; For documentation on this error, please visit:
# https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location
#
# For the latter, the solution described on the webpage is to add the driver
# location to the path. As the linked driver is gecko driver, I included this
# in dependencies and I added geckodriver's binary to PATH in preCheck and
# makeWrapperArgs. However, this did not resolve the test failures.
#
# I've left in selenium/firefox dependencies I used as comments for
# convenience.
];
meta = with lib; {
description =
"Embed pandas DataFrames as images in pdf and markdown files when converting from Jupyter Notebooks";
homepage = "https://github.com/dexplo/dataframe_image";
license = licenses.mit;
maintainers = with maintainers; [ lnajt ];
};
}