Skip to content

A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.

fix(ci): make isort's first-party grouping invocation-independent

dextmorgncf69a7e088db
diff --git a/flowsint-api/app/api/deps.py b/flowsint-api/app/api/deps.py
index 6a5ff5fa..e2340433 100644
--- a/flowsint-api/app/api/deps.py
+++ b/flowsint-api/app/api/deps.py
@@ -1,10 +1,11 @@
from fastapi import Depends, HTTPException, status
from fastapi.security import OAuth2PasswordBearer
+from jose import JWTError, jwt
+from sqlalchemy.orm import Session
+
from flowsint_core.core.auth import ALGORITHM, AUTH_SECRET
from flowsint_core.core.models import Profile
from flowsint_core.core.postgre_db import get_db
-from jose import JWTError, jwt
-from sqlalchemy.orm import Session
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
diff --git a/flowsint-api/app/api/routes/analysis.py b/flowsint-api/app/api/routes/analysis.py
index 58982c8a..4f08a20a 100644
--- a/flowsint-api/app/api/routes/analysis.py
+++ b/flowsint-api/app/api/routes/analysis.py
@@ -2,6 +2,10 @@ from typing import List
from uuid import UUID
from fastapi import APIRouter, Depends, HTTPException, status
+from sqlalchemy.orm import Session
+
+from app.api.deps import get_current_user
+from app.api.schemas.analysis import AnalysisCreate, AnalysisRead, AnalysisUpdate
from flowsint_core.core.models import Profile
from flowsint_core.core.postgre_db import get_db
from flowsint_core.core.services import (
@@ -9,10 +13,6 @@ from flowsint_core.core.services import (
PermissionDeniedError,
create_analysis_service,
)
-from sqlalchemy.orm import Session
-
-from app.api.deps import get_current_user
-from app.api.schemas.analysis import AnalysisCreate, AnalysisRead, AnalysisUpdate
router = APIRouter()
diff --git a/flowsint-api/app/api/routes/auth.py b/flowsint-api/app/api/routes/auth.py
index bee6f3e5..6e58c0fa 100644
--- a/flowsint-api/app/api/routes/auth.py
+++ b/flowsint-api/app/api/routes/auth.py
@@ -2,6 +2,11 @@ from typing import List
from fastapi import APIRouter, Depends, HTTPException, Query
from fastapi.security import OAuth2PasswordRequestForm
+from sqlalchemy.exc import SQLAlchemyError
+from sqlalchemy.orm import Session
+
+from app.api.deps import get_current_user
+from app.api.schemas.profile import ProfileCreate, ProfileRead, ProfileUpdate
from flowsint_core.core.models import Profile
from flowsint_core.core.postgre_db import get_db
from flowsint_core.core.services import (
@@ -10,11 +15,6 @@ from flowsint_core.core.services import (
DatabaseError,
create_auth_service,
)
-from sqlalchemy.exc import SQLAlchemyError
-from sqlalchemy.orm import Session
-
-from app.api.deps import get_current_user
-from app.api.schemas.profile import ProfileCreate, ProfileRead, ProfileUpdate
router = APIRouter()
diff --git a/flowsint-api/app/api/routes/chat.py b/flowsint-api/app/api/routes/chat.py
index 3f623e1d..ccf8d655 100644
--- a/flowsint-api/app/api/routes/chat.py
+++ b/flowsint-api/app/api/routes/chat.py
@@ -3,17 +3,17 @@ from uuid import UUID
from fastapi import APIRouter, Depends, HTTPException, status
from fastapi.responses import StreamingResponse
+from pydantic import BaseModel
+from sqlalchemy.orm import Session
+
+from app.api.deps import get_current_user
+from app.api.schemas.chat import ChatCreate, ChatRead
from flowsint_core.core.models import Profile
from flowsint_core.core.postgre_db import get_db
from flowsint_core.core.services import (
NotFoundError,
create_chat_service,
)
-from pydantic import BaseModel
-from sqlalchemy.orm import Session
-
-from app.api.deps import get_current_user
-from app.api.schemas.chat import ChatCreate, ChatRead
router = APIRouter()
diff --git a/flowsint-api/app/api/routes/custom_types.py b/flowsint-api/app/api/routes/custom_types.py
index 15040ca9..8b2bfc59 100644
--- a/flowsint-api/app/api/routes/custom_types.py
+++ b/flowsint-api/app/api/routes/custom_types.py
@@ -4,14 +4,6 @@ from typing import List
from uuid import UUID
from fastapi import APIRouter, Depends, HTTPException, status
-from flowsint_core.core.models import Profile
-from flowsint_core.core.postgre_db import get_db
-from flowsint_core.core.services import (
- ConflictError,
- NotFoundError,
- ValidationError,
- create_custom_type_service,
-)
from sqlalchemy.orm import Session
from app.api.deps import get_current_user
@@ -27,6 +19,14 @@ from app.utils.custom_types import (
validate_json_schema,
validate_payload_against_schema,
)
+from flowsint_core.core.models import Profile
+from flowsint_core.core.postgre_db import get_db
+from flowsint_core.core.services import (
+ ConflictError,
+ NotFoundError,
+ ValidationError,
+ create_custom_type_service,
+)
router = APIRouter()
diff --git a/flowsint-api/app/api/routes/enricher_templates.py b/flowsint-api/app/api/routes/enricher_templates.py
index 142be263..2830b467 100644
--- a/flowsint-api/app/api/routes/enricher_templates.py
+++ b/flowsint-api/app/api/routes/enricher_templates.py
@@ -4,6 +4,19 @@ from typing import List
from uuid import UUID
from fastapi import APIRouter, Depends, HTTPException, Query, status
+from sqlalchemy.orm import Session
+
+from app.api.deps import get_current_user
+from app.api.schemas.enricher_template import (
+ EnricherTemplateCreate,
+ EnricherTemplateGenerateRequest,
+ EnricherTemplateGenerateResponse,
+ EnricherTemplateList,
+ EnricherTemplateRead,
+ EnricherTemplateTestRequest,
+ EnricherTemplateTestResponse,
+ EnricherTemplateUpdate,
+)
from flowsint_core.core.models import Profile
from flowsint_core.core.postgre_db import get_db
from flowsint_core.core.services import (
@@ -18,19 +31,6 @@ from flowsint_core.core.vault import Vault
from flowsint_core.templates.types import Template
from flowsint_types.registry import get_type as get_type_from_registry
from flowsint_types.registry import load_all_types
-from sqlalchemy.orm import Session
-
-from app.api.deps import get_current_user
-from app.api.schemas.enricher_template import (
- EnricherTemplateCreate,
- EnricherTemplateGenerateRequest,
- EnricherTemplateGenerateResponse,
- EnricherTemplateList,
- EnricherTemplateRead,
- EnricherTemplateTestRequest,
- EnricherTemplateTestResponse,
- EnricherTemplateUpdate,
-)
router = APIRouter()
diff --git a/flowsint-api/app/api/routes/enrichers.py b/flowsint-api/app/api/routes/enrichers.py
index b2c96053..e4692761 100644
--- a/flowsint-api/app/api/routes/enrichers.py
+++ b/flowsint-api/app/api/routes/enrichers.py
@@ -1,6 +1,10 @@
from typing import List, Optional
from fastapi import APIRouter, Depends, HTTPException, Query
+from pydantic import BaseModel
+from sqlalchemy.orm import Session
+
+from app.api.deps import get_current_user
from flowsint_core.core.celery import celery
from flowsint_core.core.graph import create_graph_service
from flowsint_core.core.models import Profile
@@ -13,10 +17,6 @@ from flowsint_core.core.services.type_registry_service import (
create_type_registry_service,
)
from flowsint_enrichers import ENRICHER_REGISTRY, load_all_enrichers
-from pydantic import BaseModel
-from sqlalchemy.orm import Session
-
-from app.api.deps import get_current_user
load_all_enrichers()
diff --git a/flowsint-api/app/api/routes/events.py b/flowsint-api/app/api/routes/events.py
index 5cc367e7..61a7d1c0 100644
--- a/flowsint-api/app/api/routes/events.py
+++ b/flowsint-api/app/api/routes/events.py
@@ -3,6 +3,10 @@ import json
from datetime import datetime
from fastapi import APIRouter, Depends, HTTPException, Request
+from sqlalchemy.orm import Session
+from sse_starlette.sse import EventSourceResponse
+
+from app.api.deps import get_current_user
from flowsint_core.core.events import event_emitter
from flowsint_core.core.models import Profile
from flowsint_core.core.postgre_db import get_db
@@ -12,10 +16,6 @@ from flowsint_core.core.services import (
PermissionDeniedError,
create_log_service,
)
-from sqlalchemy.orm import Session
-from sse_starlette.sse import EventSourceResponse
-
-from app.api.deps import get_current_user
router = APIRouter()
diff --git a/flowsint-api/app/api/routes/flows.py b/flowsint-api/app/api/routes/flows.py
index c80a7f88..4f9b1bd7 100644
--- a/flowsint-api/app/api/routes/flows.py
+++ b/flowsint-api/app/api/routes/flows.py
@@ -2,6 +2,11 @@ from typing import Any, Dict, List, Optional
from uuid import UUID
from fastapi import APIRouter, Depends, HTTPException, Query, status
+from pydantic import BaseModel
+from sqlalchemy.orm import Session
+
+from app.api.deps import get_current_user
+from app.api.schemas.flow import FlowCreate, FlowRead, FlowUpdate
from flowsint_core.core.celery import celery
from flowsint_core.core.graph import create_graph_service
from flowsint_core.core.models import Profile
@@ -36,11 +41,6 @@ from flowsint_types import (
Username,
Website,
)
-from pydantic import BaseModel
-from sqlalchemy.orm import Session
-
-from app.api.deps import get_current_user
-from app.api.schemas.flow import FlowCreate, FlowRead, FlowUpdate
load_all_enrichers()
diff --git a/flowsint-api/app/api/routes/investigations.py b/flowsint-api/app/api/routes/investigations.py
index 7e10ed0d..6e0078dc 100644
--- a/flowsint-api/app/api/routes/investigations.py
+++ b/flowsint-api/app/api/routes/investigations.py
@@ -2,16 +2,6 @@ from typing import List
from uuid import UUID
from fastapi import APIRouter, Depends, HTTPException, status
-from flowsint_core.core.models import Profile
-from flowsint_core.core.postgre_db import get_db
-from flowsint_core.core.services import (
- ConflictError,
- DatabaseError,
- NotFoundError,
- PermissionDeniedError,
- create_investigation_service,
-)
-from flowsint_core.core.types import Role
from sqlalchemy.orm import Session
from app.api.deps import get_current_user
@@ -24,6 +14,16 @@ from app.api.schemas.investigation import (
InvestigationUpdate,
)
from app.api.schemas.sketch import SketchRead
+from flowsint_core.core.models import Profile
+from flowsint_core.core.postgre_db import get_db
+from flowsint_core.core.services import (
+ ConflictError,
+ DatabaseError,
+ NotFoundError,
+ PermissionDeniedError,
+ create_investigation_service,
+)
+from flowsint_core.core.types import Role
router = APIRouter()
diff --git a/flowsint-api/app/api/routes/keys.py b/flowsint-api/app/api/routes/keys.py
index 6c09085c..c696f112 100644
--- a/flowsint-api/app/api/routes/keys.py
+++ b/flowsint-api/app/api/routes/keys.py
@@ -2,6 +2,10 @@ from typing import List
from uuid import UUID
from fastapi import APIRouter, Depends, HTTPException, status
+from sqlalchemy.orm import Session
+
+from app.api.deps import get_current_user
+from app.api.schemas.key import KeyCreate, KeyExists, KeyRead
from flowsint_core.core.models import Profile
from flowsint_core.core.postgre_db import get_db
from flowsint_core.core.services import (
@@ -9,10 +13,6 @@ from flowsint_core.core.services import (
NotFoundError,
create_key_service,
)
-from sqlalchemy.orm import Session
-
-from app.api.deps import get_current_user
-from app.api.schemas.key import KeyCreate, KeyExists, KeyRead
router = APIRouter()
diff --git a/flowsint-api/app/api/routes/scan.py b/flowsint-api/app/api/routes/scan.py
index 7323290a..9cd02d3d 100644
--- a/flowsint-api/app/api/routes/scan.py
+++ b/flowsint-api/app/api/routes/scan.py
@@ -2,6 +2,10 @@ from typing import List
from uuid import UUID
from fastapi import APIRouter, Depends, HTTPException, status
+from sqlalchemy.orm import Session
+
+from app.api.deps import get_current_user
+from app.api.schemas.scan import ScanRead
from flowsint_core.core.models import Profile
from flowsint_core.core.postgre_db import get_db
from flowsint_core.core.services import (
@@ -9,10 +13,6 @@ from flowsint_core.core.services import (
PermissionDeniedError,
create_scan_service,
)
-from sqlalchemy.orm import Session
-
-from app.api.deps import get_current_user
-from app.api.schemas.scan import ScanRead
router = APIRouter()
diff --git a/flowsint-api/app/api/routes/sketches.py b/flowsint-api/app/api/routes/sketches.py
index 0762e836..396b69f0 100644
--- a/flowsint-api/app/api/routes/sketches.py
+++ b/flowsint-api/app/api/routes/sketches.py
@@ -11,6 +11,12 @@ from fastapi import (
UploadFile,
status,
)
+from pydantic import BaseModel, Field
+from sqlalchemy.orm import Session
+
+from app.api.deps import get_current_user
+from app.api.schemas.sketch import SketchCreate, SketchRead, SketchUpdate
+from app.api.sketch_utils import update_sketch_timestamp
from flowsint_core.core.graph import GraphNode, create_graph_service
from flowsint_core.core.models import Profile
from flowsint_core.core.postgre_db import get_db
@@ -29,12 +35,6 @@ from flowsint_core.imports import (
FileParseResult,
create_import_service,
)
-from pydantic import BaseModel, Field
-from sqlalchemy.orm import Session
-
-from app.api.deps import get_current_user
-from app.api.schemas.sketch import SketchCreate, SketchRead, SketchUpdate
-from app.api.sketch_utils import update_sketch_timestamp
router = APIRouter()
diff --git a/flowsint-api/app/api/routes/types.py b/flowsint-api/app/api/routes/types.py
index c42ae6ca..1da01224 100644
--- a/flowsint-api/app/api/routes/types.py
+++ b/flowsint-api/app/api/routes/types.py
@@ -1,11 +1,11 @@
from fastapi import APIRouter, Depends
-from flowsint_core.core.models import Profile
-from flowsint_core.core.postgre_db import get_db
-from flowsint_core.core.services import create_type_registry_service
from pydantic import BaseModel
from sqlalchemy.orm import Session
from app.api.deps import get_current_user
+from flowsint_core.core.models import Profile
+from flowsint_core.core.postgre_db import get_db
+from flowsint_core.core.services import create_type_registry_service
router = APIRouter()
diff --git a/flowsint-api/app/api/sketch_utils.py b/flowsint-api/app/api/sketch_utils.py
index 781b7f31..69bbe470 100644
--- a/flowsint-api/app/api/sketch_utils.py
+++ b/flowsint-api/app/api/sketch_utils.py
@@ -6,9 +6,10 @@ from typing import Callable
from uuid import UUID
from fastapi import BackgroundTasks
-from flowsint_core.core.models import Investigation, Sketch
from sqlalchemy.orm import Session
+from flowsint_core.core.models import Investigation, Sketch
+
def update_sketch_last_modified(db: Session, sketch_id: str | UUID) -> None:
"""
diff --git a/flowsint-api/app/security/permissions.py b/flowsint-api/app/security/permissions.py
index 16bc0334..9f148872 100644
--- a/flowsint-api/app/security/permissions.py
+++ b/flowsint-api/app/security/permissions.py
@@ -1,6 +1,7 @@
from uuid import UUID
from fastapi import HTTPException
+
from flowsint_core.core.models import InvestigationUserRole
from flowsint_core.core.types import Role
diff --git a/flowsint-api/pyproject.toml b/flowsint-api/pyproject.toml
index 4636aac1..b00bd8e9 100644
--- a/flowsint-api/pyproject.toml
+++ b/flowsint-api/pyproject.toml
@@ -60,6 +60,11 @@ target-version = ['py311']
[tool.isort]
profile = "black"
multi_line_output = 3
+# Explicit, not auto-detected: isort's first-party detection depends on which
+# files it's invoked with, so "flowsint_enrichers" gets grouped differently
+# when sorted alone vs alongside the other packages (as CI/make lint does).
+# Same list must be kept in sync across all 4 packages' pyproject.toml.
+known_first_party = ["flowsint_core", "flowsint_types", "flowsint_enrichers", "flowsint_api"]
[tool.mypy]
python_version = "3.11"
diff --git a/flowsint-api/tests/conftest.py b/flowsint-api/tests/conftest.py
index b5980f7b..7abb68fd 100644
--- a/flowsint-api/tests/conftest.py
+++ b/flowsint-api/tests/conftest.py
@@ -11,12 +11,12 @@ os.environ.setdefault(
import pytest # noqa: E402
from fastapi.testclient import TestClient # noqa: E402
-from flowsint_core.core.models import Base # noqa: E402
-from flowsint_core.core.postgre_db import get_db # noqa: E402
from sqlalchemy import create_engine # noqa: E402
from sqlalchemy.orm import sessionmaker # noqa: E402
from app.main import app # noqa: E402
+from flowsint_core.core.models import Base # noqa: E402
+from flowsint_core.core.postgre_db import get_db # noqa: E402
@pytest.fixture
diff --git a/flowsint-core/pyproject.toml b/flowsint-core/pyproject.toml
index 8d32c5d0..27e0cd59 100644
--- a/flowsint-core/pyproject.toml
+++ b/flowsint-core/pyproject.toml
@@ -59,6 +59,11 @@ target-version = ['py311']
[tool.isort]
profile = "black"
multi_line_output = 3
+# Explicit, not auto-detected: isort's first-party detection depends on which
+# files it's invoked with, so "flowsint_enrichers" gets grouped differently
+# when sorted alone vs alongside the other packages (as CI/make lint does).
+# Same list must be kept in sync across all 4 packages' pyproject.toml.
+known_first_party = ["flowsint_core", "flowsint_types", "flowsint_enrichers", "flowsint_api"]
[tool.mypy]
python_version = "3.11"
diff --git a/flowsint-core/src/flowsint_core/core/graph/serializer.py b/flowsint-core/src/flowsint_core/core/graph/serializer.py
index 8070f46a..10e1fe28 100644
--- a/flowsint-core/src/flowsint_core/core/graph/serializer.py
+++ b/flowsint-core/src/flowsint_core/core/graph/serializer.py
@@ -7,9 +7,10 @@ into Neo4j-compatible primitive types, following the Single Responsibility Princ
from typing import Any, Callable, Dict, List, Optional, Type
+from pydantic import BaseModel, ValidationError
+
from flowsint_core.utils import flatten, unflatten
from flowsint_types import FlowsintType
-from pydantic import BaseModel, ValidationError
from .types import GraphEdge, GraphNode, NodeMetadata
diff --git a/flowsint-core/src/flowsint_core/core/graph/service.py b/flowsint-core/src/flowsint_core/core/graph/service.py
index 1054b403..450cf52a 100644
--- a/flowsint-core/src/flowsint_core/core/graph/service.py
+++ b/flowsint-core/src/flowsint_core/core/graph/service.py
@@ -7,9 +7,10 @@ integrating repository and logging functionality.
from typing import Any, Dict, List, Optional, Protocol
-from flowsint_types import FlowsintType
from pydantic import BaseModel
+from flowsint_types import FlowsintType
+
from .repository import Neo4jGraphRepository
from .repository_protocol import GraphRepositoryProtocol
from .serializer import GraphSerializer, TypeResolver
diff --git a/flowsint-core/src/flowsint_core/core/models.py b/flowsint-core/src/flowsint_core/core/models.py
index 86ec51d5..c3689b01 100644
--- a/flowsint-core/src/flowsint_core/core/models.py
+++ b/flowsint-core/src/flowsint_core/core/models.py
@@ -2,8 +2,6 @@ import json
import uuid
from datetime import datetime, timezone
-from flowsint_core.core.enums import EventLevel
-from flowsint_core.core.types import Role
from sqlalchemy import (
JSON,
Boolean,
@@ -25,6 +23,9 @@ from sqlalchemy import (
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship
from sqlalchemy.types import TypeDecorator
+from flowsint_core.core.enums import EventLevel
+from flowsint_core.core.types import Role
+
class RoleListType(TypeDecorator):
"""Stores a list of Role enums as a JSON string. Portable across dialects."""
diff --git a/flowsint-core/src/flowsint_core/core/orchestrator.py b/flowsint-core/src/flowsint_core/core/orchestrator.py
index d3c171e9..b0600a60 100644
--- a/flowsint-core/src/flowsint_core/core/orchestrator.py
+++ b/flowsint-core/src/flowsint_core/core/orchestrator.py
@@ -5,9 +5,10 @@ import time
from datetime import datetime
from typing import Any, Dict, List
-from flowsint_enrichers import ENRICHER_REGISTRY
from pydantic import ValidationError
+from flowsint_enrichers import ENRICHER_REGISTRY
+
from ..utils import to_json_serializable
from .enricher_base import Enricher
from .logger import Logger
diff --git a/flowsint-core/src/flowsint_core/core/services/template_generator_service.py b/flowsint-core/src/flowsint_core/core/services/template_generator_service.py
index cbac1c85..75be7a88 100644
--- a/flowsint-core/src/flowsint_core/core/services/template_generator_service.py
+++ b/flowsint-core/src/flowsint_core/core/services/template_generator_service.py
@@ -11,9 +11,10 @@ from typing import Any, Dict, Optional
from uuid import UUID
import yaml
-from flowsint_core.templates.types import Template
from sqlalchemy.orm import Session
+from flowsint_core.templates.types import Template
+
from ..llm import ChatMessage, MessageRole, create_llm_provider
from .base import BaseService
from .exceptions import ValidationError
diff --git a/flowsint-core/src/flowsint_core/core/services/type_registry_service.py b/flowsint-core/src/flowsint_core/core/services/type_registry_service.py
index a64b32a9..46912407 100644
--- a/flowsint-core/src/flowsint_core/core/services/type_registry_service.py
+++ b/flowsint-core/src/flowsint_core/core/services/type_registry_service.py
@@ -5,10 +5,11 @@ Type registry service for managing flowsint types.
from typing import Any, Dict, List, Optional, Type
from uuid import UUID, uuid4
-from flowsint_types import FlowsintType
from pydantic import BaseModel, TypeAdapter, create_model
from sqlalchemy.orm import Session
+from flowsint_types import FlowsintType
+
from ..graph.serializer import TypeResolver
from ..repositories import CustomTypeRepository
from .base import BaseService
diff --git a/flowsint-core/src/flowsint_core/core/template_enricher.py b/flowsint-core/src/flowsint_core/core/template_enricher.py
index 0f9207e0..10b7e514 100644
--- a/flowsint-core/src/flowsint_core/core/template_enricher.py
+++ b/flowsint-core/src/flowsint_core/core/template_enricher.py
@@ -48,6 +48,7 @@ import xml.etree.ElementTree as ET
from typing import Any, Dict, List, Optional
import httpx
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_core.templates.loader.yaml_loader import (
diff --git a/flowsint-core/src/flowsint_core/imports/import_service.py b/flowsint-core/src/flowsint_core/imports/import_service.py
index a52c3ad9..0b597e5d 100644
--- a/flowsint-core/src/flowsint_core/imports/import_service.py
+++ b/flowsint-core/src/flowsint_core/imports/import_service.py
@@ -8,10 +8,9 @@ handling file parsing, entity conversion, and batch creation.
from dataclasses import dataclass
from typing import Any, Dict, List, Optional
-from flowsint_types import FlowsintType
-
from flowsint_core.core.graph import GraphSerializer, GraphService
from flowsint_core.core.graph.serializer import TypeResolver
+from flowsint_types import FlowsintType
@dataclass
diff --git a/flowsint-core/src/flowsint_core/tasks/enricher.py b/flowsint-core/src/flowsint_core/tasks/enricher.py
index 4e9d79e9..512c6dd8 100644
--- a/flowsint-core/src/flowsint_core/tasks/enricher.py
+++ b/flowsint-core/src/flowsint_core/tasks/enricher.py
@@ -3,9 +3,10 @@ import uuid
from typing import List, Optional
from celery import states
+from sqlalchemy.orm import Session
+
from flowsint_core.utils import to_json_serializable
from flowsint_enrichers import ENRICHER_REGISTRY, load_all_enrichers
-from sqlalchemy.orm import Session
from ..core.celery import celery
from ..core.enums import EventLevel
diff --git a/flowsint-core/src/flowsint_core/templates/loader/yaml_loader.py b/flowsint-core/src/flowsint_core/templates/loader/yaml_loader.py
index d206fa22..bfd47404 100644
--- a/flowsint-core/src/flowsint_core/templates/loader/yaml_loader.py
+++ b/flowsint-core/src/flowsint_core/templates/loader/yaml_loader.py
@@ -4,6 +4,7 @@ from typing import Any, Optional, Set
from urllib.parse import urlparse
import yaml
+
from flowsint_core.core.graph.serializer import TypeResolver
from flowsint_core.templates.types import Template
diff --git a/flowsint-core/tests/conftest.py b/flowsint-core/tests/conftest.py
index 66cb555e..f3a24847 100644
--- a/flowsint-core/tests/conftest.py
+++ b/flowsint-core/tests/conftest.py
@@ -3,10 +3,11 @@
from unittest.mock import MagicMock
import pytest
-from flowsint_core.core.models import Base
from sqlalchemy import create_engine, event
from sqlalchemy.orm import sessionmaker
+from flowsint_core.core.models import Base
+
@pytest.fixture(autouse=True)
def setup_test_environment(monkeypatch):
diff --git a/flowsint-core/tests/core/graph/test_graph_repository.py b/flowsint-core/tests/core/graph/test_graph_repository.py
index 04516946..c6726d06 100644
--- a/flowsint-core/tests/core/graph/test_graph_repository.py
+++ b/flowsint-core/tests/core/graph/test_graph_repository.py
@@ -3,6 +3,7 @@
from unittest.mock import MagicMock, patch
import pytest
+
from flowsint_core.core.graph import Neo4jGraphRepository
diff --git a/flowsint-core/tests/core/graph/test_graph_serializer.py b/flowsint-core/tests/core/graph/test_graph_serializer.py
index 4fee12a6..292f3500 100644
--- a/flowsint-core/tests/core/graph/test_graph_serializer.py
+++ b/flowsint-core/tests/core/graph/test_graph_serializer.py
@@ -1,7 +1,6 @@
from datetime import datetime
import pytest
-from flowsint_types import Domain, Ip
from flowsint_core.core.graph import (
GraphEdge,
@@ -9,6 +8,7 @@ from flowsint_core.core.graph import (
GraphSerializer,
NodeMetadata,
)
+from flowsint_types import Domain, Ip
def test_serializer():
diff --git a/flowsint-core/tests/core/graph/test_graph_service.py b/flowsint-core/tests/core/graph/test_graph_service.py
index cbff32e7..82081034 100644
--- a/flowsint-core/tests/core/graph/test_graph_service.py
+++ b/flowsint-core/tests/core/graph/test_graph_service.py
@@ -3,6 +3,7 @@
from unittest.mock import MagicMock, patch
import pytest
+
from flowsint_core.core.graph import (
GraphData,
GraphNode,
diff --git a/flowsint-core/tests/core/test_logger_singleton.py b/flowsint-core/tests/core/test_logger_singleton.py
index 96119481..c22481d6 100644
--- a/flowsint-core/tests/core/test_logger_singleton.py
+++ b/flowsint-core/tests/core/test_logger_singleton.py
@@ -16,6 +16,7 @@ from unittest.mock import Mock, patch
from uuid import uuid4
import pytest
+
from flowsint_core.core.enums import EventLevel
from flowsint_core.core.logger import LoggerSingleton
diff --git a/flowsint-core/tests/factories.py b/flowsint-core/tests/factories.py
index d6b5e076..e14df0f5 100644
--- a/flowsint-core/tests/factories.py
+++ b/flowsint-core/tests/factories.py
@@ -5,6 +5,7 @@ from uuid import uuid4
import factory
from factory.alchemy import SQLAlchemyModelFactory
+
from flowsint_core.core.enums import EventLevel
from flowsint_core.core.models import (
Analysis,
diff --git a/flowsint-core/tests/import/txt/test_txt_import.py b/flowsint-core/tests/import/txt/test_txt_import.py
index 140a1c8c..399cbb43 100644
--- a/flowsint-core/tests/import/txt/test_txt_import.py
+++ b/flowsint-core/tests/import/txt/test_txt_import.py
@@ -4,6 +4,7 @@ Tests automatic entity detection and parsing of plain text files.
"""
import pytest
+
from flowsint_core.imports import parse_import_file
from flowsint_core.imports.txt.parse_txt import parse_txt
from flowsint_types import Domain, Email, Ip
diff --git a/flowsint-core/tests/repositories/test_analysis_repository.py b/flowsint-core/tests/repositories/test_analysis_repository.py
index 18d7880d..ddd7230c 100644
--- a/flowsint-core/tests/repositories/test_analysis_repository.py
+++ b/flowsint-core/tests/repositories/test_analysis_repository.py
@@ -2,7 +2,6 @@
from flowsint_core.core.repositories import AnalysisRepository
from flowsint_core.core.types import Role
-
from tests.factories import (
AnalysisFactory,
InvestigationFactory,
diff --git a/flowsint-core/tests/repositories/test_chat_repository.py b/flowsint-core/tests/repositories/test_chat_repository.py
index 4d06f628..caf96883 100644
--- a/flowsint-core/tests/repositories/test_chat_repository.py
+++ b/flowsint-core/tests/repositories/test_chat_repository.py
@@ -5,7 +5,6 @@ from uuid import uuid4
from flowsint_core.core.models import ChatMessage
from flowsint_core.core.repositories import ChatRepository
-
from tests.factories import (
ChatFactory,
ChatMessageFactory,
diff --git a/flowsint-core/tests/repositories/test_custom_type_repository.py b/flowsint-core/tests/repositories/test_custom_type_repository.py
index c3780cab..e0e1030d 100644
--- a/flowsint-core/tests/repositories/test_custom_type_repository.py
+++ b/flowsint-core/tests/repositories/test_custom_type_repository.py
@@ -1,7 +1,6 @@
"""Tests for CustomTypeRepository."""
from flowsint_core.core.repositories import CustomTypeRepository
-
from tests.factories import CustomTypeFactory, ProfileFactory
diff --git a/flowsint-core/tests/repositories/test_flow_repository.py b/flowsint-core/tests/repositories/test_flow_repository.py
index af5a7064..f765af4d 100644
--- a/flowsint-core/tests/repositories/test_flow_repository.py
+++ b/flowsint-core/tests/repositories/test_flow_repository.py
@@ -1,7 +1,6 @@
"""Tests for FlowRepository."""
from flowsint_core.core.repositories import FlowRepository
-
from tests.factories import FlowFactory
diff --git a/flowsint-core/tests/repositories/test_investigation_repository.py b/flowsint-core/tests/repositories/test_investigation_repository.py
index cf274e45..8980474f 100644
--- a/flowsint-core/tests/repositories/test_investigation_repository.py
+++ b/flowsint-core/tests/repositories/test_investigation_repository.py
@@ -5,7 +5,6 @@ from uuid import uuid4
from flowsint_core.core.models import InvestigationUserRole
from flowsint_core.core.repositories import InvestigationRepository
from flowsint_core.core.types import Role
-
from tests.factories import (
InvestigationFactory,
InvestigationUserRoleFactory,
diff --git a/flowsint-core/tests/repositories/test_key_repository.py b/flowsint-core/tests/repositories/test_key_repository.py
index be534dab..4c569d70 100644
--- a/flowsint-core/tests/repositories/test_key_repository.py
+++ b/flowsint-core/tests/repositories/test_key_repository.py
@@ -1,7 +1,6 @@
"""Tests for KeyRepository."""
from flowsint_core.core.repositories import KeyRepository
-
from tests.factories import KeyFactory, ProfileFactory
diff --git a/flowsint-core/tests/repositories/test_log_repository.py b/flowsint-core/tests/repositories/test_log_repository.py
index b3877521..1ccb7f76 100644
--- a/flowsint-core/tests/repositories/test_log_repository.py
+++ b/flowsint-core/tests/repositories/test_log_repository.py
@@ -4,7 +4,6 @@ from datetime import datetime
from uuid import uuid4
from flowsint_core.core.repositories import LogRepository
-
from tests.factories import (
InvestigationFactory,
LogFactory,
diff --git a/flowsint-core/tests/repositories/test_profile_repository.py b/flowsint-core/tests/repositories/test_profile_repository.py
index 75f1dc68..e4b9a574 100644
--- a/flowsint-core/tests/repositories/test_profile_repository.py
+++ b/flowsint-core/tests/repositories/test_profile_repository.py
@@ -3,7 +3,6 @@
from uuid import uuid4
from flowsint_core.core.repositories import ProfileRepository
-
from tests.factories import ProfileFactory
diff --git a/flowsint-core/tests/repositories/test_scan_repository.py b/flowsint-core/tests/repositories/test_scan_repository.py
index 0d0f865d..2e429988 100644
--- a/flowsint-core/tests/repositories/test_scan_repository.py
+++ b/flowsint-core/tests/repositories/test_scan_repository.py
@@ -2,7 +2,6 @@
from flowsint_core.core.repositories import ScanRepository
from flowsint_core.core.types import Role
-
from tests.factories import (
InvestigationFactory,
InvestigationUserRoleFactory,
diff --git a/flowsint-core/tests/repositories/test_sketch_repository.py b/flowsint-core/tests/repositories/test_sketch_repository.py
index bb31af7a..afb0a11f 100644
--- a/flowsint-core/tests/repositories/test_sketch_repository.py
+++ b/flowsint-core/tests/repositories/test_sketch_repository.py
@@ -1,7 +1,6 @@
"""Tests for SketchRepository."""
from flowsint_core.core.repositories import SketchRepository
-
from tests.factories import InvestigationFactory, ProfileFactory, SketchFactory
diff --git a/flowsint-core/tests/services/test_enricher_template_service.py b/flowsint-core/tests/services/test_enricher_template_service.py
index e7cf2060..d213c6db 100644
--- a/flowsint-core/tests/services/test_enricher_template_service.py
+++ b/flowsint-core/tests/services/test_enricher_template_service.py
@@ -1,12 +1,12 @@
"""Tests for EnricherTemplateService."""
import pytest
+
from flowsint_core.core.repositories import EnricherTemplateRepository
from flowsint_core.core.services.enricher_template_service import (
EnricherTemplateService,
)
from flowsint_core.core.services.exceptions import ConflictError, NotFoundError
-
from tests.factories import EnricherTemplateFactory, ProfileFactory
diff --git a/flowsint-core/tests/services/test_template_generator_service.py b/flowsint-core/tests/services/test_template_generator_service.py
index e0b7fad0..33d02411 100644
--- a/flowsint-core/tests/services/test_template_generator_service.py
+++ b/flowsint-core/tests/services/test_template_generator_service.py
@@ -4,6 +4,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
from uuid import uuid4
import pytest
+
from flowsint_core.core.services.exceptions import ValidationError
from flowsint_core.core.services.template_generator_service import (
TemplateGeneratorService,
diff --git a/flowsint-core/tests/templates/test_loader.py b/flowsint-core/tests/templates/test_loader.py
index 1b928942..87ce339c 100644
--- a/flowsint-core/tests/templates/test_loader.py
+++ b/flowsint-core/tests/templates/test_loader.py
@@ -3,6 +3,7 @@
from pathlib import Path
import pytest
+
from flowsint_core.templates.loader.yaml_loader import (
SSRFError,
TemplateRenderError,
diff --git a/flowsint-core/tests/templates/test_template_enricher.py b/flowsint-core/tests/templates/test_template_enricher.py
index 69bd6159..e7da0c7c 100644
--- a/flowsint-core/tests/templates/test_template_enricher.py
+++ b/flowsint-core/tests/templates/test_template_enricher.py
@@ -5,6 +5,7 @@ from typing import Optional
import httpx
import pytest
+
from flowsint_core.core.template_enricher import (
TemplateEnricher,
)
diff --git a/flowsint-core/tests/vault/test_enricher_vault_integration.py b/flowsint-core/tests/vault/test_enricher_vault_integration.py
index 7099039e..69771817 100644
--- a/flowsint-core/tests/vault/test_enricher_vault_integration.py
+++ b/flowsint-core/tests/vault/test_enricher_vault_integration.py
@@ -5,6 +5,7 @@ from typing import Any, Dict, List
from unittest.mock import Mock
import pytest
+
from flowsint_core.core.enricher_base import Enricher
diff --git a/flowsint-core/tests/vault/test_vault.py b/flowsint-core/tests/vault/test_vault.py
index 4c3c3ff4..3c099fc6 100644
--- a/flowsint-core/tests/vault/test_vault.py
+++ b/flowsint-core/tests/vault/test_vault.py
@@ -4,6 +4,7 @@ import uuid
from unittest.mock import MagicMock, Mock
import pytest
+
from flowsint_core.core.models import Key
from flowsint_core.core.vault import Vault
diff --git a/flowsint-enrichers/pyproject.toml b/flowsint-enrichers/pyproject.toml
index 5aedfc04..a56ae7b2 100644
--- a/flowsint-enrichers/pyproject.toml
+++ b/flowsint-enrichers/pyproject.toml
@@ -58,6 +58,11 @@ target-version = ['py311']
[tool.isort]
profile = "black"
multi_line_output = 3
+# Explicit, not auto-detected: isort's first-party detection depends on which
+# files it's invoked with, so "flowsint_enrichers" gets grouped differently
+# when sorted alone vs alongside the other packages (as CI/make lint does).
+# Same list must be kept in sync across all 4 packages' pyproject.toml.
+known_first_party = ["flowsint_core", "flowsint_types", "flowsint_enrichers", "flowsint_api"]
[tool.mypy]
python_version = "3.11"
diff --git a/flowsint-enrichers/src/flowsint_enrichers/asn/to_cidrs.py b/flowsint-enrichers/src/flowsint_enrichers/asn/to_cidrs.py
index 0d922f32..960f27c3 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/asn/to_cidrs.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/asn/to_cidrs.py
@@ -1,12 +1,13 @@
import os
from typing import Any, Dict, List, Optional
+from tools.network.asnmap import AsnmapTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.asn import ASN
from flowsint_types.cidr import CIDR
-from tools.network.asnmap import AsnmapTool
@flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/cidr/to_ips.py b/flowsint-enrichers/src/flowsint_enrichers/cidr/to_ips.py
index 4a6f1146..296a4d7e 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/cidr/to_ips.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/cidr/to_ips.py
@@ -1,12 +1,13 @@
import os
from typing import Any, Dict, List, Optional
+from tools.network.mapcidr import MapcidrTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.cidr import CIDR
from flowsint_types.ip import Ip
-from tools.network.mapcidr import MapcidrTool
@flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/crypto/to_nfts.py b/flowsint-enrichers/src/flowsint_enrichers/crypto/to_nfts.py
index 9dc24fb8..48f3843a 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/crypto/to_nfts.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/crypto/to_nfts.py
@@ -3,6 +3,7 @@ from typing import Any, Dict, List, Optional
import requests
from dotenv import load_dotenv
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.wallet import CryptoNFT, CryptoWallet
diff --git a/flowsint-enrichers/src/flowsint_enrichers/crypto/to_transactions.py b/flowsint-enrichers/src/flowsint_enrichers/crypto/to_transactions.py
index 7ca276ad..e81800f7 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/crypto/to_transactions.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/crypto/to_transactions.py
@@ -5,6 +5,7 @@ from typing import Any, Dict, List, Optional
import requests
import requests.exceptions
from dotenv import load_dotenv
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_asn.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_asn.py
index 22a4a33f..b17095f0 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_asn.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_asn.py
@@ -1,12 +1,13 @@
import os
from typing import Any, Dict, List, Optional
+from tools.network.asnmap import AsnmapTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.asn import ASN
from flowsint_types.domain import Domain
-from tools.network.asnmap import AsnmapTool
@flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_dehashed.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_dehashed.py
index f4e52d21..194f0f30 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_dehashed.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_dehashed.py
@@ -3,6 +3,7 @@ import os
from typing import Any, Dict, List, Optional
import requests
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_dns.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_dns.py
index e146e3da..1d4e049d 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_dns.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_dns.py
@@ -1,11 +1,12 @@
from typing import Any, Dict, List, Optional
+from tools.network.dnsx import DnsxTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.domain import Domain
from flowsint_types.ip import Ip
-from tools.network.dnsx import DnsxTool
@flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_history.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_history.py
index c482d791..baecec6f 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_history.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_history.py
@@ -4,6 +4,8 @@ import time
from typing import Any, Dict, List, Optional, Set
from dotenv import load_dotenv
+from tools.network.whoxy import WhoxyTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
@@ -13,7 +15,6 @@ from flowsint_types.email import Email
from flowsint_types.individual import Individual
from flowsint_types.organization import Organization
from flowsint_types.phone import Phone
-from tools.network.whoxy import WhoxyTool
load_dotenv()
diff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_ssl.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_ssl.py
index 9980e995..c2824cbe 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_ssl.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_ssl.py
@@ -1,11 +1,12 @@
from typing import List
+from tools.network.httpx import HttpxTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.domain import Domain
from flowsint_types.website import Website
-from tools.network.httpx import HttpxTool
@flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_subdomains.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_subdomains.py
index 249afd34..72eed3f1 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_subdomains.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_subdomains.py
@@ -1,12 +1,13 @@
from typing import List
import requests
+from tools.network.subfinder import SubfinderTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_core.utils import is_valid_domain
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.domain import Domain
-from tools.network.subfinder import SubfinderTool
@flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_website.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_website.py
index edfc3a00..201c298a 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_website.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_website.py
@@ -2,6 +2,7 @@ from typing import Dict, List
import requests
from bs4 import BeautifulSoup
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_whois.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_whois.py
index ece2a057..f56c71b4 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_whois.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_whois.py
@@ -1,6 +1,7 @@
from typing import List
import whois
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_whois_history.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_whois_history.py
index c9bf77b6..836164c2 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_whois_history.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_whois_history.py
@@ -3,6 +3,8 @@ import re
from typing import Any, Dict, List, Optional, Set
from dotenv import load_dotenv
+from tools.network.whoisxml import WhoisXmlTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
@@ -12,7 +14,6 @@ from flowsint_types.email import Email
from flowsint_types.individual import Individual
from flowsint_types.organization import Organization
from flowsint_types.whois import Whois
-from tools.network.whoisxml import WhoisXmlTool
load_dotenv()
diff --git a/flowsint-enrichers/src/flowsint_enrichers/email/to_dehashed.py b/flowsint-enrichers/src/flowsint_enrichers/email/to_dehashed.py
index 0a9ca678..0cb926b3 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/email/to_dehashed.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/email/to_dehashed.py
@@ -3,6 +3,7 @@ import os
from typing import Any, Dict, List, Optional
import requests
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/email/to_domains.py b/flowsint-enrichers/src/flowsint_enrichers/email/to_domains.py
index a67bfc1e..59b59d6f 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/email/to_domains.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/email/to_domains.py
@@ -3,6 +3,8 @@ import re
from typing import Any, Dict, List, Optional, Set
from dotenv import load_dotenv
+from tools.network.whoxy import WhoxyTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
@@ -11,7 +13,6 @@ from flowsint_types.domain import Domain
from flowsint_types.email import Email
from flowsint_types.individual import Individual
from flowsint_types.phone import Phone
-from tools.network.whoxy import WhoxyTool
load_dotenv()
diff --git a/flowsint-enrichers/src/flowsint_enrichers/email/to_gravatar.py b/flowsint-enrichers/src/flowsint_enrichers/email/to_gravatar.py
index 0b75405b..1f130860 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/email/to_gravatar.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/email/to_gravatar.py
@@ -2,6 +2,7 @@ import hashlib
from typing import List
import requests
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/email/to_hudsonrock.py b/flowsint-enrichers/src/flowsint_enrichers/email/to_hudsonrock.py
index d7d74fc7..d6bc9fdf 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/email/to_hudsonrock.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/email/to_hudsonrock.py
@@ -1,6 +1,7 @@
from typing import List
import requests
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/email/to_leaks.py b/flowsint-enrichers/src/flowsint_enrichers/email/to_leaks.py
index 7b5bc510..af074a46 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/email/to_leaks.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/email/to_leaks.py
@@ -4,6 +4,7 @@ from urllib.parse import urljoin
import requests
from dotenv import load_dotenv
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/individual/to_domains.py b/flowsint-enrichers/src/flowsint_enrichers/individual/to_domains.py
index 3e0431c5..920f6058 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/individual/to_domains.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/individual/to_domains.py
@@ -3,11 +3,12 @@ import re
from typing import Any, Dict, List, Optional, Set, Union
from dotenv import load_dotenv
+from tools.network.whoxy import WhoxyTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types import Domain, Email, Individual, Location, Phone
-from tools.network.whoxy import WhoxyTool
load_dotenv()
diff --git a/flowsint-enrichers/src/flowsint_enrichers/individual/to_org.py b/flowsint-enrichers/src/flowsint_enrichers/individual/to_org.py
index 8b667331..b375e1b6 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/individual/to_org.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/individual/to_org.py
@@ -1,11 +1,12 @@
from typing import Dict, List, Set, Union
+from tools.organizations.sirene import SireneTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.individual import Individual
from flowsint_types.organization import Organization
-from tools.organizations.sirene import SireneTool
@flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/ip/to_asn.py b/flowsint-enrichers/src/flowsint_enrichers/ip/to_asn.py
index b6568e10..05a28e0c 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/ip/to_asn.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/ip/to_asn.py
@@ -1,12 +1,13 @@
import os
from typing import Any, Dict, List, Optional
+from tools.network.asnmap import AsnmapTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.asn import ASN
from flowsint_types.ip import Ip
-from tools.network.asnmap import AsnmapTool
@flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/ip/to_dehashed.py b/flowsint-enrichers/src/flowsint_enrichers/ip/to_dehashed.py
index 69175c7e..f90ea441 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/ip/to_dehashed.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/ip/to_dehashed.py
@@ -3,6 +3,7 @@ import os
from typing import Any, Dict, List, Optional
import requests
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/ip/to_domain.py b/flowsint-enrichers/src/flowsint_enrichers/ip/to_domain.py
index 1cb0ee81..53fc526f 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/ip/to_domain.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/ip/to_domain.py
@@ -2,6 +2,7 @@ import socket
from typing import List
import requests
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/ip/to_fraudscore.py b/flowsint-enrichers/src/flowsint_enrichers/ip/to_fraudscore.py
index fa79884d..98c84934 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/ip/to_fraudscore.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/ip/to_fraudscore.py
@@ -3,6 +3,7 @@ import os
from typing import Any, Dict, List, Optional
import requests
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/ip/to_infos.py b/flowsint-enrichers/src/flowsint_enrichers/ip/to_infos.py
index 3f894cf8..0d3332f7 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/ip/to_infos.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/ip/to_infos.py
@@ -1,6 +1,7 @@
from typing import Any, Dict, List
import requests
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.ip import Ip
diff --git a/flowsint-enrichers/src/flowsint_enrichers/ip/to_ports.py b/flowsint-enrichers/src/flowsint_enrichers/ip/to_ports.py
index 2cc5364f..9b7b1264 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/ip/to_ports.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/ip/to_ports.py
@@ -1,11 +1,12 @@
from typing import Any, Dict, List, Optional
+from tools.network.naabu import NaabuTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.ip import Ip
from flowsint_types.port import Port
-from tools.network.naabu import NaabuTool
@flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/n8n/connector.py b/flowsint-enrichers/src/flowsint_enrichers/n8n/connector.py
index 54378f40..3963208d 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/n8n/connector.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/n8n/connector.py
@@ -2,6 +2,7 @@ import json
from typing import Any, Dict, List, Optional
import aiohttp
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/organization/to_asn.py b/flowsint-enrichers/src/flowsint_enrichers/organization/to_asn.py
index 245a1b97..819fafc9 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/organization/to_asn.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/organization/to_asn.py
@@ -1,12 +1,13 @@
import os
from typing import Any, Dict, List, Optional
+from tools.network.asnmap import AsnmapTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.asn import ASN
from flowsint_types.organization import Organization
-from tools.network.asnmap import AsnmapTool
@flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/organization/to_domains.py b/flowsint-enrichers/src/flowsint_enrichers/organization/to_domains.py
index b5b4ccaf..0a5033a1 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/organization/to_domains.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/organization/to_domains.py
@@ -3,6 +3,8 @@ import re
from typing import Any, Dict, List, Optional, Set
from dotenv import load_dotenv
+from tools.network.whoxy import WhoxyTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
@@ -11,7 +13,6 @@ from flowsint_types.address import Location
from flowsint_types.domain import Domain
from flowsint_types.individual import Individual
from flowsint_types.organization import Organization
-from tools.network.whoxy import WhoxyTool
load_dotenv()
diff --git a/flowsint-enrichers/src/flowsint_enrichers/organization/to_infos.py b/flowsint-enrichers/src/flowsint_enrichers/organization/to_infos.py
index ef205b2f..c519d9f6 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/organization/to_infos.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/organization/to_infos.py
@@ -1,12 +1,13 @@
from typing import Dict, List
+from tools.organizations.sirene import SireneTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.address import Location
from flowsint_types.individual import Individual
from flowsint_types.organization import Organization
-from tools.organizations.sirene import SireneTool
@flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/phone/to_carrier.py b/flowsint-enrichers/src/flowsint_enrichers/phone/to_carrier.py
index 4a1f837e..7a44775c 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/phone/to_carrier.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/phone/to_carrier.py
@@ -2,6 +2,7 @@ import os
from typing import Any, Dict, List, Optional
import requests
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/phone/to_hudsonrock.py b/flowsint-enrichers/src/flowsint_enrichers/phone/to_hudsonrock.py
index 2c9e35a3..4dba3c8c 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/phone/to_hudsonrock.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/phone/to_hudsonrock.py
@@ -1,6 +1,7 @@
from typing import List
import requests
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/phone/to_infos.py b/flowsint-enrichers/src/flowsint_enrichers/phone/to_infos.py
index 73b41d04..6c71ea6d 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/phone/to_infos.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/phone/to_infos.py
@@ -2,6 +2,7 @@ import asyncio
from typing import Any, Dict, List
import httpx
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_core.utils import is_valid_number
diff --git a/flowsint-enrichers/src/flowsint_enrichers/social/to_dehashed.py b/flowsint-enrichers/src/flowsint_enrichers/social/to_dehashed.py
index 22860e48..caeb674f 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/social/to_dehashed.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/social/to_dehashed.py
@@ -3,6 +3,7 @@ import os
from typing import Any, Dict, List, Optional
import requests
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/social/to_hudsonrock.py b/flowsint-enrichers/src/flowsint_enrichers/social/to_hudsonrock.py
index 5dea67d0..ad134250 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/social/to_hudsonrock.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/social/to_hudsonrock.py
@@ -1,6 +1,7 @@
from typing import List
import requests
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/website/to_crawler.py b/flowsint-enrichers/src/flowsint_enrichers/website/to_crawler.py
index f8805b4b..f9429c65 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/website/to_crawler.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/website/to_crawler.py
@@ -1,14 +1,15 @@
from typing import List, Optional
from urllib.parse import urlparse
+from pydantic import BaseModel
+from tools.network.reconcrawl import ReconCrawlTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.email import Email
from flowsint_types.phone import Phone
from flowsint_types.website import Website
-from pydantic import BaseModel
-from tools.network.reconcrawl import ReconCrawlTool
class ReturnType(BaseModel):
diff --git a/flowsint-enrichers/src/flowsint_enrichers/website/to_links.py b/flowsint-enrichers/src/flowsint_enrichers/website/to_links.py
index 9f74f310..dd52bdde 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/website/to_links.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/website/to_links.py
@@ -1,12 +1,13 @@
from typing import List
from urllib.parse import urlparse
+from reconspread import Crawler
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.domain import Domain
from flowsint_types.website import Website
-from reconspread import Crawler
@flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/website/to_subdomain.py b/flowsint-enrichers/src/flowsint_enrichers/website/to_subdomain.py
index d88881fd..de2b4d88 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/website/to_subdomain.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/website/to_subdomain.py
@@ -2,6 +2,7 @@ import os
from typing import Any, Dict, List, Optional
import requests
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/website/to_technologies.py b/flowsint-enrichers/src/flowsint_enrichers/website/to_technologies.py
index 1e96c1aa..f2312465 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/website/to_technologies.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/website/to_technologies.py
@@ -1,11 +1,12 @@
from typing import Any, Dict, List, Optional
+from tools.network.httpx import HttpxTool
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.technology import Technology
from flowsint_types.website import Website
-from tools.network.httpx import HttpxTool
@flowsint_enricher
diff --git a/flowsint-enrichers/src/flowsint_enrichers/website/to_text.py b/flowsint-enrichers/src/flowsint_enrichers/website/to_text.py
index 8656cbc1..ec781ecc 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/website/to_text.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/website/to_text.py
@@ -2,6 +2,7 @@ from typing import List
import requests
from bs4 import BeautifulSoup
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.phrase import Phrase
diff --git a/flowsint-enrichers/src/flowsint_enrichers/website/to_webtrackers.py b/flowsint-enrichers/src/flowsint_enrichers/website/to_webtrackers.py
index 671ff1c9..03ada26b 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/website/to_webtrackers.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/website/to_webtrackers.py
@@ -1,12 +1,13 @@
from typing import Any, Dict, List, Optional
+from recontrack import TrackingCodeExtractor
+
from flowsint_core.core.enricher_base import Enricher
from flowsint_core.core.logger import Logger
from flowsint_core.core.vault import VaultProtocol
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.web_tracker import WebTracker
from flowsint_types.website import Website
-from recontrack import TrackingCodeExtractor
@flowsint_enricher
diff --git a/flowsint-enrichers/tests/enrichers/test_domain_to_dns.py b/flowsint-enrichers/tests/enrichers/test_domain_to_dns.py
index a8ce0d79..a210ec2e 100644
--- a/flowsint-enrichers/tests/enrichers/test_domain_to_dns.py
+++ b/flowsint-enrichers/tests/enrichers/test_domain_to_dns.py
@@ -1,8 +1,9 @@
import pytest
+from tools.network.dnsx import DnsxTool
+
from flowsint_enrichers import ENRICHER_REGISTRY
from flowsint_enrichers.domain.to_dns import DomainToDnsEnricher
from flowsint_types.ip import Ip
-from tools.network.dnsx import DnsxTool
# ---------------------------------------------------------------------------
diff --git a/flowsint-enrichers/tests/enrichers/test_registry.py b/flowsint-enrichers/tests/enrichers/test_registry.py
index 23ce366f..6f2222e0 100644
--- a/flowsint-enrichers/tests/enrichers/test_registry.py
+++ b/flowsint-enrichers/tests/enrichers/test_registry.py
@@ -1,4 +1,5 @@
import pytest
+
from flowsint_enrichers import ENRICHER_REGISTRY
diff --git a/flowsint-enrichers/tests/enrichers/test_tech_detect.py b/flowsint-enrichers/tests/enrichers/test_tech_detect.py
index 0fca0d49..6541d671 100644
--- a/flowsint-enrichers/tests/enrichers/test_tech_detect.py
+++ b/flowsint-enrichers/tests/enrichers/test_tech_detect.py
@@ -1,4 +1,5 @@
import pytest
+
from flowsint_enrichers import ENRICHER_REGISTRY
from flowsint_enrichers.website.to_technologies import TechDetectEnricher
from flowsint_types.technology import Technology
diff --git a/flowsint-enrichers/tests/test_vault_integration.py b/flowsint-enrichers/tests/test_vault_integration.py
index 11c3ad65..2335ae88 100644
--- a/flowsint-enrichers/tests/test_vault_integration.py
+++ b/flowsint-enrichers/tests/test_vault_integration.py
@@ -4,6 +4,7 @@ import uuid
from unittest.mock import Mock
import pytest
+
from flowsint_enrichers.crypto.to_nfts import CryptoWalletAddressToNFTs
from flowsint_enrichers.crypto.to_transactions import CryptoWalletAddressToTransactions
from flowsint_enrichers.domain.to_history import DomainToHistoryEnricher
diff --git a/flowsint-types/pyproject.toml b/flowsint-types/pyproject.toml
index 131c4247..e40311bb 100644
--- a/flowsint-types/pyproject.toml
+++ b/flowsint-types/pyproject.toml
@@ -34,6 +34,11 @@ target-version = ['py311']
[tool.isort]
profile = "black"
multi_line_output = 3
+# Explicit, not auto-detected: isort's first-party detection depends on which
+# files it's invoked with, so "flowsint_enrichers" gets grouped differently
+# when sorted alone vs alongside the other packages (as CI/make lint does).
+# Same list must be kept in sync across all 4 packages' pyproject.toml.
+known_first_party = ["flowsint_core", "flowsint_types", "flowsint_enrichers", "flowsint_api"]
[tool.mypy]
python_version = "3.11"
diff --git a/flowsint-types/tests/test_domain.py b/flowsint-types/tests/test_domain.py
index da640eed..ecbaf8de 100644
--- a/flowsint-types/tests/test_domain.py
+++ b/flowsint-types/tests/test_domain.py
@@ -1,4 +1,5 @@
import pytest
+
from flowsint_types.domain import Domain
diff --git a/flowsint-types/tests/test_ip.py b/flowsint-types/tests/test_ip.py
index 50dbc13f..aa6fb6d6 100644
--- a/flowsint-types/tests/test_ip.py
+++ b/flowsint-types/tests/test_ip.py
@@ -1,4 +1,5 @@
import pytest
+
from flowsint_types.ip import Ip
diff --git a/flowsint-types/tests/test_status_code.py b/flowsint-types/tests/test_status_code.py
index 20318627..f1f82fce 100644
--- a/flowsint-types/tests/test_status_code.py
+++ b/flowsint-types/tests/test_status_code.py
@@ -1,4 +1,5 @@
import pytest
+
from flowsint_types.website import Website