diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea0a5ee..9bb86a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,14 +19,7 @@ jobs: run: | python -m pip install --upgrade pip pip install -U setuptools wheel - - while IFS="" read -r line || [ -n "${line}" ]; do - if [[ "${line}" =~ ^pre-commit.*$ ]]; then - pre_commit="${line}" - fi - done < dic2owl/requirements_dev.txt - - pip install ${pre_commit} + pip install pre-commit - name: Run pre-commit run: SKIP=pylint,mypy,black,bandit,requirements-txt-fixer pre-commit run --all-files diff --git a/.github/workflows/ci_dependabot.yml b/.github/workflows/ci_dependabot.yml index 3be226c..e15d615 100644 --- a/.github/workflows/ci_dependabot.yml +++ b/.github/workflows/ci_dependabot.yml @@ -33,14 +33,7 @@ jobs: run: | python -m pip install -U pip pip install -U setuptools wheel - - while IFS="" read -r line || [ -n "${line}" ]; do - if [[ "${line}" =~ ^pre-commit.*$ ]]; then - pre_commit="${line}" - fi - done < dic2owl/requirements_dev.txt - - pip install ${pre_commit} + pip install pre-commit - name: Set up git user info run: | @@ -82,7 +75,7 @@ jobs: - name: Create PR id: cpr - uses: peter-evans/create-pull-request@v4 + uses: peter-evans/create-pull-request@v5 with: token: ${{ secrets.RELEASE_PAT_CWA }} commit-message: New @dependabot-fueled updates diff --git a/.github/workflows/dic2owl_ci.yml b/.github/workflows/dic2owl_ci.yml index eadcab8..3d0cec2 100644 --- a/.github/workflows/dic2owl_ci.yml +++ b/.github/workflows/dic2owl_ci.yml @@ -24,14 +24,7 @@ jobs: run: | python -m pip install --upgrade pip pip install -U setuptools wheel - - while IFS="" read -r line || [ -n "${line}" ]; do - if [[ "${line}" =~ ^pre-commit.*$ ]]; then - pre_commit="${line}" - fi - done < dic2owl/requirements_dev.txt - - pip install ${pre_commit} + pip install pre-commit - name: Run pre-commit run: SKIP=pylint pre-commit run --all-files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e7a96d8..f9d7827 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-symlinks - id: check-xml @@ -19,14 +19,14 @@ repos: exclude: ^.*(\.ttl|\.cif)$ - repo: https://github.com/ambv/black - rev: 22.10.0 + rev: 23.3.0 hooks: - id: black args: - --config=dic2owl/pyproject.toml - repo: https://github.com/PyCQA/bandit - rev: '1.7.4' + rev: '1.7.5' hooks: - id: bandit args: [-r] @@ -34,7 +34,7 @@ repos: files: ^dic2owl/.*$ - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.982 + rev: v1.1.1 hooks: - id: mypy exclude: ^tests/.*$ diff --git a/dic2owl/dic2owl/cli.py b/dic2owl/dic2owl/cli.py index b5b77fc..ef23ae0 100644 --- a/dic2owl/dic2owl/cli.py +++ b/dic2owl/dic2owl/cli.py @@ -5,17 +5,21 @@ ontology-generation tool for CIF `.dic`-files. """ import argparse +from typing import TYPE_CHECKING # import logging from pathlib import Path +if TYPE_CHECKING: # pragma: no cover + from typing import List, Optional + # LOGGING_LEVELS = [ # logging.getLevelName(level).lower() for level in range(0, 51, 10) # ] -def main(argv: list = None) -> None: +def main(argv: "Optional[List[str]]" = None) -> None: """Ontologize CIF dictionaries (`.dic`) using OWL. Produce an OWL Turtle (`.ttl`) file from a CIF dictionary (`.dic`) file. diff --git a/dic2owl/dic2owl/dic2owl.py b/dic2owl/dic2owl/dic2owl.py index 92d2a96..96ec239 100644 --- a/dic2owl/dic2owl/dic2owl.py +++ b/dic2owl/dic2owl/dic2owl.py @@ -211,7 +211,6 @@ class `cls`. """ for annotation_name, value in item.items(): - # Add new annotation to generated ontology if annotation_name not in self.ddl: raise MissingAnnotationError(annotation_name) diff --git a/dic2owl/requirements_dev.txt b/dic2owl/requirements_dev.txt index 0a0daa7..e26dd73 100644 --- a/dic2owl/requirements_dev.txt +++ b/dic2owl/requirements_dev.txt @@ -1,4 +1,5 @@ -pre-commit~=2.20 -pylint~=2.15 -pytest~=7.1 +pre-commit~=2.21; python_version<"3.8" +pre-commit~=3.2; python_version>="3.8" +pylint~=2.17 +pytest~=7.2 pytest-cov~=4.0