From 4c94d64a949c98a36d875269809fdae4cae384d4 Mon Sep 17 00:00:00 2001 From: muddymudskipper Date: Tue, 11 Feb 2025 11:04:49 +0000 Subject: [PATCH] poetry update --- .copier-answers.yml | 2 +- .gitlab-ci.yml | 2 +- Taskfile.yaml | 4 +- cmem_plugin_splitfile/plugin_splitfile.py | 6 ++- poetry.lock | 56 ++++++++++---------- pyproject.toml | 15 +++--- tests/{test_splitnt.py => test_splitfile.py} | 51 ++++++++---------- 7 files changed, 65 insertions(+), 71 deletions(-) rename tests/{test_splitnt.py => test_splitfile.py} (85%) diff --git a/.copier-answers.yml b/.copier-answers.yml index 748e907..2c7fb58 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: v7.0.0 +_commit: v7.1.0 _src_path: gh:eccenca/cmem-plugin-template author_mail: cmempy-developer@eccenca.com author_name: eccenca GmbH diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 13f67e9..cd56453 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,6 @@ --- default: - image: docker-registry.eccenca.com/eccenca-python:v3.11.4 + image: docker-registry.eccenca.com/eccenca-python:v3.11.9-2 # all jobs can be interrupted in case a new commit is pushed interruptible: true before_script: diff --git a/Taskfile.yaml b/Taskfile.yaml index 3f3835b..1d04220 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -157,9 +157,7 @@ tasks: <<: *preparation cmds: # ignore 51358 safety - dev dependency only - # ignore 67599 pip - dev dependency only - # ignore 70612 jinja2 - dev dependency only - - poetry run safety check -i 51358 -i 67599 -i 70612 + - poetry run safety check -i 51358 check:ruff: desc: Complain about everything else diff --git a/cmem_plugin_splitfile/plugin_splitfile.py b/cmem_plugin_splitfile/plugin_splitfile.py index 33e8585..ad6e177 100644 --- a/cmem_plugin_splitfile/plugin_splitfile.py +++ b/cmem_plugin_splitfile/plugin_splitfile.py @@ -1,6 +1,7 @@ """A task splitting a text file into multiple parts with a specified size""" from collections import OrderedDict +from collections.abc import Sequence from io import BytesIO from pathlib import Path from shutil import move @@ -16,6 +17,7 @@ ) from cmem_plugin_base.dataintegration.context import ExecutionContext, ExecutionReport from cmem_plugin_base.dataintegration.description import Icon, Plugin, PluginParameter +from cmem_plugin_base.dataintegration.entity import Entities from cmem_plugin_base.dataintegration.parameter.choice import ChoiceParameterType from cmem_plugin_base.dataintegration.plugins import WorkflowPlugin from cmem_plugin_base.dataintegration.ports import FixedNumberOfInputs @@ -134,7 +136,7 @@ def __init__( # noqa: C901 PLR0913 errors += "Minimum chunk size is 1024 bytes. " if use_directory: - test_path = projects_path[1:] if projects_path.startswith("/") else projects_path + test_path = projects_path.removeprefix("/") if not is_valid_filepath(test_path): errors += 'Invalid path for parameter "Internal projects directory". ' elif not Path(projects_path).is_dir(): @@ -246,7 +248,7 @@ def execute_filesystem(self) -> bool: (resources_path / self.input_filename).unlink() return True - def execute(self, inputs: None, context: ExecutionContext) -> None: # noqa: ARG002 + def execute(self, inputs: Sequence[Entities], context: ExecutionContext) -> None: # noqa: ARG002 """Execute plugin with temporary directory""" self.context = context context.report.update(ExecutionReport(entity_count=0, operation_desc="files generated")) diff --git a/poetry.lock b/poetry.lock index 2d98274..23ccc29 100644 --- a/poetry.lock +++ b/poetry.lock @@ -920,14 +920,14 @@ xmp = ["defusedxml"] [[package]] name = "pip" -version = "24.3.1" +version = "25.0.1" description = "The PyPA recommended tool for installing Python packages." optional = false python-versions = ">=3.8" groups = ["dev"] files = [ - {file = "pip-24.3.1-py3-none-any.whl", hash = "sha256:3790624780082365f47549d032f3770eeb2b1e8bd1f7b2e02dace1afa361b4ed"}, - {file = "pip-24.3.1.tar.gz", hash = "sha256:ebcb60557f2aefabc2e0f918751cd24ea0d56d8ec5445fe1807f1d2109660b99"}, + {file = "pip-25.0.1-py3-none-any.whl", hash = "sha256:c46efd13b6aa8279f33f2864459c8ce587ea6a1a59ee20de055868d8f7688f7f"}, + {file = "pip-25.0.1.tar.gz", hash = "sha256:88f96547ea48b940a3a385494e181e29fb8637898f88d88737c5049780f196ea"}, ] [[package]] @@ -1050,18 +1050,18 @@ dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments [[package]] name = "pytest-cov" -version = "5.0.0" +version = "6.0.0" description = "Pytest plugin for measuring coverage." optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" groups = ["dev"] files = [ - {file = "pytest-cov-5.0.0.tar.gz", hash = "sha256:5837b58e9f6ebd335b0f8060eecce69b662415b16dc503883a02f45dfeb14857"}, - {file = "pytest_cov-5.0.0-py3-none-any.whl", hash = "sha256:4f0764a1219df53214206bf1feea4633c3b558a2925c8b59f144f682861ce652"}, + {file = "pytest-cov-6.0.0.tar.gz", hash = "sha256:fde0b595ca248bb8e2d76f020b465f3b107c9632e6a1d1705f17834c89dcadc0"}, + {file = "pytest_cov-6.0.0-py3-none-any.whl", hash = "sha256:eee6f1b9e61008bd34975a4d5bab25801eb31898b032dd55addc93e96fcaaa35"}, ] [package.dependencies] -coverage = {version = ">=5.2.1", extras = ["toml"]} +coverage = {version = ">=7.5", extras = ["toml"]} pytest = ">=4.6" [package.extras] @@ -1269,30 +1269,30 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"] [[package]] name = "ruff" -version = "0.6.9" +version = "0.9.6" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" groups = ["dev"] files = [ - {file = "ruff-0.6.9-py3-none-linux_armv6l.whl", hash = "sha256:064df58d84ccc0ac0fcd63bc3090b251d90e2a372558c0f057c3f75ed73e1ccd"}, - {file = "ruff-0.6.9-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:140d4b5c9f5fc7a7b074908a78ab8d384dd7f6510402267bc76c37195c02a7ec"}, - {file = "ruff-0.6.9-py3-none-macosx_11_0_arm64.whl", hash = "sha256:53fd8ca5e82bdee8da7f506d7b03a261f24cd43d090ea9db9a1dc59d9313914c"}, - {file = "ruff-0.6.9-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:645d7d8761f915e48a00d4ecc3686969761df69fb561dd914a773c1a8266e14e"}, - {file = "ruff-0.6.9-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:eae02b700763e3847595b9d2891488989cac00214da7f845f4bcf2989007d577"}, - {file = "ruff-0.6.9-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7d5ccc9e58112441de8ad4b29dcb7a86dc25c5f770e3c06a9d57e0e5eba48829"}, - {file = "ruff-0.6.9-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:417b81aa1c9b60b2f8edc463c58363075412866ae4e2b9ab0f690dc1e87ac1b5"}, - {file = "ruff-0.6.9-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3c866b631f5fbce896a74a6e4383407ba7507b815ccc52bcedabb6810fdb3ef7"}, - {file = "ruff-0.6.9-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7b118afbb3202f5911486ad52da86d1d52305b59e7ef2031cea3425142b97d6f"}, - {file = "ruff-0.6.9-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a67267654edc23c97335586774790cde402fb6bbdb3c2314f1fc087dee320bfa"}, - {file = "ruff-0.6.9-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3ef0cc774b00fec123f635ce5c547dac263f6ee9fb9cc83437c5904183b55ceb"}, - {file = "ruff-0.6.9-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:12edd2af0c60fa61ff31cefb90aef4288ac4d372b4962c2864aeea3a1a2460c0"}, - {file = "ruff-0.6.9-py3-none-musllinux_1_2_i686.whl", hash = "sha256:55bb01caeaf3a60b2b2bba07308a02fca6ab56233302406ed5245180a05c5625"}, - {file = "ruff-0.6.9-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:925d26471fa24b0ce5a6cdfab1bb526fb4159952385f386bdcc643813d472039"}, - {file = "ruff-0.6.9-py3-none-win32.whl", hash = "sha256:eb61ec9bdb2506cffd492e05ac40e5bc6284873aceb605503d8494180d6fc84d"}, - {file = "ruff-0.6.9-py3-none-win_amd64.whl", hash = "sha256:785d31851c1ae91f45b3d8fe23b8ae4b5170089021fbb42402d811135f0b7117"}, - {file = "ruff-0.6.9-py3-none-win_arm64.whl", hash = "sha256:a9641e31476d601f83cd602608739a0840e348bda93fec9f1ee816f8b6798b93"}, - {file = "ruff-0.6.9.tar.gz", hash = "sha256:b076ef717a8e5bc819514ee1d602bbdca5b4420ae13a9cf61a0c0a4f53a2baa2"}, + {file = "ruff-0.9.6-py3-none-linux_armv6l.whl", hash = "sha256:2f218f356dd2d995839f1941322ff021c72a492c470f0b26a34f844c29cdf5ba"}, + {file = "ruff-0.9.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:b908ff4df65dad7b251c9968a2e4560836d8f5487c2f0cc238321ed951ea0504"}, + {file = "ruff-0.9.6-py3-none-macosx_11_0_arm64.whl", hash = "sha256:b109c0ad2ececf42e75fa99dc4043ff72a357436bb171900714a9ea581ddef83"}, + {file = "ruff-0.9.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1de4367cca3dac99bcbd15c161404e849bb0bfd543664db39232648dc00112dc"}, + {file = "ruff-0.9.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ac3ee4d7c2c92ddfdaedf0bf31b2b176fa7aa8950efc454628d477394d35638b"}, + {file = "ruff-0.9.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5dc1edd1775270e6aa2386119aea692039781429f0be1e0949ea5884e011aa8e"}, + {file = "ruff-0.9.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:4a091729086dffa4bd070aa5dab7e39cc6b9d62eb2bef8f3d91172d30d599666"}, + {file = "ruff-0.9.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d1bbc6808bf7b15796cef0815e1dfb796fbd383e7dbd4334709642649625e7c5"}, + {file = "ruff-0.9.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:589d1d9f25b5754ff230dce914a174a7c951a85a4e9270613a2b74231fdac2f5"}, + {file = "ruff-0.9.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dc61dd5131742e21103fbbdcad683a8813be0e3c204472d520d9a5021ca8b217"}, + {file = "ruff-0.9.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:5e2d9126161d0357e5c8f30b0bd6168d2c3872372f14481136d13de9937f79b6"}, + {file = "ruff-0.9.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:68660eab1a8e65babb5229a1f97b46e3120923757a68b5413d8561f8a85d4897"}, + {file = "ruff-0.9.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:c4cae6c4cc7b9b4017c71114115db0445b00a16de3bcde0946273e8392856f08"}, + {file = "ruff-0.9.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:19f505b643228b417c1111a2a536424ddde0db4ef9023b9e04a46ed8a1cb4656"}, + {file = "ruff-0.9.6-py3-none-win32.whl", hash = "sha256:194d8402bceef1b31164909540a597e0d913c0e4952015a5b40e28c146121b5d"}, + {file = "ruff-0.9.6-py3-none-win_amd64.whl", hash = "sha256:03482d5c09d90d4ee3f40d97578423698ad895c87314c4de39ed2af945633caa"}, + {file = "ruff-0.9.6-py3-none-win_arm64.whl", hash = "sha256:0e2bb706a2be7ddfea4a4af918562fdc1bcb16df255e5fa595bbd800ce322a5a"}, + {file = "ruff-0.9.6.tar.gz", hash = "sha256:81761592f72b620ec8fa1068a6fd00e98a5ebee342a3642efd84454f3031dca9"}, ] [[package]] @@ -1586,4 +1586,4 @@ files = [ [metadata] lock-version = "2.1" python-versions = "^3.11" -content-hash = "5d8891256f19f42d0dd351902f87d3b0fa00b696608cd381717f626dbb9f9c4e" +content-hash = "18efad223f61ca8b15b61911d0c3ab3eaad6f9d271c5d92c5ac7aa1f0d3b7e8e" diff --git a/pyproject.toml b/pyproject.toml index 75c9569..e3af98c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ keywords = [ [tool.poetry.dependencies]# if you need to change python version here, change it also in .python-version python = "^3.11" -pathvalidate = "^3.2.1" +pathvalidate = "^3.2.3" filesplit = "^4.1.0" types-requests = "^2.32.0.20241016" urllib3 = "^2.2.3" @@ -25,18 +25,18 @@ version = "^4.5.0" allow-prereleases = false [tool.poetry.group.dev.dependencies.cmem-cmemc] -version = "^24.2.0" +version = "^24.3.0" [tool.poetry.group.dev.dependencies] genbadge = {extras = ["coverage"], version = "^1.1.1"} -mypy = "^1.11.1" -pip = "^24" -pytest = "^8.3.2" -pytest-cov = "^5.0.0" +mypy = "^1.14.1" +pip = "^25.0" +pytest = "^8.3.4" +pytest-cov = "^6.0.0" pytest-dotenv = "^0.5.2" pytest-html = "^4.1.1" pytest-memray = { version = "^1.7.0", markers = "platform_system != 'Windows'" } -ruff = "^0.6.1" +ruff = "^0.9.4" safety = "^1.10.3" [build-system] @@ -78,7 +78,6 @@ line-ending = "lf" # Use `\n` line endings for all files [tool.ruff.lint] select = ["ALL"] ignore = [ - "ANN101", # Missing type annotation for self in method "ANN204", # Missing return type annotation for special method `__init__` "COM812", # missing-trailing-comma "D107", # Missing docstring in __init__ diff --git a/tests/test_splitnt.py b/tests/test_splitfile.py similarity index 85% rename from tests/test_splitnt.py rename to tests/test_splitfile.py index 92ab157..55e2283 100644 --- a/tests/test_splitnt.py +++ b/tests/test_splitfile.py @@ -9,7 +9,7 @@ import pytest from cmem.cmempy.workspace.projects.project import delete_project, make_new_project from cmem.cmempy.workspace.projects.resources.resource import create_resource, get_resource -from requests.exceptions import HTTPError +from requests import HTTPError from cmem_plugin_splitfile.plugin_splitfile import SplitFilePlugin from tests.utils import TestExecutionContext, needs_cmem @@ -57,12 +57,12 @@ def test_filesystem_size() -> None: size_unit="KB", projects_path=__path__[0], use_directory=True, - ).execute(None, context=TestExecutionContext(PROJECT_ID)) + ).execute(inputs=[], context=TestExecutionContext(PROJECT_ID)) for n in range(3): assert cmp( - Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n+1}.nt", - Path(__path__[0]) / "test_files" / f"{UUID4}_size_00000000{n+1}.nt", + Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n + 1}.nt", + Path(__path__[0]) / "test_files" / f"{UUID4}_size_00000000{n + 1}.nt", ) if not (Path(__path__[0]) / PROJECT_ID / "resources" / TEST_FILENAME).is_file(): @@ -80,12 +80,12 @@ def test_filesystem_size_header() -> None: include_header=True, projects_path=__path__[0], use_directory=True, - ).execute(None, context=TestExecutionContext(PROJECT_ID)) + ).execute(inputs=[], context=TestExecutionContext(PROJECT_ID)) for n in range(3): assert cmp( - Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n+1}.nt", - Path(__path__[0]) / "test_files" / f"{UUID4}_size_header_00000000{n+1}.nt", + Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n + 1}.nt", + Path(__path__[0]) / "test_files" / f"{UUID4}_size_header_00000000{n + 1}.nt", ) if not (Path(__path__[0]) / PROJECT_ID / "resources" / TEST_FILENAME).is_file(): @@ -101,13 +101,13 @@ def test_api_size() -> None: chunk_size=6, size_unit="KB", projects_path=__path__[0], - ).execute(None, context=TestExecutionContext(PROJECT_ID)) + ).execute(inputs=[], context=TestExecutionContext(PROJECT_ID)) for n in range(3): - f = get_resource(project_name=PROJECT_ID, resource_name=f"{UUID4}_00000000{n+1}.nt") + f = get_resource(project_name=PROJECT_ID, resource_name=f"{UUID4}_00000000{n + 1}.nt") assert ( f - == (Path(__path__[0]) / "test_files" / f"{UUID4}_size_00000000{n+1}.nt") + == (Path(__path__[0]) / "test_files" / f"{UUID4}_size_00000000{n + 1}.nt") .open("rb") .read() ) @@ -126,12 +126,12 @@ def test_filesystem_size_delete() -> None: projects_path=__path__[0], use_directory=True, delete_file=True, - ).execute(None, context=TestExecutionContext(PROJECT_ID)) + ).execute(inputs=[], context=TestExecutionContext(PROJECT_ID)) for n in range(3): assert cmp( - Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n+1}.nt", - Path(__path__[0]) / "test_files" / f"{UUID4}_size_00000000{n+1}.nt", + Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n + 1}.nt", + Path(__path__[0]) / "test_files" / f"{UUID4}_size_00000000{n + 1}.nt", ) if (Path(__path__[0]) / PROJECT_ID / "resources" / TEST_FILENAME).is_file(): @@ -148,24 +148,19 @@ def test_api_size_delete() -> None: size_unit="KB", projects_path=__path__[0], delete_file=True, - ).execute(None, context=TestExecutionContext(PROJECT_ID)) + ).execute(inputs=[], context=TestExecutionContext(PROJECT_ID)) for n in range(3): - f = get_resource(project_name=PROJECT_ID, resource_name=f"{UUID4}_00000000{n+1}.nt") + f = get_resource(project_name=PROJECT_ID, resource_name=f"{UUID4}_00000000{n + 1}.nt") assert ( f - == (Path(__path__[0]) / "test_files" / f"{UUID4}_size_00000000{n+1}.nt") + == (Path(__path__[0]) / "test_files" / f"{UUID4}_size_00000000{n + 1}.nt") .open("rb") .read() ) - try: + with pytest.raises(HTTPError, match="404 Client Error: Not Found for url:"): get_resource(project_name=PROJECT_ID, resource_name=TEST_FILENAME) - except Exception as exc: - if type(exc) is HTTPError and exc.status_code == 404: # noqa: PLR2004 - pass - else: - raise @needs_cmem @@ -178,12 +173,12 @@ def test_filesystem_lines() -> None: size_unit="Lines", projects_path=__path__[0], use_directory=True, - ).execute(None, context=TestExecutionContext(PROJECT_ID)) + ).execute(inputs=[], context=TestExecutionContext(PROJECT_ID)) for n in range(3): assert cmp( - Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n+1}.nt", - Path(__path__[0]) / "test_files" / f"{UUID4}_lines_00000000{n+1}.nt", + Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n + 1}.nt", + Path(__path__[0]) / "test_files" / f"{UUID4}_lines_00000000{n + 1}.nt", ) @@ -198,10 +193,10 @@ def test_filesystem_lines_header() -> None: include_header=True, projects_path=__path__[0], use_directory=True, - ).execute(None, context=TestExecutionContext(PROJECT_ID)) + ).execute(inputs=[], context=TestExecutionContext(PROJECT_ID)) for n in range(3): assert cmp( - Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n+1}.nt", - Path(__path__[0]) / "test_files" / f"{UUID4}_lines_header_00000000{n+1}.nt", + Path(__path__[0]) / PROJECT_ID / "resources" / f"{UUID4}_00000000{n + 1}.nt", + Path(__path__[0]) / "test_files" / f"{UUID4}_lines_header_00000000{n + 1}.nt", )