1{
2 attrs,
3 buildPythonPackage,
4 cmarkgfm,
5 cryptography,
6 defusedxml,
7 datamodel-code-generator,
8 email-validator,
9 fetchFromGitHub,
10 furl,
11 ilcli,
12 importlib-resources,
13 jinja2,
14 lib,
15 mypy,
16 openpyxl,
17 orjson,
18 paramiko,
19 pytestCheckHook,
20 pydantic,
21 python-dotenv,
22 python-frontmatter,
23 requests,
24 ruamel-yaml,
25 setuptools,
26 setuptools-scm,
27}:
28
29buildPythonPackage rec {
30 pname = "compliance-trestle";
31 version = "3.9.1";
32 pyproject = true;
33
34 src = fetchFromGitHub {
35 owner = "oscal-compass";
36 repo = "compliance-trestle";
37 tag = "v${version}";
38 hash = "sha256-AJ1luN2X6Q4dp4fna14x6HgUw1uX4X87BXkVBPVIn9k=";
39 fetchSubmodules = true;
40 };
41
42 pythonRelaxDeps = true;
43
44 postPatch = ''
45 substituteInPlace tests/trestle/misc/mypy_test.py \
46 --replace-fail "trestle'," "${placeholder "out"}/bin/trestle'," \
47 '';
48
49 build-system = [
50 setuptools
51 setuptools-scm
52 ];
53
54 dependencies = [
55 attrs
56 cmarkgfm
57 cryptography
58 defusedxml
59 datamodel-code-generator
60 email-validator
61 furl
62 ilcli
63 importlib-resources
64 jinja2
65 openpyxl
66 orjson
67 paramiko
68 pydantic
69 python-dotenv
70 python-frontmatter
71 requests
72 ruamel-yaml
73 ];
74
75 nativeCheckInputs = [
76 pytestCheckHook
77 mypy
78 ];
79
80 disabledTests = [
81 # Requires network access
82 "test_import_from_url"
83 "test_import_from_nist"
84 "test_remote_profile_relative_cat"
85
86 # AssertionError
87 "test_profile_generate_assemble_rev_5"
88 "test_ssp_assemble_fedramp_profile"
89 "test_ssp_generate_aggregates_no_cds"
90 "test_ssp_generate_aggregates_no_param_value_orig"
91 ];
92
93 disabledTestPaths = [
94 # Requires network access
95 "tests/trestle/core/remote"
96 ];
97
98 pythonImportsCheck = [ "trestle" ];
99
100 meta = {
101 description = "Opinionated tooling platform for managing compliance as code, using continuous integration and NIST's OSCAL standard";
102 homepage = "https://github.com/oscal-compass/compliance-trestle";
103 changelog = "https://github.com/oscal-compass/compliance-trestle/blob/${src.tag}/CHANGELOG.md";
104 license = lib.licenses.asl20;
105 maintainers = with lib.maintainers; [ tochiaha ];
106 mainProgram = "trestle";
107 };
108}