Skip to content

Commit

Permalink
feat: migrate argparse code to typer (#48) (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe authored Oct 31, 2023
1 parent 0cfe562 commit d1c86d4
Show file tree
Hide file tree
Showing 75 changed files with 2,602 additions and 2,856 deletions.
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ insert_final_newline = true
charset = utf-8
end_of_line = lf

[*.json]
indent_size = 2

[*.bat]
indent_style = tab
end_of_line = crlf
Expand All @@ -18,4 +21,4 @@ end_of_line = crlf
insert_final_newline = false

[Makefile]
indent_style = tab
indent_style = tab
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Root Pipfile created by VS Code
/Pipfile*

# Emacs
*~

Expand Down Expand Up @@ -57,6 +60,7 @@ nosetests.xml
coverage.xml
*.cover
.hypothesis/
coverage.lcov

# Translations
*.mo
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ flake8:
lint: flake8 isort-check black-check
# lint: flake8 isort-check black-check mypy

.PHONY: pytest
pytest:
pytest .
.PHONY: test
test:
TZ=UTC LC_ALL=C pytest .
37 changes: 0 additions & 37 deletions requirements.txt

This file was deleted.

1 change: 1 addition & 0 deletions requirements.txt
16 changes: 11 additions & 5 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
# Base requirements

# Attrs, helpful for removing boilerplate, cattr is for serialization/deserializaton.
attrs >=21.2.0,<24.0
cattrs >=1.7.1,<24.0
attrs >=21.2.0
cattrs >=1.7.1
# Easy date parsing (e.g., from API).
python-dateutil >=2.8.1,<3.0

# pydantic: typed models and validation
pydantic >=2,<3

# toml parsing if python <3.11
toml >=0.10.2,<0.11

# typer: typed command line interfaces.
typer >=0.9,<0.10

# JSON Schema
jsonschema >=4.4,<4.5

# Easy logging.
logzero >=1.7.0,<2.0

# Compact, round-tripable configuration format.
toml >=0.10.2,<0.11

# simplejson has better encoders/decoders
simplejson >=3.17.2,<4.0

Expand Down
1 change: 1 addition & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pytest-runner >=2.11.1
pytest-cache >=1.0
pytest-cov >=2.4.0
pytest-mock >=2.0.0
pytest-snapshot >=0.9,<0.10

# Faking of file systems
pyfakefs >=3.7.1
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ max-complexity = 18
select = B,C,E,F,W,T4,B9

[tool:pytest]
addopts = --cov=varfish_cli --cov-report=xml
testpaths = tests
addopts = -v --strict-markers -m 'not extra' --doctest-modules --cov=varfish_cli --cov-report=xml --cov-report lcov --cov-report term-missing

[coverage:run]
omit =
Expand Down
Empty file added tests/cli/__init__.py
Empty file.
203 changes: 203 additions & 0 deletions tests/cli/data/caseimportinfo-list.len-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
[
{
"sodar_uuid": "8adbf84e-adb2-4c5d-9b5a-2a8194307b79",
"date_created": "2023-06-26T14:57:51.383539Z",
"date_modified": "2023-06-26T15:00:30.749080Z",
"owner": "root",
"release": "GRCh37",
"project": "062b8838-453f-4cf3-817d-a5ec76546462",
"name": "NA12878",
"index": "NA12878-N1-DNA1-WES1",
"pedigree": [
{
"sex": 2,
"father": "NA12891-N1-DNA1-WES1",
"mother": "NA12892-N1-DNA1-WES1",
"name": "NA12878-N1-DNA1-WES1",
"affected": 2,
"has_gt_entries": true
},
{
"sex": 1,
"father": "0",
"mother": "0",
"name": "NA12891-N1-DNA1-WES1",
"affected": 1,
"has_gt_entries": true
},
{
"sex": 2,
"father": "0",
"mother": "0",
"name": "NA12892-N1-DNA1-WES1",
"affected": 1,
"has_gt_entries": true
}
],
"notes": null,
"state": "imported",
"tags": [],
"bam_qc_files": [
{
"sodar_uuid": "1c0ce8e3-3a39-43f3-954d-f16ebf244ff5",
"date_created": "2023-06-26T14:57:51.689137Z",
"date_modified": "2023-06-26T14:57:51.689149Z",
"case_import_info": "8adbf84e-adb2-4c5d-9b5a-2a8194307b79",
"name": "bwa.gatk_hc.varfish_annotated.NA12878-N1-DNA1-WES1.bam-qc.tsv.gz",
"md5": "4afcd84e8953a83e63d8b2a92036e239"
}
],
"variant_sets": [
{
"sodar_uuid": "104f900b-fa9c-4bd5-a119-35544293fe7f",
"date_created": "2023-06-26T14:57:51.953941Z",
"date_modified": "2023-06-26T15:00:30.748115Z",
"genomebuild": "GRCh37",
"case_import_info": "8adbf84e-adb2-4c5d-9b5a-2a8194307b79",
"variant_type": "SMALL",
"genotype_files": [
{
"sodar_uuid": "c515aa43-6392-46f6-b5c9-e66dc358a71d",
"date_created": "2023-06-26T14:57:52.424494Z",
"date_modified": "2023-06-26T14:57:52.424506Z",
"variant_set_import_info": "104f900b-fa9c-4bd5-a119-35544293fe7f",
"name": "bwa.gatk_hc.varfish_annotated.NA12878-N1-DNA1-WES1.gts.tsv.gz",
"md5": "ef58889f1c5b479765ef8e1370f2cc43"
}
],
"effect_files": [],
"db_info_files": [
{
"sodar_uuid": "73f17524-2890-474c-85c6-7c02fc2e488e",
"date_created": "2023-06-26T14:57:52.725470Z",
"date_modified": "2023-06-26T14:57:52.725483Z",
"variant_set_import_info": "104f900b-fa9c-4bd5-a119-35544293fe7f",
"name": "bwa.gatk_hc.varfish_annotated.NA12878-N1-DNA1-WES1.db-infos.tsv.gz",
"md5": "d1b45661760c90599ab69597b74ba22a"
}
],
"state": "imported"
}
]
},
{
"sodar_uuid": "539fca3a-554f-4595-bfb3-b692f8ddef9e",
"date_created": "2023-06-26T15:15:08.229886Z",
"date_modified": "2023-06-26T15:21:27.204730Z",
"owner": "root",
"release": "GRCh37",
"project": "062b8838-453f-4cf3-817d-a5ec76546462",
"name": "Case_3_index",
"index": "Case_3_index-N1-DNA1-WGS1",
"pedigree": [
{
"sex": 1,
"father": "Case_3_father-N1-DNA1-WGS1",
"mother": "Case_3_mother-N1-DNA1-WGS1",
"name": "Case_3_index-N1-DNA1-WGS1",
"affected": 2,
"has_gt_entries": true
},
{
"sex": 1,
"father": "0",
"mother": "0",
"name": "Case_3_father-N1-DNA1-WGS1",
"affected": 1,
"has_gt_entries": true
},
{
"sex": 2,
"father": "0",
"mother": "0",
"name": "Case_3_mother-N1-DNA1-WGS1",
"affected": 1,
"has_gt_entries": true
}
],
"notes": null,
"state": "imported",
"tags": [],
"bam_qc_files": [
{
"sodar_uuid": "84ed9997-0230-49c9-bcb5-db6d2589733e",
"date_created": "2023-06-26T15:15:08.508094Z",
"date_modified": "2023-06-26T15:15:08.508106Z",
"case_import_info": "539fca3a-554f-4595-bfb3-b692f8ddef9e",
"name": "bwa.gatk_hc.varfish_annotated.Case_3_index-N1-DNA1-WGS1.bam-qc.tsv.gz",
"md5": "3d481a38f36fb7310c6d190a348bc08a"
}
],
"variant_sets": [
{
"sodar_uuid": "c8d5d9e3-8f61-4693-88fe-71df4bf88332",
"date_created": "2023-06-26T15:15:08.824696Z",
"date_modified": "2023-06-26T15:21:26.139559Z",
"genomebuild": "GRCh37",
"case_import_info": "539fca3a-554f-4595-bfb3-b692f8ddef9e",
"variant_type": "SMALL",
"genotype_files": [
{
"sodar_uuid": "33756a89-49c2-4633-812e-7950abf20fb5",
"date_created": "2023-06-26T15:15:09.619232Z",
"date_modified": "2023-06-26T15:15:09.619248Z",
"variant_set_import_info": "c8d5d9e3-8f61-4693-88fe-71df4bf88332",
"name": "bwa.gatk_hc.varfish_annotated.Case_3_index-N1-DNA1-WGS1.gts.tsv.gz",
"md5": "5b2194f3947e5c29be9e20914d2e4fa7"
}
],
"effect_files": [],
"db_info_files": [
{
"sodar_uuid": "218ea3a1-40a5-4ac2-8f0b-9bb00f3e44c2",
"date_created": "2023-06-26T15:15:10.041877Z",
"date_modified": "2023-06-26T15:15:10.041890Z",
"variant_set_import_info": "c8d5d9e3-8f61-4693-88fe-71df4bf88332",
"name": "bwa.gatk_hc.varfish_annotated.Case_3_index-N1-DNA1-WGS1.db-infos.tsv.gz",
"md5": "672e1b6fbc2504ff00fc02c0dc1249e7"
}
],
"state": "imported"
},
{
"sodar_uuid": "dd7334e8-5e14-4e3c-8339-0884f15a329c",
"date_created": "2023-06-26T15:15:10.565490Z",
"date_modified": "2023-06-26T15:21:27.203768Z",
"genomebuild": "GRCh37",
"case_import_info": "539fca3a-554f-4595-bfb3-b692f8ddef9e",
"variant_type": "STRUCTURAL",
"genotype_files": [
{
"sodar_uuid": "788d10a8-8d1c-4b71-b988-4a898558805d",
"date_created": "2023-06-26T15:15:10.921883Z",
"date_modified": "2023-06-26T15:15:10.921896Z",
"variant_set_import_info": "dd7334e8-5e14-4e3c-8339-0884f15a329c",
"name": "bwa.delly2.varfish_annotated.Case_3_index-N1-DNA1-WGS1.gts.tsv.gz",
"md5": "f078f61a6d9804977219b5e13c833d95"
}
],
"effect_files": [
{
"sodar_uuid": "36fa00d9-0eb6-453b-a8f3-6f7e21c7c025",
"date_created": "2023-06-26T15:15:11.291004Z",
"date_modified": "2023-06-26T15:15:11.291017Z",
"variant_set_import_info": "dd7334e8-5e14-4e3c-8339-0884f15a329c",
"name": "bwa.delly2.varfish_annotated.Case_3_index-N1-DNA1-WGS1.feature-effects.tsv.gz",
"md5": "43366a1f429de7378b1d434f2755ddff"
}
],
"db_info_files": [
{
"sodar_uuid": "71211f79-62f9-400b-83ae-57a15e4fe6b8",
"date_created": "2023-06-26T15:15:11.613705Z",
"date_modified": "2023-06-26T15:15:11.613718Z",
"variant_set_import_info": "dd7334e8-5e14-4e3c-8339-0884f15a329c",
"name": "bwa.delly2.varfish_annotated.Case_3_index-N1-DNA1-WGS1.db-infos.tsv.gz",
"md5": "9a5a789658eb339b9d1655c1acb7bc65"
}
],
"state": "imported"
}
]
}
]
47 changes: 47 additions & 0 deletions tests/cli/data/cases_case-list.len-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"release": "GRCh37",
"name": "Case_3_index",
"index": "Case_3_index-N1-DNA1-WGS1",
"pedigree": [
{
"name": "Case_3_index-N1-DNA1-WGS1",
"father": "Case_3_father-N1-DNA1-WGS1",
"mother": "Case_3_mother-N1-DNA1-WGS1",
"sex": 2,
"affected": 2,
"has_gt_entries": true
},
{
"name": "Case_3_father-N1-DNA1-WGS1",
"father": "0",
"mother": "0",
"sex": 1,
"affected": 1,
"has_gt_entries": true
},
{
"name": "Case_3_mother-N1-DNA1-WGS1",
"father": "0",
"mother": "0",
"sex": 2,
"affected": 1,
"has_gt_entries": true
}
],
"sodar_uuid": "0b96111f-00c9-4ed2-a4a2-ec2ec3322066",
"owner": null,
"date_created": "2023-06-26T17:15:13+02:00",
"date_modified": "2023-08-02T14:34:05+02:00",
"project": "062b8838-453f-4cf3-817d-a5ec76546462",
"case": null,
"state": "draft",
"notes": "asdf",
"tags": []
}
]
}
Loading

0 comments on commit d1c86d4

Please sign in to comment.