Skip to content

Commit 5b14ecb

Browse files
Merge pull request #1 from eccenca/feature/updateTemplate
poetry update
2 parents f3acb94 + 4c94d64 commit 5b14ecb

7 files changed

Lines changed: 65 additions & 71 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.0.0
2+
_commit: v7.1.0
33
_src_path: gh:eccenca/cmem-plugin-template
44
author_mail: cmempy-developer@eccenca.com
55
author_name: eccenca GmbH

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
default:
3-
image: docker-registry.eccenca.com/eccenca-python:v3.11.4
3+
image: docker-registry.eccenca.com/eccenca-python:v3.11.9-2
44
# all jobs can be interrupted in case a new commit is pushed
55
interruptible: true
66
before_script:

Taskfile.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,7 @@ tasks:
157157
<<: *preparation
158158
cmds:
159159
# ignore 51358 safety - dev dependency only
160-
# ignore 67599 pip - dev dependency only
161-
# ignore 70612 jinja2 - dev dependency only
162-
- poetry run safety check -i 51358 -i 67599 -i 70612
160+
- poetry run safety check -i 51358
163161

164162
check:ruff:
165163
desc: Complain about everything else

cmem_plugin_splitfile/plugin_splitfile.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""A task splitting a text file into multiple parts with a specified size"""
22

33
from collections import OrderedDict
4+
from collections.abc import Sequence
45
from io import BytesIO
56
from pathlib import Path
67
from shutil import move
@@ -16,6 +17,7 @@
1617
)
1718
from cmem_plugin_base.dataintegration.context import ExecutionContext, ExecutionReport
1819
from cmem_plugin_base.dataintegration.description import Icon, Plugin, PluginParameter
20+
from cmem_plugin_base.dataintegration.entity import Entities
1921
from cmem_plugin_base.dataintegration.parameter.choice import ChoiceParameterType
2022
from cmem_plugin_base.dataintegration.plugins import WorkflowPlugin
2123
from cmem_plugin_base.dataintegration.ports import FixedNumberOfInputs
@@ -134,7 +136,7 @@ def __init__( # noqa: C901 PLR0913
134136
errors += "Minimum chunk size is 1024 bytes. "
135137

136138
if use_directory:
137-
test_path = projects_path[1:] if projects_path.startswith("/") else projects_path
139+
test_path = projects_path.removeprefix("/")
138140
if not is_valid_filepath(test_path):
139141
errors += 'Invalid path for parameter "Internal projects directory". '
140142
elif not Path(projects_path).is_dir():
@@ -246,7 +248,7 @@ def execute_filesystem(self) -> bool:
246248
(resources_path / self.input_filename).unlink()
247249
return True
248250

249-
def execute(self, inputs: None, context: ExecutionContext) -> None: # noqa: ARG002
251+
def execute(self, inputs: Sequence[Entities], context: ExecutionContext) -> None: # noqa: ARG002
250252
"""Execute plugin with temporary directory"""
251253
self.context = context
252254
context.report.update(ExecutionReport(entity_count=0, operation_desc="files generated"))

poetry.lock

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ keywords = [
1515

1616
[tool.poetry.dependencies]# if you need to change python version here, change it also in .python-version
1717
python = "^3.11"
18-
pathvalidate = "^3.2.1"
18+
pathvalidate = "^3.2.3"
1919
filesplit = "^4.1.0"
2020
types-requests = "^2.32.0.20241016"
2121
urllib3 = "^2.2.3"
@@ -25,18 +25,18 @@ version = "^4.5.0"
2525
allow-prereleases = false
2626

2727
[tool.poetry.group.dev.dependencies.cmem-cmemc]
28-
version = "^24.2.0"
28+
version = "^24.3.0"
2929

3030
[tool.poetry.group.dev.dependencies]
3131
genbadge = {extras = ["coverage"], version = "^1.1.1"}
32-
mypy = "^1.11.1"
33-
pip = "^24"
34-
pytest = "^8.3.2"
35-
pytest-cov = "^5.0.0"
32+
mypy = "^1.14.1"
33+
pip = "^25.0"
34+
pytest = "^8.3.4"
35+
pytest-cov = "^6.0.0"
3636
pytest-dotenv = "^0.5.2"
3737
pytest-html = "^4.1.1"
3838
pytest-memray = { version = "^1.7.0", markers = "platform_system != 'Windows'" }
39-
ruff = "^0.6.1"
39+
ruff = "^0.9.4"
4040
safety = "^1.10.3"
4141

4242
[build-system]
@@ -78,7 +78,6 @@ line-ending = "lf" # Use `\n` line endings for all files
7878
[tool.ruff.lint]
7979
select = ["ALL"]
8080
ignore = [
81-
"ANN101", # Missing type annotation for self in method
8281
"ANN204", # Missing return type annotation for special method `__init__`
8382
"COM812", # missing-trailing-comma
8483
"D107", # Missing docstring in __init__
Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import pytest
1010
from cmem.cmempy.workspace.projects.project import delete_project, make_new_project
1111
from cmem.cmempy.workspace.projects.resources.resource import create_resource, get_resource
12-
from requests.exceptions import HTTPError
12+
from requests import HTTPError
1313

1414
from cmem_plugin_splitfile.plugin_splitfile import SplitFilePlugin
1515
from tests.utils import TestExecutionContext, needs_cmem
@@ -57,12 +57,12 @@ def test_filesystem_size() -> None:
5757
size_unit="KB",
5858
projects_path=__path__[0],
5959
use_directory=True,
60-
).execute(None, context=TestExecutionContext(PROJECT_ID))
60+
).execute(inputs=[], context=TestExecutionContext(PROJECT_ID))
6161

6262
for n in range(3):
6363
assert cmp(
64-
Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n+1}.nt",
65-
Path(__path__[0]) / "test_files" / f"{UUID4}_size_00000000{n+1}.nt",
64+
Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n + 1}.nt",
65+
Path(__path__[0]) / "test_files" / f"{UUID4}_size_00000000{n + 1}.nt",
6666
)
6767

6868
if not (Path(__path__[0]) / PROJECT_ID / "resources" / TEST_FILENAME).is_file():
@@ -80,12 +80,12 @@ def test_filesystem_size_header() -> None:
8080
include_header=True,
8181
projects_path=__path__[0],
8282
use_directory=True,
83-
).execute(None, context=TestExecutionContext(PROJECT_ID))
83+
).execute(inputs=[], context=TestExecutionContext(PROJECT_ID))
8484

8585
for n in range(3):
8686
assert cmp(
87-
Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n+1}.nt",
88-
Path(__path__[0]) / "test_files" / f"{UUID4}_size_header_00000000{n+1}.nt",
87+
Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n + 1}.nt",
88+
Path(__path__[0]) / "test_files" / f"{UUID4}_size_header_00000000{n + 1}.nt",
8989
)
9090

9191
if not (Path(__path__[0]) / PROJECT_ID / "resources" / TEST_FILENAME).is_file():
@@ -101,13 +101,13 @@ def test_api_size() -> None:
101101
chunk_size=6,
102102
size_unit="KB",
103103
projects_path=__path__[0],
104-
).execute(None, context=TestExecutionContext(PROJECT_ID))
104+
).execute(inputs=[], context=TestExecutionContext(PROJECT_ID))
105105

106106
for n in range(3):
107-
f = get_resource(project_name=PROJECT_ID, resource_name=f"{UUID4}_00000000{n+1}.nt")
107+
f = get_resource(project_name=PROJECT_ID, resource_name=f"{UUID4}_00000000{n + 1}.nt")
108108
assert (
109109
f
110-
== (Path(__path__[0]) / "test_files" / f"{UUID4}_size_00000000{n+1}.nt")
110+
== (Path(__path__[0]) / "test_files" / f"{UUID4}_size_00000000{n + 1}.nt")
111111
.open("rb")
112112
.read()
113113
)
@@ -126,12 +126,12 @@ def test_filesystem_size_delete() -> None:
126126
projects_path=__path__[0],
127127
use_directory=True,
128128
delete_file=True,
129-
).execute(None, context=TestExecutionContext(PROJECT_ID))
129+
).execute(inputs=[], context=TestExecutionContext(PROJECT_ID))
130130

131131
for n in range(3):
132132
assert cmp(
133-
Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n+1}.nt",
134-
Path(__path__[0]) / "test_files" / f"{UUID4}_size_00000000{n+1}.nt",
133+
Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n + 1}.nt",
134+
Path(__path__[0]) / "test_files" / f"{UUID4}_size_00000000{n + 1}.nt",
135135
)
136136

137137
if (Path(__path__[0]) / PROJECT_ID / "resources" / TEST_FILENAME).is_file():
@@ -148,24 +148,19 @@ def test_api_size_delete() -> None:
148148
size_unit="KB",
149149
projects_path=__path__[0],
150150
delete_file=True,
151-
).execute(None, context=TestExecutionContext(PROJECT_ID))
151+
).execute(inputs=[], context=TestExecutionContext(PROJECT_ID))
152152

153153
for n in range(3):
154-
f = get_resource(project_name=PROJECT_ID, resource_name=f"{UUID4}_00000000{n+1}.nt")
154+
f = get_resource(project_name=PROJECT_ID, resource_name=f"{UUID4}_00000000{n + 1}.nt")
155155
assert (
156156
f
157-
== (Path(__path__[0]) / "test_files" / f"{UUID4}_size_00000000{n+1}.nt")
157+
== (Path(__path__[0]) / "test_files" / f"{UUID4}_size_00000000{n + 1}.nt")
158158
.open("rb")
159159
.read()
160160
)
161161

162-
try:
162+
with pytest.raises(HTTPError, match="404 Client Error: Not Found for url:"):
163163
get_resource(project_name=PROJECT_ID, resource_name=TEST_FILENAME)
164-
except Exception as exc:
165-
if type(exc) is HTTPError and exc.status_code == 404: # noqa: PLR2004
166-
pass
167-
else:
168-
raise
169164

170165

171166
@needs_cmem
@@ -178,12 +173,12 @@ def test_filesystem_lines() -> None:
178173
size_unit="Lines",
179174
projects_path=__path__[0],
180175
use_directory=True,
181-
).execute(None, context=TestExecutionContext(PROJECT_ID))
176+
).execute(inputs=[], context=TestExecutionContext(PROJECT_ID))
182177

183178
for n in range(3):
184179
assert cmp(
185-
Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n+1}.nt",
186-
Path(__path__[0]) / "test_files" / f"{UUID4}_lines_00000000{n+1}.nt",
180+
Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n + 1}.nt",
181+
Path(__path__[0]) / "test_files" / f"{UUID4}_lines_00000000{n + 1}.nt",
187182
)
188183

189184

@@ -198,10 +193,10 @@ def test_filesystem_lines_header() -> None:
198193
include_header=True,
199194
projects_path=__path__[0],
200195
use_directory=True,
201-
).execute(None, context=TestExecutionContext(PROJECT_ID))
196+
).execute(inputs=[], context=TestExecutionContext(PROJECT_ID))
202197

203198
for n in range(3):
204199
assert cmp(
205-
Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n+1}.nt",
206-
Path(__path__[0]) / "test_files" / f"{UUID4}_lines_header_00000000{n+1}.nt",
200+
Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n + 1}.nt",
201+
Path(__path__[0]) / "test_files" / f"{UUID4}_lines_header_00000000{n + 1}.nt",
207202
)

0 commit comments

Comments
 (0)