1{
2 lib,
3 appdirs,
4 beautifulsoup4,
5 buildPythonPackage,
6 colorlog,
7 fetchFromGitHub,
8 git,
9 jsonschema,
10 lxml,
11 markdown,
12 python,
13 requests,
14 substituteAll,
15 toml,
16}:
17
18let
19 # NOTE This is needed to download & run another Python program internally in
20 # order to generate test cases for library-checker problems.
21 pythonEnv = python.withPackages (
22 ps: with ps; [
23 colorlog
24 jinja2
25 markdown
26 toml
27 ]
28 );
29in
30buildPythonPackage rec {
31 pname = "online-judge-api-client";
32 version = "10.10.1";
33 format = "setuptools";
34
35 src = fetchFromGitHub {
36 owner = "online-judge-tools";
37 repo = "api-client";
38 rev = "refs/tags/v${version}";
39 hash = "sha256-P0pIjd/YS155dSDpY/ekMp8HnJcM35waV7aoTQiEWHo=";
40 };
41
42 patches = [ ./fix-paths.patch ];
43 postPatch = ''
44 substituteInPlace onlinejudge/service/library_checker.py \
45 --subst-var-by git ${git} \
46 --subst-var-by pythonInterpreter ${pythonEnv.interpreter}
47 '';
48
49 propagatedBuildInputs = [
50 appdirs
51 beautifulsoup4
52 colorlog
53 jsonschema
54 lxml
55 requests
56 toml
57 ];
58
59 # Requires internet access
60 doCheck = false;
61
62 pythonImportsCheck = [
63 "onlinejudge"
64 "onlinejudge_api"
65 ];
66
67 meta = with lib; {
68 description = "API client to develop tools for competitive programming";
69 mainProgram = "oj-api";
70 homepage = "https://github.com/online-judge-tools/api-client";
71 license = licenses.mit;
72 maintainers = with maintainers; [ sei40kr ];
73 };
74}