Skip to content

Commit 4c373b7

Browse files
authored
Merge pull request #36 from eccenca/feature/upgradeTemplate
Update template
2 parents c535a82 + 708548b commit 4c373b7

12 files changed

Lines changed: 718 additions & 611 deletions

File tree

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: v7.3.0-23-g37cff5f
2+
_commit: v8.3.1
33
_src_path: gh:eccenca/cmem-plugin-template
44
author_mail: cmempy-developer@eccenca.com
55
author_name: eccenca GmbH

.github/workflows/check.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ jobs:
2222
- name: Check out repository
2323
uses: actions/checkout@v5
2424

25+
- name: Cache Trivy DB
26+
id: cache-trivydb
27+
uses: actions/cache@v4
28+
with:
29+
path: .trivycache
30+
key: ${{ runner.os }}-trivydb
31+
2532
- name: Install Task
2633
uses: arduino/setup-task@v2
2734

@@ -62,9 +69,13 @@ jobs:
6269
run: |
6370
task check:deptry
6471
65-
- name: safety
72+
- name: trivy
73+
env:
74+
TRIVY_NO_PROGRESS: "true"
75+
TRIVY_CACHE_DIR: ".trivycache/"
76+
TRIVY_DISABLE_VEX_NOTICE: "true"
6677
run: |
67-
task check:safety
78+
task check:trivy
6879
6980
- name: Publish Test Report in Action
7081
uses: mikepenz/action-junit-report@v4

.gitlab-ci.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,24 @@ deptry:
6060
script:
6161
- task check:deptry
6262

63-
safety:
63+
trivy:
6464
stage: test
65+
variables:
66+
TRIVY_NO_PROGRESS: "true"
67+
TRIVY_CACHE_DIR: ".trivycache/"
68+
TRIVY_DISABLE_VEX_NOTICE: "true"
6569
script:
66-
- task check:safety
70+
- task check:trivy
71+
cache:
72+
paths:
73+
- .trivycache/
6774

6875
build:
6976
stage: build
7077
needs:
7178
- mypy
7279
- pytest
73-
- safety
80+
- trivy
7481
- deptry
7582
script:
7683
- task build

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
---
2+
default_language_version:
3+
python: python3.13
4+
25
repos:
36
- repo: local
47
hooks:
@@ -36,3 +39,9 @@ repos:
3639
stages: [post-checkout, post-merge]
3740
always_run: true
3841

42+
- id: trivy
43+
name: check:trivy
44+
description: run trivy to scan for vulnerabilities
45+
entry: task check:trivy
46+
language: python
47+
pass_filenames: false

.trivyignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# .trivyignore
2+
3+
# ignore 51358 safety - dev dependency only
4+
CVE-2022-39280

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55

66
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](https://semver.org/)
77

8+
## [Unreleased]
9+
10+
### Changed
11+
12+
- Updated template
13+
814
## [4.15.0] 2025-10-15
915

1016
### Changed

Taskfile.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ tasks:
5151
Check poetry versioning plugin. Currently not under Windows
5252
run: once
5353
preconditions:
54-
- sh: '[ -d .git ]'
54+
- sh: git -C . rev-parse
5555
msg: >
5656
Your newly created project directory needs to be initialized
5757
as a git repository.
@@ -112,7 +112,7 @@ tasks:
112112
- task: check:ruff
113113
- task: check:mypy
114114
- task: check:deptry
115-
- task: check:safety
115+
- task: check:trivy
116116

117117
check:pytest:
118118
desc: Run unit and integration tests
@@ -154,12 +154,16 @@ tasks:
154154
vars:
155155
JUNIT_FILE: ./{{.DIST_DIR}}/junit-mypy.xml
156156

157-
check:safety:
158-
desc: Complain about vulnerabilities in dependencies
157+
check:trivy:
158+
desc: Scan for vulnerabilities using Trivy
159159
<<: *preparation
160160
cmds:
161-
# ignore 51358 safety - dev dependency only
162-
- poetry run safety check -i 51358
161+
- >
162+
poetry run trivy fs
163+
--include-dev-deps
164+
--scanners vuln
165+
--exit-code 1
166+
.
163167
164168
check:deptry:
165169
desc: Complain about unused or missing dependencies

cmem_plugin_base/dataintegration/typed_entities/file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def close(self) -> None:
8989
"""Close the underlying text stream."""
9090
self._text_stream.close()
9191

92-
def __enter__(self) -> "_TextToBytesWrapper":
92+
def __enter__(self) -> "_TextToBytesWrapper": # noqa: PYI034
9393
return self
9494

9595
def __exit__(self, *args: object) -> None:

cmem_plugin_base/dataintegration/typed_entities/typed_entities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class TypedEntitySchema(EntitySchema, Generic[T]):
1515
# Class variable to store singleton instances for each subclass
1616
_instances: ClassVar[dict[type["TypedEntitySchema"], "TypedEntitySchema"]] = {}
1717

18-
def __new__(cls, *args, **kwargs) -> "TypedEntitySchema": # noqa: ANN002, ANN003, ARG004
18+
def __new__(cls, *args, **kwargs) -> "TypedEntitySchema": # noqa: ANN002, ANN003, ARG004 PYI034
1919
"""Implement singleton pattern for all subclasses of TypedEntitySchema."""
2020
if cls not in cls._instances:
2121
cls._instances[cls] = super().__new__(cls)

cmem_plugin_base/dataintegration/utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def split_task_id(task_id: str) -> tuple:
6464
6565
"""
6666
try:
67-
project_part = task_id.split(":")[0]
67+
project_part = task_id.split(":", maxsplit=1)[0]
6868
task_part = task_id.split(":")[1]
6969
except IndexError as error:
7070
raise ValueError(f"{task_id} is not a valid task ID.") from error

0 commit comments

Comments
 (0)