Skip to content

Commit

Permalink
Merge branch 'main' into lv/improve_module_generator
Browse files Browse the repository at this point in the history
  • Loading branch information
squioc authored Feb 13, 2025
2 parents 7f87b58 + 298ae64 commit 8933b5e
Show file tree
Hide file tree
Showing 24 changed files with 1,716 additions and 1,408 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## Unreleased

## 1.18.3

### Changed

- Move to Pydantic V2 as dependency

## 1.18.2

### Changed

- Lock boto3 to versions lower than 1.36
- The new integrity algorithm doesn't work with third party object storage implementations

### Fixed

Expand Down
3,053 changes: 1,674 additions & 1,379 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "sekoia-automation-sdk"

version = "1.18.1"
version = "1.18.3"
description = "SDK to create Sekoia.io playbook modules"
license = "MIT"
readme = "README.md"
Expand Down Expand Up @@ -34,10 +34,10 @@ requests = "^2.25"
requests-ratelimiter = "^0.7.0"
sentry-sdk = "*"
tenacity = "*"
boto3 = "^1.28"
boto3 = "<1.36"
s3path = "^0.5"
orjson = "^3.8"
pydantic = "^1.10"
pydantic = "^2.10"
typer = { extras = ["all"], version = "^0.12"}
cookiecutter = "^2.1"
python-slugify = "^5.0.2"
Expand Down
6 changes: 3 additions & 3 deletions sekoia_automation/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import orjson
import requests
import sentry_sdk
from pydantic import validate_arguments
from pydantic.v1 import validate_arguments
from requests import RequestException, Response
from tenacity import (
RetryError,
Expand Down Expand Up @@ -63,7 +63,7 @@ def __init__(self, module: Module | None = None, data_path: Path | None = None):
self._update_secrets = False
logging.getLogger().addHandler(ActionLogHandler(self))

# Make sure arguments are validated/coerced by pydantic
# Make sure arguments are validated/coerced by pydantic.v1
# if a type annotation is defined
self.run = validate_arguments()(self.run) # type: ignore

Expand Down Expand Up @@ -102,7 +102,7 @@ def execute(self) -> None:
self.set_task_as_running()
self._results = self.run(self.arguments)
except Exception:
self.error(f"An unexpected error occured: {format_exc()}")
self.error(f"An unexpected error occurred: {format_exc()}")
sentry_sdk.capture_exception()

self.send_results()
Expand Down
2 changes: 1 addition & 1 deletion sekoia_automation/aio/helpers/aws/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from aiobotocore.session import AioCredentials, AioSession, ClientCreatorContext
from botocore.credentials import CredentialProvider
from pydantic import BaseModel, Field
from pydantic.v1 import BaseModel, Field


class AwsConfiguration(BaseModel):
Expand Down
4 changes: 2 additions & 2 deletions sekoia_automation/aio/helpers/http/token_refresher.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from typing import Generic, TypeVar

from aiohttp import ClientSession
from pydantic import BaseModel
from pydantic.generics import GenericModel
from pydantic.v1 import BaseModel
from pydantic.v1.generics import GenericModel

HttpTokenT = TypeVar("HttpTokenT", bound=BaseModel)

Expand Down
2 changes: 1 addition & 1 deletion sekoia_automation/connector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import orjson
import requests
import sentry_sdk
from pydantic import BaseModel
from pydantic.v1 import BaseModel
from requests import Response
from tenacity import (
Retrying,
Expand Down
4 changes: 2 additions & 2 deletions sekoia_automation/http/aio/token_refresher.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from typing import Generic, TypeVar

from aiohttp import ClientSession
from pydantic import BaseModel
from pydantic.generics import GenericModel
from pydantic.v1 import BaseModel
from pydantic.v1.generics import GenericModel

HttpTokenT = TypeVar("HttpTokenT", bound=BaseModel)

Expand Down
2 changes: 1 addition & 1 deletion sekoia_automation/http/rate_limiter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Optional

from pydantic import BaseModel
from pydantic.v1 import BaseModel


class RateLimiterConfig(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion sekoia_automation/http/retry.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Optional

from pydantic import BaseModel
from pydantic.v1 import BaseModel


class RetryPolicy(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion sekoia_automation/loguru/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys

from loguru import logger
from pydantic import BaseModel, validator
from pydantic.v1 import BaseModel, validator

from .formatters import format_record
from .handlers import InterceptHandler
Expand Down
2 changes: 1 addition & 1 deletion sekoia_automation/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import requests
import sentry_sdk
from botocore.exceptions import ClientError
from pydantic import BaseModel
from pydantic.v1 import BaseModel
from requests import RequestException, Response

from sekoia_automation.config import load_config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ This module accepts no configuration.

{{action.description}}

{%- if action.arguments.properties.description %}
{%- if action.arguments.properties and action.arguments.properties.description %}

**Configuration**

Expand Down
2 changes: 1 addition & 1 deletion sekoia_automation/scripts/files_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from uuid import UUID, uuid5

import typer
from pydantic import BaseModel
from pydantic.v1 import BaseModel
from rich import print

from sekoia_automation.action import Action
Expand Down
2 changes: 1 addition & 1 deletion sekoia_automation/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import requests
import sentry_sdk
from botocore.exceptions import ClientError, ConnectionError, HTTPClientError
from pydantic import BaseModel
from pydantic.v1 import BaseModel
from requests import HTTPError
from tenacity import retry, stop_after_attempt, wait_exponential

Expand Down
2 changes: 1 addition & 1 deletion sekoia_automation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from inspect import get_annotations, getmro

import sentry_sdk
from pydantic import BaseModel
from pydantic.v1 import BaseModel
from tenacity import RetryCallState


Expand Down
2 changes: 1 addition & 1 deletion tests/aio/helpers/http/test_http_client_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import pytest
from aioresponses import aioresponses
from pydantic import BaseModel
from pydantic.v1 import BaseModel

from sekoia_automation.aio.helpers.http.http_client import HttpClient
from sekoia_automation.aio.helpers.http.token_refresher import (
Expand Down
2 changes: 1 addition & 1 deletion tests/aio/helpers/http/test_http_token_refresher.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import pytest
from aioresponses import aioresponses
from pydantic import BaseModel
from pydantic.v1 import BaseModel

from sekoia_automation.aio.helpers.http.token_refresher import (
GenericTokenRefresher,
Expand Down
2 changes: 1 addition & 1 deletion tests/data/sample_module/sample.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pydantic import BaseModel, Field
from pydantic.v1 import BaseModel, Field

from sekoia_automation.action import Action
from sekoia_automation.connector import Connector
Expand Down
2 changes: 1 addition & 1 deletion tests/http/aio/test_http_token_refresher.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import pytest
from aioresponses import aioresponses
from pydantic import BaseModel
from pydantic.v1 import BaseModel

from sekoia_automation.http.aio.token_refresher import (
GenericTokenRefresher,
Expand Down
2 changes: 1 addition & 1 deletion tests/loguru/test_loguru_config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Config tests."""

import pytest
from pydantic import ValidationError
from pydantic.v1 import ValidationError

from sekoia_automation.loguru.config import LoggingConfig

Expand Down
2 changes: 1 addition & 1 deletion tests/test_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pytest
import requests_mock
from pydantic import BaseModel, ValidationError
from pydantic.v1 import BaseModel, ValidationError

# third parties
from requests import Timeout
Expand Down
2 changes: 1 addition & 1 deletion tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# third parties
import pytest
from pydantic import BaseModel
from pydantic.v1 import BaseModel
from sentry_sdk import get_isolation_scope

# internal
Expand Down
2 changes: 1 addition & 1 deletion tests/test_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import requests
import requests_mock
from botocore.exceptions import ClientError, ConnectionError
from pydantic import BaseModel
from pydantic.v1 import BaseModel
from tenacity import wait_none

from sekoia_automation.exceptions import (
Expand Down

0 comments on commit 8933b5e

Please sign in to comment.