From 390338590cd908992e6d7a9ff7a66ba394c275fd Mon Sep 17 00:00:00 2001 From: Matthew Tran <0e4ef622@gmail.com> Date: Wed, 24 Jun 2026 12:26:27 -0500 Subject: [PATCH 1/2] Add priority field to Batch --- ntropy_sdk/batches.py | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/ntropy_sdk/batches.py b/ntropy_sdk/batches.py index 5f0fb46..0e22931 100644 --- a/ntropy_sdk/batches.py +++ b/ntropy_sdk/batches.py @@ -3,12 +3,12 @@ import uuid from datetime import datetime from enum import Enum -from typing import List, Optional, TYPE_CHECKING, Callable +from typing import TYPE_CHECKING, Callable, List, Literal, Optional, Union from pydantic import BaseModel, Field -from ntropy_sdk.paging import PagedResponse from ntropy_sdk.async_.paging import PagedResponse as PagedResponseAsync +from ntropy_sdk.paging import PagedResponse from ntropy_sdk.transactions import ( EnrichedTransaction, ) @@ -16,10 +16,11 @@ from ntropy_sdk.v2 import NtropyBatchError if TYPE_CHECKING: - from ntropy_sdk import ExtraKwargs, ExtraKwargsAsync, NtropyTimeoutError, SDK - from ntropy_sdk.async_.sdk import AsyncSDK from typing_extensions import Unpack + from ntropy_sdk import SDK, ExtraKwargs, ExtraKwargsAsync, NtropyTimeoutError + from ntropy_sdk.async_.sdk import AsyncSDK + class BatchStatus(str, Enum): PROCESSING = "processing" @@ -27,6 +28,14 @@ class BatchStatus(str, Enum): ERROR = "error" +class BatchPriority(str, Enum): + DEFAULT = "default" + LOW = "low" + + +BatchPriorityLiteral = Literal["default", "low"] + + class Batch(BaseModel): """ The `Batch` object represents the status and progress of an asynchronous batch enrichment job. @@ -35,6 +44,7 @@ class Batch(BaseModel): id: str = Field(description="A unique identifier for the batch.") operation: str = Field(description="Operation for the batch") status: BatchStatus = Field(description="The current status of the batch.") + priority: BatchPriority = Field(description="The priority of the batch.") created_at: datetime = Field( description="The timestamp of when the batch was created." ) @@ -132,6 +142,8 @@ def create( self, operation: str, data: List[dict], + *, + priority: Union[BatchPriority, BatchPriorityLiteral] = BatchPriority.DEFAULT, **extra_kwargs: "Unpack[ExtraKwargs]", ) -> Batch: """Submit a batch of transactions for enrichment""" @@ -140,11 +152,15 @@ def create( if request_id is None: request_id = uuid.uuid4().hex extra_kwargs["request_id"] = request_id + + if isinstance(priority, str): + priority = BatchPriority(priority) resp = self._sdk.retry_ratelimited_request( method="POST", url="/v3/batches", payload={ "operation": operation, + "priority": priority.value, "data": data, }, **extra_kwargs, @@ -321,6 +337,8 @@ async def create( self, operation: str, data: List[dict], + *, + priority: Union[BatchPriority, BatchPriorityLiteral] = BatchPriority.DEFAULT, **extra_kwargs: "Unpack[ExtraKwargsAsync]", ) -> Batch: """Submit a batch of transactions for enrichment""" @@ -329,11 +347,15 @@ async def create( if request_id is None: request_id = uuid.uuid4().hex extra_kwargs["request_id"] = request_id + + if isinstance(priority, str): + priority = BatchPriority(priority) resp = await self._sdk.retry_ratelimited_request( method="POST", url="/v3/batches", payload={ "operation": operation, + "priority": priority.value, "data": data, }, **extra_kwargs, From e9ad5d76851b26e6907543c5ccc8c7481ca078ce Mon Sep 17 00:00:00 2001 From: Matthew Tran <0e4ef622@gmail.com> Date: Wed, 24 Jun 2026 12:42:23 -0500 Subject: [PATCH 2/2] =?UTF-8?q?Bump=20version:=205.4.0=20=E2=86=92=205.5.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ntropy_sdk/__init__.py | 2 +- setup.cfg | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ntropy_sdk/__init__.py b/ntropy_sdk/__init__.py index cc6dc9c..0a60803 100644 --- a/ntropy_sdk/__init__.py +++ b/ntropy_sdk/__init__.py @@ -1,4 +1,4 @@ -__version__ = "5.4.0" +__version__ = "5.5.0" from typing import TYPE_CHECKING, Optional diff --git a/setup.cfg b/setup.cfg index 336689d..be2559d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 5.4.0 +current_version = 5.5.0 commit = True tag = True parse = (?P\d+)\.(?P\d+)\.(?P\d+)(rc(?P
\d+))?
diff --git a/setup.py b/setup.py
index fb957eb..ca59a48 100644
--- a/setup.py
+++ b/setup.py
@@ -55,6 +55,6 @@
     test_suite="tests",
     tests_require=test_requirements,
     url="https://github.com/ntropy-network/ntropy-sdk",
-    version="5.4.0",
+    version="5.5.0",
     zip_safe=False,
 )