Skip to content

Commit

Permalink
update build config to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
ahwagner committed Aug 13, 2024
1 parent 1c74d40 commit 521eb2c
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 86 deletions.
58 changes: 53 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,55 @@
[build-system]
requires = [
"setuptools>=42",
"wheel",
"setuptools_scm>=6.2"
[project]
name = "ga4gh.gks.metaschema"
authors = [
{name = "Alex Wagner", email = "alex.wagner@nationwidechildrens.org"},
]
readme = "README.md"
description = "GA4GH Genomic Knowledge Standards meta-schema tools"
license = {file = "LICENSE"}
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Healthcare Industry",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
]
keywords = [
"bioinformatics",
"ga4gh",
"genomics",
"hgvs",
"spdi",
"variation"
]
requires-python = ">=3.12"
dynamic = ["version", "dependencies"]

[project.urls]
Homepage = "https://github.com/ga4gh/gks-metaschema"
Documentation = "https://github.com/ga4gh/gks-metaschema"
Changelog = "https://github.com/ga4gh/gks-metaschema/releases"
Source = "https://github.com/ga4gh/gks-metaschema"
"Bug Tracker" = "https://github.com/ga4gh/gks-metaschema/issues"

[tool.setuptools.dynamic]
dependencies = {file = [".requirements.txt"]}

[tool.setuptools_scm]

[project.scripts]
jsy2js = "ga4gh.gks.metaschema.scripts.jsy2js:cli"
source2jsy = "ga4gh.gks.metaschema.scripts.source2jsy:cli"
y2t = "ga4gh.gks.metaschema.scripts.y2t:cli"
source2mergedjsy = "ga4gh.gks.metaschema.scripts.source2mergedjsy:cli"
source2splitjs = "ga4gh.gks.metaschema.scripts.source2splitjs:cli"
source2classes = "ga4gh.gks.metaschema.scripts.source2classes:cli"

[build-system]
requires = ["setuptools>=65.3", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"
37 changes: 0 additions & 37 deletions setup.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions setup.py

This file was deleted.

8 changes: 6 additions & 2 deletions src/ga4gh/gks/metaschema/scripts/jsy2js.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@
import json
import sys

yaml_schema = yaml.load(sys.stdin, Loader=yaml.SafeLoader)
json.dump(yaml_schema, sys.stdout, indent=3)
def cli():
yaml_schema = yaml.load(sys.stdin, Loader=yaml.SafeLoader)
json.dump(yaml_schema, sys.stdout, indent=3)

if __name__ == "__main__":
cli()
6 changes: 4 additions & 2 deletions src/ga4gh/gks/metaschema/scripts/source2classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ def main(proc):
continue
print(cls)


if __name__ == '__main__':
def cli():
args = parser.parse_args()
p = YamlSchemaProcessor(Path(args.infile))
main(p)

if __name__ == '__main__':
cli()
10 changes: 7 additions & 3 deletions src/ga4gh/gks/metaschema/scripts/source2jsy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import sys
from ga4gh.gks.metaschema.tools.source_proc import YamlSchemaProcessor

source_file = pathlib.Path(sys.argv[1])
p = YamlSchemaProcessor(source_file)
p.js_yaml_dump(sys.stdout)
def cli():
source_file = pathlib.Path(sys.argv[1])
p = YamlSchemaProcessor(source_file)
p.js_yaml_dump(sys.stdout)

if __name__ == "__main__":
cli()
12 changes: 8 additions & 4 deletions src/ga4gh/gks/metaschema/scripts/source2mergedjsy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
import sys
from ga4gh.gks.metaschema.tools.source_proc import YamlSchemaProcessor

source_file = pathlib.Path(sys.argv[1])
p = YamlSchemaProcessor(source_file)
p.merge_imported()
p.js_yaml_dump(sys.stdout)
def cli():
source_file = pathlib.Path(sys.argv[1])
p = YamlSchemaProcessor(source_file)
p.merge_imported()
p.js_yaml_dump(sys.stdout)

if __name__ == "__main__":
cli()
6 changes: 4 additions & 2 deletions src/ga4gh/gks/metaschema/scripts/source2splitjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ def split_defs_to_js(root_proc, mode='json'):
with open(target_path, 'w') as f:
json.dump(out_doc, f, indent=3, sort_keys=False)


if __name__ == '__main__':
def cli():
args = parser.parse_args()
p = YamlSchemaProcessor(Path(args.infile))
split_defs_to_js(p)

if __name__ == '__main__':
cli()
6 changes: 4 additions & 2 deletions src/ga4gh/gks/metaschema/scripts/y2t.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ def main(proc_schema):
- {resolve_cardinality(class_property_name, class_property_attributes, class_definition)}
- {class_property_attributes.get('description', '')}""", file=f)


if __name__ == "__main__":
def cli():
source_file = pathlib.Path(sys.argv[1])
p = YamlSchemaProcessor(source_file)
os.makedirs(p.def_fp, exist_ok=True)
if p.defs is None:
exit(0)
main(p)

if __name__ == "__main__":
cli()
52 changes: 26 additions & 26 deletions tests/data/gnomAD/json/GnomadCAF
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,32 @@
"title": "GnomadCAF",
"type": "object",
"$defs": {
"GrpMaxFAF95": {
"description": "The group maximum filtering allele frequency at 95% CI",
"protectedClassOf": "GnomadCAF",
"type": "object",
"maturity": "draft",
"properties": {
"frequency": {
"type": "number"
},
"confidenceInterval": {
"type": "number",
"const": 0.95,
"default": 0.95
},
"groupId": {
"type": "string",
"description": "The genetic ancestry group from which the max frequency was calculated."
}
},
"required": [
"confidenceInterval",
"frequency",
"groupId"
],
"additionalProperties": false
},
"GnomadCafProperties": {
"description": "Additional properties specific to the gnomAD CAF model.",
"protectedClassOf": "GnomadCAF",
Expand Down Expand Up @@ -75,32 +101,6 @@
}
},
"required": []
},
"GrpMaxFAF95": {
"description": "The group maximum filtering allele frequency at 95% CI",
"protectedClassOf": "GnomadCAF",
"type": "object",
"maturity": "draft",
"properties": {
"frequency": {
"type": "number"
},
"confidenceInterval": {
"type": "number",
"const": 0.95,
"default": 0.95
},
"groupId": {
"type": "string",
"description": "The genetic ancestry group from which the max frequency was calculated."
}
},
"required": [
"confidenceInterval",
"frequency",
"groupId"
],
"additionalProperties": false
}
},
"maturity": "draft",
Expand Down

0 comments on commit 521eb2c

Please sign in to comment.