Skip to content

Commit

Permalink
Merge pull request #11 from DSD-DBS/version_update
Browse files Browse the repository at this point in the history
Version update
  • Loading branch information
nalquas authored Nov 29, 2024
2 parents d6836c0 + 997637d commit 9ea9e29
Show file tree
Hide file tree
Showing 36 changed files with 872 additions and 1,497 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ jobs:
matrix:
os: [ubuntu-latest]
python_version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
include:
- os: windows-latest
python_version: "3.8"
python_version: "3.13"
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{matrix.python_version}}
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.13"
- name: Install dependencies
run: |-
python -m pip install -U pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.12"
- name: Upgrade pip
run: |
python -m pip install -U pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.12"
- name: Upgrade pip
run: |-
python -m pip install -U pip
Expand Down
11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dynamic = ["version"]
name = "raillabel-providerkit"
description = "A devkit for working with recorded and annotated train ride data from Deutsche Bahn."
readme = "README.md"
requires-python = ">=3.8, <3.12"
requires-python = ">=3.10, <3.14"
license = { text = "Apache-2.0" }
authors = [
{ name = "DB InfraGO AG" },
Expand All @@ -27,17 +27,18 @@ classifiers = [
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
"jsonschema>=4.4.0",
"fastjsonschema>=2.16.2",
"raillabel>=3.1.0, <4.0.0",
"raillabel==4.0.0",
"pyyaml>=6.0.0",
"numpy>=1.24.4",
"pydantic<3.0.0",
]

[project.urls]
Expand All @@ -49,7 +50,7 @@ docs = [
"furo",
"sphinx",
"sphinx-copybutton",
"tomli; python_version<'3.11'",
"tomli; python_version<'3.14'",
]

test = [
Expand Down
27 changes: 0 additions & 27 deletions raillabel_providerkit/_util/_filters.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from pathlib import Path

import jsonschema
import raillabel
from raillabel import Scene
from raillabel.json_format import JSONScene

from raillabel_providerkit._util._warning import _WarningsLogger
from raillabel_providerkit.format import understand_ai as uai_format

from ._loader_abc import LoaderABC
Expand Down Expand Up @@ -52,18 +52,17 @@ def load(self, data: dict, validate_schema: bool = False) -> uai_format.Scene:
The loaded scene with the data.
"""
raise NotImplementedError(
"We were not sure if this class is even used anymore. If you see this error, contact us " # noqa: EM101
"and we will re-implement the class."
)

if validate_schema:
self.validate_schema(data)

with _WarningsLogger() as logger:
data_converted_to_raillabel = uai_format.Scene.fromdict(data).to_raillabel()

raillabel_loader = raillabel.load_.loader_classes.LoaderRailLabel()
raillabel_scene = raillabel_loader.load(data_converted_to_raillabel, validate=False)

self.warnings = logger.warnings + raillabel_loader.warnings
data_converted_to_raillabel = uai_format.Scene.fromdict(data).to_raillabel()

return raillabel_scene
return Scene.from_json(JSONScene(**data_converted_to_raillabel))

def supports(self, data: dict) -> bool:
"""Determine if the loader is suitable for the data (lightweight).
Expand Down
3 changes: 2 additions & 1 deletion raillabel_providerkit/validation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"""Package for validating raillabel data regarding the format requirements."""

from .validate_onthology.validate_onthology import validate_onthology
from .validate_schema import validate_schema

__all__ = ["validate_onthology"]
__all__ = ["validate_onthology", "validate_schema"]
18 changes: 5 additions & 13 deletions raillabel_providerkit/validation/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,16 @@

from __future__ import annotations

from pathlib import Path
from . import validate_schema

import raillabel

from . import validate_onthology


def validate(scene: raillabel.Scene, onthology: dict | Path) -> list[str]:
def validate(scene_dict: dict) -> list[str]:
"""Validate a scene based on the Deutsche Bahn Requirements.
Parameters
----------
scene : raillabel.Scene
The scene containing the annotations.
onthology : dict or Path
Onthology YAML-data or file containing a information about all classes and their
attributes. The onthology must adhere to the onthology_schema. If a path is provided, the
file is loaded as a YAML.
scene_dict : dict
The scene as a dictionary directly from `json.load()` in the raillabel format.
Returns
-------
Expand All @@ -31,6 +23,6 @@ def validate(scene: raillabel.Scene, onthology: dict | Path) -> list[str]:
"""
errors = []

errors += validate_onthology(scene, onthology)
errors.extend(validate_schema(scene_dict))

return errors
Loading

0 comments on commit 9ea9e29

Please sign in to comment.