ghga-transpiler 2.0.0__tar.gz → 2.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/LICENSE +1 -1
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/PKG-INFO +5 -6
- ghga_transpiler-2.1.1/pyproject.toml +157 -0
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler/__init__.py +7 -8
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler/__main__.py +5 -4
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler/cli.py +7 -6
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler/config/__init__.py +7 -5
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler/config/config.py +12 -11
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler/config/exceptions.py +5 -4
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler/configs/__init__.py +5 -4
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler/core.py +15 -13
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler/io.py +7 -6
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler/transformations.py +7 -6
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler.egg-info/PKG-INFO +6 -7
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler.egg-info/requires.txt +1 -1
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/tests/test_convert_workbook.py +5 -4
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/tests/test_create_config.py +5 -4
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/tests/test_io.py +5 -4
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/tests/test_process_workbook.py +5 -4
- ghga_transpiler-2.0.0/pyproject.toml +0 -45
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/README.md +0 -0
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/setup.cfg +0 -0
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler.egg-info/SOURCES.txt +0 -0
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler.egg-info/dependency_links.txt +0 -0
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler.egg-info/entry_points.txt +0 -0
- {ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler.egg-info/top_level.txt +0 -0
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright 2021 -
|
|
189
|
+
Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
190
190
|
for the German Human Genome-Phenome Archive (GHGA)
|
|
191
191
|
|
|
192
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ghga_transpiler
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.1
|
|
4
4
|
Summary: GHGA-Transpiler - excel to JSON converter
|
|
5
5
|
Author-email: "German Human Genome Phenome Archive (GHGA)" <contact@ghga.de>
|
|
6
6
|
License: Apache 2.0
|
|
7
7
|
Project-URL: Repository, https://github.com/ghga-de/ghga-transpiler
|
|
8
8
|
Classifier: Development Status :: 1 - Planning
|
|
9
9
|
Classifier: Operating System :: POSIX :: Linux
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
13
|
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
15
14
|
Classifier: Topic :: Software Development :: Libraries
|
|
16
15
|
Classifier: Intended Audience :: Developers
|
|
17
|
-
Requires-Python: >=3.
|
|
16
|
+
Requires-Python: >=3.12
|
|
18
17
|
Description-Content-Type: text/markdown
|
|
19
18
|
License-File: LICENSE
|
|
20
|
-
Requires-Dist: typer
|
|
19
|
+
Requires-Dist: typer>=0.12
|
|
21
20
|
Requires-Dist: openpyxl==3.*,>=3.1.2
|
|
22
21
|
Requires-Dist: defusedxml==0.*,>=0.7
|
|
23
22
|
Requires-Dist: pydantic<3,>=2
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [
|
|
3
|
+
"setuptools>=69",
|
|
4
|
+
]
|
|
5
|
+
build-backend = "setuptools.build_meta"
|
|
6
|
+
|
|
7
|
+
[project]
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "German Human Genome Phenome Archive (GHGA)", email = "contact@ghga.de" },
|
|
11
|
+
]
|
|
12
|
+
requires-python = ">=3.12"
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 1 - Planning",
|
|
15
|
+
"Operating System :: POSIX :: Linux",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"License :: OSI Approved :: Apache Software License",
|
|
19
|
+
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
|
|
20
|
+
"Topic :: Software Development :: Libraries",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
]
|
|
23
|
+
name = "ghga_transpiler"
|
|
24
|
+
version = "2.1.1"
|
|
25
|
+
description = "GHGA-Transpiler - excel to JSON converter"
|
|
26
|
+
dependencies = [
|
|
27
|
+
"typer >= 0.12",
|
|
28
|
+
"openpyxl >= 3.1.2, == 3.*",
|
|
29
|
+
"defusedxml >= 0.7, == 0.*",
|
|
30
|
+
"pydantic >=2, <3",
|
|
31
|
+
"PyYAML ~= 6.0",
|
|
32
|
+
"semver == 3.*",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.license]
|
|
36
|
+
text = "Apache 2.0"
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
Repository = "https://github.com/ghga-de/ghga-transpiler"
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
ghga-transpiler = "ghga_transpiler.__main__:run"
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.packages.find]
|
|
45
|
+
where = [
|
|
46
|
+
"src",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[tool.ruff]
|
|
50
|
+
exclude = [
|
|
51
|
+
".git",
|
|
52
|
+
".devcontainer",
|
|
53
|
+
"__pycache__",
|
|
54
|
+
"build",
|
|
55
|
+
"dist",
|
|
56
|
+
]
|
|
57
|
+
line-length = 88
|
|
58
|
+
src = [
|
|
59
|
+
"src",
|
|
60
|
+
"tests",
|
|
61
|
+
"examples",
|
|
62
|
+
"scripts",
|
|
63
|
+
]
|
|
64
|
+
target-version = "py312"
|
|
65
|
+
|
|
66
|
+
[tool.ruff.lint]
|
|
67
|
+
fixable = [
|
|
68
|
+
"UP",
|
|
69
|
+
"I",
|
|
70
|
+
"D",
|
|
71
|
+
]
|
|
72
|
+
ignore = [
|
|
73
|
+
"E111",
|
|
74
|
+
"E114",
|
|
75
|
+
"E116",
|
|
76
|
+
"PLW",
|
|
77
|
+
"RUF001",
|
|
78
|
+
"RUF010",
|
|
79
|
+
"RUF012",
|
|
80
|
+
"N818",
|
|
81
|
+
"B008",
|
|
82
|
+
"PLR2004",
|
|
83
|
+
"D205",
|
|
84
|
+
"D400",
|
|
85
|
+
"D401",
|
|
86
|
+
"D107",
|
|
87
|
+
"D206",
|
|
88
|
+
"D300",
|
|
89
|
+
"UP040",
|
|
90
|
+
]
|
|
91
|
+
select = [
|
|
92
|
+
"C90",
|
|
93
|
+
"F",
|
|
94
|
+
"I",
|
|
95
|
+
"S",
|
|
96
|
+
"B",
|
|
97
|
+
"N",
|
|
98
|
+
"UP",
|
|
99
|
+
"PL",
|
|
100
|
+
"RUF",
|
|
101
|
+
"SIM",
|
|
102
|
+
"D",
|
|
103
|
+
]
|
|
104
|
+
|
|
105
|
+
[tool.ruff.lint.mccabe]
|
|
106
|
+
max-complexity = 10
|
|
107
|
+
|
|
108
|
+
[tool.ruff.lint.per-file-ignores]
|
|
109
|
+
"scripts/*" = [
|
|
110
|
+
"PL",
|
|
111
|
+
"S",
|
|
112
|
+
"SIM",
|
|
113
|
+
"D",
|
|
114
|
+
]
|
|
115
|
+
"tests/*" = [
|
|
116
|
+
"S",
|
|
117
|
+
"SIM",
|
|
118
|
+
"PLR",
|
|
119
|
+
"B011",
|
|
120
|
+
]
|
|
121
|
+
".devcontainer/*" = [
|
|
122
|
+
"S",
|
|
123
|
+
"SIM",
|
|
124
|
+
"D",
|
|
125
|
+
]
|
|
126
|
+
"examples/*" = [
|
|
127
|
+
"S",
|
|
128
|
+
"D",
|
|
129
|
+
]
|
|
130
|
+
"__init__.py" = [
|
|
131
|
+
"D",
|
|
132
|
+
]
|
|
133
|
+
|
|
134
|
+
[tool.ruff.lint.pydocstyle]
|
|
135
|
+
convention = "pep257"
|
|
136
|
+
|
|
137
|
+
[tool.mypy]
|
|
138
|
+
disable_error_code = "import"
|
|
139
|
+
show_error_codes = true
|
|
140
|
+
exclude = [
|
|
141
|
+
"build/lib/",
|
|
142
|
+
]
|
|
143
|
+
warn_redundant_casts = true
|
|
144
|
+
warn_unused_ignores = true
|
|
145
|
+
check_untyped_defs = true
|
|
146
|
+
no_site_packages = false
|
|
147
|
+
|
|
148
|
+
[tool.pytest.ini_options]
|
|
149
|
+
minversion = "8.0"
|
|
150
|
+
asyncio_mode = "strict"
|
|
151
|
+
|
|
152
|
+
[tool.coverage.paths]
|
|
153
|
+
source = [
|
|
154
|
+
"src",
|
|
155
|
+
"/workspace/src",
|
|
156
|
+
"**/lib/python*/site-packages",
|
|
157
|
+
]
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
|
+
#
|
|
15
16
|
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
from importlib.metadata import version
|
|
17
|
+
"""GHGA metadata transpiler"""
|
|
19
18
|
|
|
20
19
|
from openpyxl.xml import DEFUSEDXML
|
|
21
20
|
|
|
22
|
-
__version__ =
|
|
21
|
+
__version__ = "2.1.1"
|
|
23
22
|
|
|
24
23
|
if not DEFUSEDXML:
|
|
25
24
|
raise RuntimeError(
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
|
+
#
|
|
15
16
|
|
|
16
17
|
"""Entrypoint of the package"""
|
|
17
18
|
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
16
17
|
"""CLI-specific wrappers around core functions."""
|
|
18
|
+
|
|
17
19
|
import sys
|
|
18
20
|
from pathlib import Path
|
|
19
|
-
from typing import Optional
|
|
20
21
|
|
|
21
22
|
import typer
|
|
22
23
|
|
|
@@ -43,7 +44,7 @@ def transpile(
|
|
|
43
44
|
dir_okay=False,
|
|
44
45
|
readable=True,
|
|
45
46
|
),
|
|
46
|
-
output_file:
|
|
47
|
+
output_file: Path | None = typer.Argument(
|
|
47
48
|
None, help="The path to output file (JSON).", dir_okay=False
|
|
48
49
|
),
|
|
49
50
|
force: bool = typer.Option(
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
"""Module to load workbook configurations and convert it to transpiler config"""
|
|
16
19
|
|
|
17
|
-
"""Module to load workbook configurations and convert it to transpiler config """
|
|
18
20
|
from .config import Config, load_config # noqa
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
16
17
|
|
|
17
18
|
"""Module to process config file"""
|
|
18
19
|
|
|
19
20
|
from collections import Counter
|
|
21
|
+
from collections.abc import Callable
|
|
20
22
|
from importlib import resources
|
|
21
|
-
from typing import Callable, Optional
|
|
22
23
|
|
|
23
24
|
import yaml
|
|
24
25
|
from pydantic import BaseModel, model_validator
|
|
@@ -40,18 +41,18 @@ class WorksheetSettings(BaseModel):
|
|
|
40
41
|
"""A data model for the per-worksheet settings of a transpiler config"""
|
|
41
42
|
|
|
42
43
|
name: str
|
|
43
|
-
header_row:
|
|
44
|
-
start_row:
|
|
45
|
-
start_column:
|
|
46
|
-
end_column:
|
|
47
|
-
transformations:
|
|
44
|
+
header_row: int | None = None
|
|
45
|
+
start_row: int | None = None
|
|
46
|
+
start_column: int | None = None
|
|
47
|
+
end_column: int | None = None
|
|
48
|
+
transformations: dict[str, Callable] | None = None
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
class Worksheet(BaseModel):
|
|
51
52
|
"""A data model for worksheets in the transpiler config"""
|
|
52
53
|
|
|
53
54
|
sheet_name: str
|
|
54
|
-
settings:
|
|
55
|
+
settings: WorksheetSettings | None
|
|
55
56
|
|
|
56
57
|
|
|
57
58
|
class Config(BaseModel):
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
16
17
|
|
|
17
18
|
"""Module to collect custom exceptions"""
|
|
18
19
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
16
17
|
|
|
17
18
|
"""This module contains functionalities for processing excel sheets into json object."""
|
|
19
|
+
|
|
20
|
+
from collections.abc import Callable
|
|
18
21
|
from importlib import resources
|
|
19
|
-
from typing import Callable, Optional, Union
|
|
20
22
|
|
|
21
23
|
import semver
|
|
22
24
|
from openpyxl import Workbook
|
|
@@ -59,10 +61,10 @@ class GHGAWorkbook:
|
|
|
59
61
|
|
|
60
62
|
def get_worksheet_rows(
|
|
61
63
|
worksheet,
|
|
62
|
-
min_row:
|
|
64
|
+
min_row: int | None,
|
|
63
65
|
max_row: int,
|
|
64
|
-
min_col:
|
|
65
|
-
max_col:
|
|
66
|
+
min_col: int | None,
|
|
67
|
+
max_col: int | None,
|
|
66
68
|
) -> list:
|
|
67
69
|
"""Function to create a list of rows of a worksheet"""
|
|
68
70
|
return list(
|
|
@@ -76,9 +78,9 @@ def get_worksheet_rows(
|
|
|
76
78
|
|
|
77
79
|
def get_header(
|
|
78
80
|
worksheet,
|
|
79
|
-
header_row:
|
|
80
|
-
min_col:
|
|
81
|
-
max_col:
|
|
81
|
+
header_row: int | None,
|
|
82
|
+
min_col: int | None,
|
|
83
|
+
max_col: int | None,
|
|
82
84
|
) -> list[str]:
|
|
83
85
|
"""Function to return a list column names of a worksheet"""
|
|
84
86
|
return list(
|
|
@@ -95,7 +97,7 @@ def convert_rows(header, rows) -> list[dict]:
|
|
|
95
97
|
return [
|
|
96
98
|
{
|
|
97
99
|
key: value
|
|
98
|
-
for key, value in zip(header, row)
|
|
100
|
+
for key, value in zip(header, row, strict=False)
|
|
99
101
|
if value is not None and value != ""
|
|
100
102
|
}
|
|
101
103
|
for row in rows
|
|
@@ -103,7 +105,7 @@ def convert_rows(header, rows) -> list[dict]:
|
|
|
103
105
|
|
|
104
106
|
|
|
105
107
|
def transform_rows(
|
|
106
|
-
rows: list[dict], transformations:
|
|
108
|
+
rows: list[dict], transformations: dict[str, Callable] | None
|
|
107
109
|
) -> list[dict]:
|
|
108
110
|
"""Transforms row values if it is applicable with a given function"""
|
|
109
111
|
transformed = []
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
16
17
|
|
|
17
18
|
"""IO related functionality"""
|
|
18
19
|
|
|
@@ -20,7 +21,7 @@ import json
|
|
|
20
21
|
import sys
|
|
21
22
|
from importlib import resources
|
|
22
23
|
from pathlib import Path
|
|
23
|
-
from typing import
|
|
24
|
+
from typing import TextIO
|
|
24
25
|
|
|
25
26
|
from openpyxl import load_workbook
|
|
26
27
|
|
|
@@ -39,7 +40,7 @@ def _write_json(data: dict, file: TextIO):
|
|
|
39
40
|
json.dump(obj=data, fp=file, ensure_ascii=False, indent=4)
|
|
40
41
|
|
|
41
42
|
|
|
42
|
-
def write_json(data: dict, path:
|
|
43
|
+
def write_json(data: dict, path: Path | None, force: bool) -> None:
|
|
43
44
|
"""Write the data provided as a dictionary to the specified output path or
|
|
44
45
|
to stdout if the path is None.
|
|
45
46
|
"""
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
16
17
|
|
|
17
18
|
"""Module containing transformation functions"""
|
|
18
19
|
|
|
19
|
-
from
|
|
20
|
+
from collections.abc import Callable
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
def split_by_semicolon(value: str) -> list[str]:
|
|
@@ -35,7 +36,7 @@ def to_attributes() -> Callable:
|
|
|
35
36
|
def split_one(value: str) -> dict:
|
|
36
37
|
"""Returns a dictionary with key, value as keys, splitted string as values"""
|
|
37
38
|
splitted = (elem.strip() for elem in value.split("="))
|
|
38
|
-
return dict(zip(("key", "value"), splitted))
|
|
39
|
+
return dict(zip(("key", "value"), splitted, strict=False))
|
|
39
40
|
|
|
40
41
|
def split_mult(value: str) -> list[dict]:
|
|
41
42
|
"""Converts string to attributes"""
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version: 2.
|
|
2
|
+
Name: ghga_transpiler
|
|
3
|
+
Version: 2.1.1
|
|
4
4
|
Summary: GHGA-Transpiler - excel to JSON converter
|
|
5
5
|
Author-email: "German Human Genome Phenome Archive (GHGA)" <contact@ghga.de>
|
|
6
6
|
License: Apache 2.0
|
|
7
7
|
Project-URL: Repository, https://github.com/ghga-de/ghga-transpiler
|
|
8
8
|
Classifier: Development Status :: 1 - Planning
|
|
9
9
|
Classifier: Operating System :: POSIX :: Linux
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
13
|
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
15
14
|
Classifier: Topic :: Software Development :: Libraries
|
|
16
15
|
Classifier: Intended Audience :: Developers
|
|
17
|
-
Requires-Python: >=3.
|
|
16
|
+
Requires-Python: >=3.12
|
|
18
17
|
Description-Content-Type: text/markdown
|
|
19
18
|
License-File: LICENSE
|
|
20
|
-
Requires-Dist: typer
|
|
19
|
+
Requires-Dist: typer>=0.12
|
|
21
20
|
Requires-Dist: openpyxl==3.*,>=3.1.2
|
|
22
21
|
Requires-Dist: defusedxml==0.*,>=0.7
|
|
23
22
|
Requires-Dist: pydantic<3,>=2
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
16
17
|
|
|
17
18
|
"""Tests for converting the workbook"""
|
|
18
19
|
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
16
17
|
|
|
17
18
|
"""Tests for creating the config"""
|
|
18
19
|
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
16
17
|
|
|
17
18
|
"""IO functionality tests"""
|
|
18
19
|
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
16
17
|
"""Unit tests for core functions"""
|
|
17
18
|
|
|
18
19
|
import pytest
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["setuptools>=67.7.2"]
|
|
3
|
-
build-backend = "setuptools.build_meta"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
# please adapt to package name
|
|
7
|
-
name = "ghga_transpiler"
|
|
8
|
-
version = "2.0.0"
|
|
9
|
-
description = "GHGA-Transpiler - excel to JSON converter"
|
|
10
|
-
readme = "README.md"
|
|
11
|
-
authors = [
|
|
12
|
-
{ name = "German Human Genome Phenome Archive (GHGA)", email = "contact@ghga.de" },
|
|
13
|
-
]
|
|
14
|
-
requires-python = ">=3.9"
|
|
15
|
-
license = { text = "Apache 2.0" }
|
|
16
|
-
classifiers = [
|
|
17
|
-
"Development Status :: 1 - Planning",
|
|
18
|
-
"Operating System :: POSIX :: Linux",
|
|
19
|
-
"Programming Language :: Python :: 3.9",
|
|
20
|
-
"Programming Language :: Python :: 3.10",
|
|
21
|
-
"Programming Language :: Python :: 3.11",
|
|
22
|
-
"License :: OSI Approved :: Apache Software License",
|
|
23
|
-
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
|
|
24
|
-
"Topic :: Software Development :: Libraries",
|
|
25
|
-
"Intended Audience :: Developers",
|
|
26
|
-
]
|
|
27
|
-
dependencies = [
|
|
28
|
-
"typer ~= 0.9.0",
|
|
29
|
-
"openpyxl >= 3.1.2, == 3.*",
|
|
30
|
-
"defusedxml >= 0.7, == 0.*",
|
|
31
|
-
"pydantic >=2, <3",
|
|
32
|
-
"PyYAML ~= 6.0",
|
|
33
|
-
"semver == 3.*"
|
|
34
|
-
]
|
|
35
|
-
|
|
36
|
-
[project.urls]
|
|
37
|
-
# please adapt to package name
|
|
38
|
-
Repository = "https://github.com/ghga-de/ghga-transpiler"
|
|
39
|
-
|
|
40
|
-
[project.scripts]
|
|
41
|
-
# please adapt to package name
|
|
42
|
-
ghga-transpiler = "ghga_transpiler.__main__:run"
|
|
43
|
-
|
|
44
|
-
[tool.setuptools.packages.find]
|
|
45
|
-
where = ["src"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{ghga_transpiler-2.0.0 → ghga_transpiler-2.1.1}/src/ghga_transpiler.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|