Skip to content

Commit

Permalink
Merge pull request #39 from asam-ev/2024-10-07
Browse files Browse the repository at this point in the history
CCB Review: Prepare v1.0.0-rc.1 release candidate
  • Loading branch information
andreaskern74 authored Oct 24, 2024
2 parents ede73bd + ddcc7e1 commit efb5bb1
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 36 deletions.
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ This project implements the [OTX Checker Bundle](checker_bundle_doc.md) for the
The ASAM Quality Checker OTX library contains a short representative list of check examples for [Open Test sequence eXchange (OTX)](https://report.asam.net/otx-iso-13209-open-test-sequence-exchange-format)
to showcase the functionality and implementation (it shall not be a reference implementation) for the ASAM Quality Checker project.

**Disclaimer**: The current version is a release candidate. The first official release is expected to be in November.

- [asam-qc-otx](#asam-qc-otx)
- [Installation and usage](#installation-and-usage)
- [Installation using pip](#installation-using-pip)
Expand All @@ -25,11 +27,21 @@ asam-qc-otx can be installed using pip or from source.

asam-qc-otx can be installed using pip.

**From PyPi repository**

```bash
pip install asam-qc-otx
```

**From GitHub repository**

```bash
pip install asam-qc-otx@git+https://github.com/asam-ev/qc-otx@main
```

**Note:** The above command will install `asam-qc-otx` from the `main` branch. If you want to install `asam-qc-otx` from another branch or tag, replace `@main` with the desired branch or tag. It is also possible to install from a local directory.
The above command will install `asam-qc-otx` from the `main` branch. If you want to install `asam-qc-otx` from another branch or tag, replace `@main` with the desired branch or tag.

**From a local repository**

```bash
pip install /home/user/qc-otx
Expand Down Expand Up @@ -184,3 +196,34 @@ You need to have pre-commit installed and install the hooks:
```
pre-commit install
```

**To implement a new checker:**

1. Create a new Python module for each checker.
2. Specify the following global variables for the Python module

| Variable | Meaning |
| --- | --- |
| `CHECKER_ID` | The ID of the checker |
| `CHECKER_DESCRIPTION` | The description of the checker |
| `CHECKER_PRECONDITIONS` | A set of other checkers in which if any of them raise an issue, the current checker will be skipped |
| `RULE_UID` | The rule UID of the rule that the checker will check |

3. Implement the checker logic in the following function:

```python
def check_rule(checker_data: models.CheckerData) -> None:
pass
```

4. Register the checker module in the following function in [main.py](qc_otx/main.py).

```python
def run_checks(config: Configuration, result: Result) -> None:
...
# Add the following line to register your checker module
execute_checker(your_checker_module, checker_data)
...
```

All the checkers in this checker bundle are implemented in this way. Take a look at some of them before implementing your first checker.
3 changes: 2 additions & 1 deletion checker_bundle_doc.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Checker bundle: otxBundle

* Build version: 0.1.0
* Build version: v1.0.0-rc.1
* Description: OTX checker bundle

## Parameters

* InputFile
* resultFile

## Checkers

Expand Down
2 changes: 1 addition & 1 deletion manifest_templates/windows_otx_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "otxBundle",
"exec_type": "executable",
"module_type": "checker_bundle",
"exec_command": "cd %ASAM_QC_FRAMEWORK_WORKING_DIR% && qc_otx -c %ASAM_QC_FRAMEWORK_CONFIG_FILE%"
"exec_command": "cd \"%ASAM_QC_FRAMEWORK_WORKING_DIR%\" && qc_otx -c \"%ASAM_QC_FRAMEWORK_CONFIG_FILE%\""
}
]
}
38 changes: 17 additions & 21 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "asam-qc-otx"
version = "0.1.0"
version = "1.0.0rc1"
description = "This project implements the Open Test sequence eXchange Checker for the ASAM Quality Checker project."
authors = ["Danilo Romano <[email protected]>"]
license = "MPL-2.0"
Expand All @@ -12,7 +12,7 @@ packages = [

[tool.poetry.dependencies]
python = "^3.10"
asam-qc-baselib = {git = "https://github.com/asam-ev/qc-baselib-py.git", rev = "develop"}
asam-qc-baselib = "^1.0.0rc1"
lxml = "^5.2.2"

[tool.poetry.group.dev.dependencies]
Expand Down
12 changes: 6 additions & 6 deletions qc_otx/checks/models.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from dataclasses import dataclass
from lxml import etree
from typing import Union, List
from typing import Union, List, Optional

from qc_baselib import Configuration, Result


@dataclass
class QueueNode:
element: etree._ElementTree
xpath: Union[str, None]
xpath: Optional[str]


@dataclass
Expand All @@ -29,22 +29,22 @@ class CheckerData:
@dataclass
class SMTrigger:
id: str
name: Union[str, None]
name: Optional[str]
xml_element: etree._Element


@dataclass
class SMTransition:
id: str
name: Union[str, None]
target: Union[str, None]
name: Optional[str]
target: Optional[str]
xml_element: etree._Element


@dataclass
class SMState:
id: str
name: Union[str, None]
name: Optional[str]
is_initial: bool
is_completed: bool
transitions: List[SMTransition]
Expand Down
4 changes: 2 additions & 2 deletions qc_otx/checks/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from lxml import etree
from typing import Union, List, Dict
from typing import Optional, List, Dict
from qc_otx.checks import models
import re
import logging
Expand Down Expand Up @@ -63,7 +63,7 @@ def get_all_attributes(
return attributes


def get_standard_schema_version(root: etree._ElementTree) -> Union[str, None]:
def get_standard_schema_version(root: etree._ElementTree) -> Optional[str]:
root_attrib = root.getroot().attrib
return root_attrib["version"]

Expand Down
2 changes: 1 addition & 1 deletion qc_otx/constants.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
BUNDLE_NAME = "otxBundle"
BUNDLE_VERSION = "0.1.0"
BUNDLE_VERSION = "v1.0.0-rc.1"
1 change: 0 additions & 1 deletion qc_otx/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ def main():
result = Result()
result.register_checker_bundle(
name=constants.BUNDLE_NAME,
build_date=datetime.today().strftime("%Y-%m-%d"),
description="OTX checker bundle",
version=constants.BUNDLE_VERSION,
summary="",
Expand Down

0 comments on commit efb5bb1

Please sign in to comment.