Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: v7.1.0
_commit: v7.3.0-23-g37cff5f
_src_path: gh:eccenca/cmem-plugin-template
author_mail: [email protected]
author_name: eccenca GmbH
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ jobs:

steps:
- name: Check out repository
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Install Task
uses: arduino/setup-task@v2

- name: Set up python
id: setup-python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.11'
python-version: '3.13'

- name: Install and configure poetry
uses: snok/install-poetry@v1
Expand Down Expand Up @@ -58,6 +58,10 @@ jobs:
run: |
task check:pytest

- name: deptry
run: |
task check:deptry

- name: safety
run: |
task check:safety
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ jobs:

steps:
- name: Check out repository
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Install Task
uses: arduino/setup-task@v2

- name: Set up python
id: setup-python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.11'
python-version: '3.13'

- name: Install and configure poetry
uses: snok/install-poetry@v1
Expand Down
13 changes: 8 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
default:
image: docker-registry.eccenca.com/eccenca-python:v3.11.9-2
image: docker-registry.eccenca.com/eccenca-python:v3.13.8
# all jobs can be interrupted in case a new commit is pushed
interruptible: true
before_script:
Expand Down Expand Up @@ -53,10 +53,12 @@ pytest:
junit:
- dist/junit-pytest.xml
paths:
- dist/badge-coverage.svg
- dist/badge-tests.svg
- dist/coverage
- dist/coverage.xml
- dist/*

deptry:
stage: test
script:
- task check:deptry

safety:
stage: test
Expand All @@ -69,6 +71,7 @@ build:
- mypy
- pytest
- safety
- deptry
script:
- task build
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion .idea/cmem-plugin-base.iml

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

2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.11.9
3.13
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

## [Unreleased]

TODO: add at least one Added, Changed, Deprecated, Removed, Fixed or Security section
### Changed

- python 3.13


## [4.14.0] 2025-09-16
Expand Down
10 changes: 9 additions & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ includes:
custom:
taskfile: ./TaskfileCustom.yaml
optional: true
flatten: true
plugin:
taskfile: .tasks-plugin.yml
optional: true
flatten: true

tasks:

Expand Down Expand Up @@ -68,7 +70,6 @@ tasks:
| head -1 | cut -d " " -f 2 | cut -d "." -f 1-2

poetry:install:
internal: true
desc: Install dependencies managed by Poetry
run: once
deps:
Expand Down Expand Up @@ -110,6 +111,7 @@ tasks:
cmds:
- task: check:ruff
- task: check:mypy
- task: check:deptry
- task: check:safety

check:pytest:
Expand Down Expand Up @@ -159,6 +161,12 @@ tasks:
# ignore 51358 safety - dev dependency only
- poetry run safety check -i 51358

check:deptry:
desc: Complain about unused or missing dependencies
<<: *preparation
cmds:
- poetry run deptry .

check:ruff:
desc: Complain about everything else
<<: *preparation
Expand Down
2 changes: 1 addition & 1 deletion cmem_plugin_base/dataintegration/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_packages() -> object:
- version - package version
"""
return json.loads(
check_output(["pip", "list", "--format", "json"], shell=False) # noqa: S603, S607
check_output(["pip", "list", "--format", "json"], shell=False) # noqa: S607
)


Expand Down
15 changes: 15 additions & 0 deletions cmem_plugin_base/dataintegration/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def __eq__(self, other: object) -> bool:
and self.is_single_value == other.is_single_value
)

def __hash__(self) -> int:
"""Return a hash value based on its path, relation status, and single value status."""
return hash((self.path, self.is_relation, self.is_single_value))


class EntitySchema:
"""An entity schema.
Expand Down Expand Up @@ -77,6 +81,17 @@ def __eq__(self, other: object) -> bool:
and self.sub_schemata == other.sub_schemata
)

def __hash__(self) -> int:
"""Return a hash value based on its attributes."""
return hash(
(
self.type_uri,
tuple(self.paths),
self.path_to_root,
tuple(self.sub_schemata) if self.sub_schemata is not None else None,
)
)


class Entity:
"""An Entity can represent an instance of any given concept.
Expand Down
24 changes: 13 additions & 11 deletions cmem_plugin_base/dataintegration/parameter/code.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
"""DI Code Parameter Type."""

import typing
from typing import TypeVar, Generic
from typing import Generic, TypeVar

from cmem_plugin_base.dataintegration.context import PluginContext
from cmem_plugin_base.dataintegration.types import ParameterTypes, ParameterType
from cmem_plugin_base.dataintegration.types import ParameterType, ParameterTypes


class Code:
"""Base class of all code types.
Don't use directly, instead use one of the subclasses."""

Don't use directly, instead use one of the subclasses.
"""

code: str
"""The code string"""

def __str__(self):
def __str__(self) -> str:
"""Return the code string representation."""
return self.code


Expand Down Expand Up @@ -77,26 +80,25 @@ def __init__(self, code: str):
LANG = TypeVar("LANG", bound=Code)


class CodeParameterType(Generic[LANG], ParameterType[LANG]):
class CodeParameterType(ParameterType[LANG], Generic[LANG]):
"""Code parameter type."""

def __init__(self, code_mode: str):
"""Code parameter type."""
self.name = "code-" + code_mode

# flake8: noqa
# pylint: disable=no-member
def get_type(self):
"""Retrieves the concrete code type."""
return typing.get_args(self.__orig_class__)[0]
def get_type(self) -> type:
"""Retrieve the concrete code type."""
return typing.get_args(self.__orig_class__)[0] # type: ignore[attr-defined, no-any-return]

def from_string(self, value: str, context: PluginContext) -> LANG:
"""Parses strings into code instances."""
"""Parse strings into code instances."""
code: LANG = self.get_type()(value)
return code

def to_string(self, value: LANG) -> str:
"""Converts code values into their string representation."""
"""Convert code values into their string representation."""
return value.code


Expand Down
1 change: 0 additions & 1 deletion cmem_plugin_base/dataintegration/parameter/resource.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""DI Resource Parameter Type."""
# ruff: noqa: A005

from typing import Any

Expand Down
11 changes: 7 additions & 4 deletions cmem_plugin_base/dataintegration/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,24 @@ class PluginLogger:
log into DI using the path: plugins.python.<plugin_id>.
"""

def __init__(self) -> None:
self.logger = logging.getLogger(__name__)

def debug(self, message: str) -> None:
"""Log a message with severity 'DEBUG'."""
logging.debug(message)
self.logger.debug(message)

def info(self, message: str) -> None:
"""Log a message with severity 'INFO'."""
logging.info(message)
self.logger.info(message)

def warning(self, message: str) -> None:
"""Log a message with severity 'WARNING'."""
logging.warning(message)
self.logger.warning(message)

def error(self, message: str) -> None:
"""Log a message with severity 'ERROR'."""
logging.error(message)
self.logger.error(message)


class PluginConfig:
Expand Down
1 change: 0 additions & 1 deletion cmem_plugin_base/dataintegration/types.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Parameter types."""
# ruff: noqa: A005

from collections.abc import Iterable
from dataclasses import dataclass
Expand Down
Loading