Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into improve-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
CasperWA committed Oct 30, 2023
2 parents a63df30 + f2bb550 commit 4cee3f5
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 691 deletions.
2 changes: 1 addition & 1 deletion .github/static/get_dic2owl_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def main(argv_input: list = None) -> Set[str]:
for file in args.requirements_files:
if not file.exists():
raise FileNotFoundError(f"Could not find {file} !")
with open(file.resolve(), "r") as handle:
with open(file.resolve(), "r", encoding="utf8") as handle:
for line in handle.readlines():
match = requirements_regex.fullmatch(line)
if match is None:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: '3.7'

- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_automerge_dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_cd_updated_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ env.DEPENDABOT_BRANCH }}
fetch-depth: 0
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ env.DEFAULT_REPO_BRANCH }}

- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: '3.7'

- name: Install `pre-commit` and dependencies
run: |
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:

- name: Fetch PR body
id: pr_body
uses: chuhlomin/render-template@v1.6
uses: chuhlomin/render-template@v1.8
with:
template: .github/static/single_dependency_pr_body.txt

Expand Down
23 changes: 12 additions & 11 deletions .github/workflows/dic2owl_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: '3.7'

- name: Install dependencies
run: |
Expand All @@ -35,12 +35,12 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: '3.7'

- name: Install dependencies
run: |
Expand All @@ -53,21 +53,22 @@ jobs:
- name: Run PyLint
run: pylint --rcfile=dic2owl/pyproject.toml dic2owl/**/*.py

# Ignore ID 44715 for now.
# See this NumPy issue for more information: https://github.com/numpy/numpy/issues/19038
# Remove ignoring 48547 as soon as RDFLib/rdflib#1844 has been fixed and the fix
# has been released.
# Ignore ID 44715, 44716, and 44717 for now.
# See this NumPy issue for more information:
# https://github.com/numpy/numpy/issues/19038
# When dropping Python 3.7 support, these vulnerabilities are fixed and can be
# removed from the ignore list.
- name: Run safety
run: pip freeze | safety check --stdin --ignore 44715 --ignore 44716 --ignore 44717 --ignore 48547
run: pip freeze | safety check --stdin --ignore 44715 --ignore 44716 --ignore 44717

dic2owl-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ['3.7', '3.8', '3.9']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
Expand Down
8 changes: 7 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
default_language_version:
python: python3.7

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
# Keep at v4.4.0 to support Python 3.7
rev: v4.4.0
hooks:
- id: check-symlinks
Expand All @@ -19,6 +23,7 @@ repos:
exclude: ^.*(\.ttl|\.cif)$

- repo: https://github.com/ambv/black
# Keep at 23.3.0 to support Python 3.7
rev: 23.3.0
hooks:
- id: black
Expand All @@ -34,7 +39,8 @@ repos:
files: ^dic2owl/.*$

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
# Keep at v1.4.1 to support Python 3.7
rev: v1.4.1
hooks:
- id: mypy
exclude: ^tests/.*$
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[![CI tests](https://github.com/emmo-repo/CIF-ontology/workflows/CI/badge.svg)](https://github.com/emmo-repo/CIF-ontology/actions/)
[![DOI](https://zenodo.org/badge/272473769.svg)](https://zenodo.org/badge/latestdoi/272473769)


CIF Ontology
============
Expand Down
13 changes: 1 addition & 12 deletions dic2owl/dic2owl/dic2owl.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ class Generator:
"ontology/cif-ddl.ttl"
)

# TODO:
# Should `comments` be replaced with a dict `annotations` for annotating
# the ontology itself? If so, we should import Dublin Core.

def __init__(
self,
dicfile: "StrPath",
Expand Down Expand Up @@ -187,10 +183,8 @@ def _add_data_value(self, item: dict) -> None:
for ddl_name, value in item.items():
if ddl_name.startswith("_type."):
if ddl_name == "_type.dimension":
# TODO - fix special case
pass
elif value == "Implied":
# TODO - fix special case
pass
else:
parents.append(self.ddl[value])
Expand Down Expand Up @@ -221,11 +215,6 @@ class `cls`.

def _add_metadata(self) -> None:
"""Adds metadata to the generated ontology."""
# TODO:
# Is there a way to extract metadata from the dic object like
# _dictionary_audit.version?
# onto.set_version(version="XXX")

for comment in self.comments:
self.onto.metadata.comment.append(comment)
self.onto.metadata.comment.append(
Expand Down Expand Up @@ -275,4 +264,4 @@ def main(
overwrite=True,
)

return gen # XXX - just for debugging
return gen
Loading

0 comments on commit 4cee3f5

Please sign in to comment.