Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README #48

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 69 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,26 @@
# qc-openscenarioxml
# asam-qc-openscenarioxml

This project implements the [ASAM OpenScenario XML Checker](checker_bundle_doc.md) for the ASAM Quality Checker project.
This project implements the [ASAM OpenScenario XML Checker](checker_bundle_doc.md).

## Installation
## Installation and usage

There are two options of usage of the project:
asam-qc-openscenarioxml can be installed using pip or from source.

1. Default python on the machine
2. [Poetry](https://python-poetry.org/)

To install the project, run:
### Installation using pip

**Default python**
asam-qc-openscenarioxml can be installed using pip.

```
pip install -r requirements.txt
```bash
pip install asam-qc-openscenarioxml@git+https://github.com/asam-ev/qc-openscenarioxml@main
```

This will install the needed dependencies to your local Python.
**Note**: To install from different sources, you can replace `@main` with
your desired target. For example, `develop` branch as `@develop`.

**Poetry**
To run the application:

```
poetry install
```

## Usage

The checker can be used as a Python script:

**Default python**

```
// python qc_opescenario/main.py --help
// python -m qc_opescenario.main --help
qc_opescenario --help
```bash
qc_openscenario --help
usage: QC OpenScenario Checker [-h] (-d | -c CONFIG_PATH)
This is a collection of scripts for checking validity of OpenScenario (.xosc) files.
options:
Expand All @@ -43,24 +29,50 @@ options:
-c CONFIG_PATH, --config_path CONFIG_PATH
```

**Poetry**
The following commands are equivalent:

```bash
qc_openscenario --help
python qc_openscenario/main.py --help
python -m qc_openscenario.main --help
```
poetry run qc_opescenario --help
usage: QC OpenScenario Checker [-h] (-d | -c CONFIG_PATH)
This is a collection of scripts for checking validity of OpenScenario (.xosc) files.
options:
-h, --help show this help message and exit
-d, --default_config
-c CONFIG_PATH, --config_path CONFIG_PATH

### Installation from source

After cloning the repository, there are two options to install from source.

1. Default Python on the machine
2. [Poetry](https://python-poetry.org/)

#### Default Python

```bash
pip install -r requirements.txt
```

### Example
This will install the needed dependencies to your local Python.

- No issues found
#### Poetry

```bash
poetry install
```

After installing from source, the usage are similar to above.

```bash
qc_openscenario --help
python qc_openscenario/main.py --help
python -m qc_openscenario.main --help
```
python3 main.py -c example_config.xml

### Example output

- No issues found

```bash
python qc_openscenario/main.py -c example_config.xml

2024-06-12 15:14:11,864 - Initializing checks
2024-06-12 15:14:11,865 - Executing xml checks
2024-06-12 15:14:11,865 - Executing is_an_xml_document check
Expand All @@ -71,8 +83,9 @@ asam.net:xosc:0.9.0:is_an_xml_document

- Issues found on file

```
python3 main.py -c example_config.xml
```bash
python qc_openscenario/main.py -c example_config.xml

2024-06-12 15:19:45,139 - Initializing checks
2024-06-12 15:19:45,140 - Executing xml checks
2024-06-12 15:19:45,140 - Executing is_an_xml_document check
Expand All @@ -84,34 +97,30 @@ asam.net:xosc:0.9.0:is_an_xml_document

## Tests

To run the tests, you need to have installed the main dependencies mentioned
at [Installation](#installation).

**Install Python tests and development dependencies:**
To run the tests, you need to install the extra test dependency after installing from source.

**Default python**
### Install using pip

```
```bash
pip install -r requirements-tests.txt
```

**Poetry**
### Install using poetry

```
```bash
poetry install --with dev
```

**Execute tests:**
### Execute tests

**Default python**

```
```bash
python -m pytest -vv
```

**Poetry**
or

```
```bash
poetry run pytest -vv
```

Expand All @@ -129,10 +138,16 @@ You can check more options for pytest at its [own documentation](https://docs.py
For contributing, you need to install the development requirements besides the
test and installation requirements, for that run:

```
```bash
pip install -r requirements-dev.txt
```

or

```bash
poetry install --with dev
```

You need to have pre-commit installed and install the hooks:

```
Expand Down