rapidata 2.24.3__py3-none-any.whl → 2.25.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rapidata might be problematic. Click here for more details.

rapidata/__init__.py CHANGED
@@ -1,3 +1,5 @@
1
+ __version__ = "2.25.0"
2
+
1
3
  from .rapidata_client import (
2
4
  RapidataClient,
3
5
  DemographicSelection,
@@ -5,8 +5,7 @@ import webbrowser
5
5
  from time import sleep
6
6
  from typing import cast
7
7
  from colorama import Fore
8
-
9
- # Third-party imports
8
+ from datetime import datetime
10
9
  from tqdm import tqdm
11
10
 
12
11
  # Local/application imports
@@ -41,6 +40,7 @@ class RapidataOrder:
41
40
  ):
42
41
  self.order_id = order_id
43
42
  self.name = name
43
+ self.__created_at: datetime | None = None
44
44
  self.__openapi_service = openapi_service
45
45
  self.__workflow_id: str = ""
46
46
  self.__campaign_id: str = ""
@@ -50,6 +50,13 @@ class RapidataOrder:
50
50
  self.order_details_page = f"https://app.{self.__openapi_service.environment}/order/detail/{self.order_id}"
51
51
  logger.debug("RapidataOrder initialized")
52
52
 
53
+ @property
54
+ def created_at(self) -> datetime:
55
+ """Returns the creation date of the order."""
56
+ if not self.__created_at:
57
+ self.__created_at = self.__openapi_service.order_api.order_order_id_get(self.order_id).order_date
58
+ return self.__created_at
59
+
53
60
  def run(self) -> "RapidataOrder":
54
61
  """Runs the order to start collecting responses."""
55
62
  logger.info(f"Starting order '{self}'")
@@ -72,6 +79,13 @@ class RapidataOrder:
72
79
  logger.debug(f"Order '{self}' has been unpaused.")
73
80
  managed_print(f"Order '{self}' has been unpaused.")
74
81
 
82
+ def delete(self) -> None:
83
+ """Deletes the order."""
84
+ logger.info(f"Deleting order '{self}'")
85
+ self.__openapi_service.order_api.order_order_id_delete(self.order_id)
86
+ logger.debug(f"Order '{self}' has been deleted.")
87
+ managed_print(f"Order '{self}' has been deleted.")
88
+
75
89
  def get_status(self) -> str:
76
90
  """
77
91
  Gets the status of the order.
@@ -1,3 +1,7 @@
1
+ import requests
2
+ from packaging import version
3
+ from rapidata import __version__
4
+
1
5
  from rapidata.service.openapi_service import OpenAPIService
2
6
 
3
7
  from rapidata.rapidata_client.order.rapidata_order_manager import RapidataOrderManager
@@ -8,7 +12,7 @@ from rapidata.rapidata_client.validation.validation_set_manager import (
8
12
 
9
13
  from rapidata.rapidata_client.demographic.demographic_manager import DemographicManager
10
14
 
11
- from rapidata.rapidata_client.logging import logger
15
+ from rapidata.rapidata_client.logging import logger, managed_print
12
16
 
13
17
  class RapidataClient:
14
18
  """The Rapidata client is the main entry point for interacting with the Rapidata API. It allows you to create orders and validation sets."""
@@ -39,6 +43,9 @@ class RapidataClient:
39
43
  order (RapidataOrderManager): The RapidataOrderManager instance.
40
44
  validation (ValidationSetManager): The ValidationSetManager instance.
41
45
  """
46
+ logger.debug("Checking version")
47
+ self._check_version()
48
+
42
49
  logger.debug("Initializing OpenAPIService")
43
50
  self._openapi_service = OpenAPIService(
44
51
  client_id=client_id,
@@ -62,3 +69,18 @@ class RapidataClient:
62
69
  def reset_credentials(self):
63
70
  """Reset the credentials saved in the configuration file for the current environment."""
64
71
  self._openapi_service.reset_credentials()
72
+
73
+ def _check_version(self):
74
+ try:
75
+ response = requests.get(
76
+ "https://api.github.com/repos/RapidataAI/rapidata-python-sdk/releases/latest",
77
+ headers={"Accept": "application/vnd.github.v3+json"},
78
+ timeout=3
79
+ )
80
+ if response.status_code == 200:
81
+ latest_version = response.json()["tag_name"].lstrip("v")
82
+ if version.parse(latest_version) > version.parse(__version__):
83
+ managed_print(f"""A new version of the Rapidata SDK is available: {latest_version}
84
+ Your current version is: {__version__}""")
85
+ except Exception as e:
86
+ logger.debug(f"Failed to check for updates: {e}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rapidata
3
- Version: 2.24.3
3
+ Version: 2.25.0
4
4
  Summary: Rapidata package containing the Rapidata Python Client to interact with the Rapidata Web API in an easy way.
5
5
  License: Apache-2.0
6
6
  Author: Rapidata AG
@@ -16,6 +16,7 @@ Requires-Dist: authlib (>=1.5.1,<2.0.0)
16
16
  Requires-Dist: colorama (==0.4.6)
17
17
  Requires-Dist: deprecated (>=1.2.14,<2.0.0)
18
18
  Requires-Dist: httpx (>=0.28.1,<0.29.0)
19
+ Requires-Dist: packaging (>=25.0,<26.0)
19
20
  Requires-Dist: pandas (>=2.2.3,<3.0.0)
20
21
  Requires-Dist: pillow (>=10.4.0,<11.0.0)
21
22
  Requires-Dist: pydantic (>=2.8.2,<3.0.0)
@@ -1,4 +1,4 @@
1
- rapidata/__init__.py,sha256=UtlVqb_iIvsZDlyITqKQZNb864p2cGluEdsB0sw6Lt8,779
1
+ rapidata/__init__.py,sha256=h35IV8W3cyvTJCT58i-ci0E6ywwLn_GhAOxorAHTgs4,803
2
2
  rapidata/api_client/__init__.py,sha256=ueQCSv2aouXRHG6n2VdmXKMWq8_nguUeoA9oV9L8PQ4,27456
3
3
  rapidata/api_client/api/__init__.py,sha256=kxo-WoJb_QrJccktYJgKVVc674eT-scwggMvMZ3Spj8,1211
4
4
  rapidata/api_client/api/campaign_api.py,sha256=1ajX0hSnA4O5GacJLIGkAgorPlNDRVaEZY029Pkutl4,71353
@@ -471,10 +471,10 @@ rapidata/rapidata_client/metadata/_select_words_metadata.py,sha256=-MK5yQDi_G3BK
471
471
  rapidata/rapidata_client/order/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
472
472
  rapidata/rapidata_client/order/_rapidata_dataset.py,sha256=f09QfLvCmjTUEhZUOtduSXK-b1h_w1PxueTKrijVq5E,19815
473
473
  rapidata/rapidata_client/order/_rapidata_order_builder.py,sha256=x-2lpW6Jwlq-9XRz91beWNv2TgdEA-q4b_RhOSr7vhQ,14405
474
- rapidata/rapidata_client/order/rapidata_order.py,sha256=qloZIWNHG0790WOHMRzqQHcjOgpnFtJNFU1XIlWH0pE,11689
474
+ rapidata/rapidata_client/order/rapidata_order.py,sha256=EA81_0cO2GIJVPl7XVpyaH20PWN_mxwp6hIQuqUNy9g,12341
475
475
  rapidata/rapidata_client/order/rapidata_order_manager.py,sha256=ABWm-ASZuXvD5BEFbsGDt29fYZVTZIj-MdprrlymzZU,38209
476
476
  rapidata/rapidata_client/order/rapidata_results.py,sha256=UllYpuqpm2inKdRNhClaUwApuxsMLrvrGDsrHA5KqbY,8111
477
- rapidata/rapidata_client/rapidata_client.py,sha256=rbu3JBEVUyqs-HfJ1pdLsXM_8tp6JsCedKr-2gs9MwA,3141
477
+ rapidata/rapidata_client/rapidata_client.py,sha256=iAycSS8Dyt0_xnILpU5N9DoeGlB3v2UtlinmxcFh-eo,4029
478
478
  rapidata/rapidata_client/referee/__init__.py,sha256=q0Hv9nmfEpyChejtyMLT8hWKL0vTTf_UgUXPYNJ-H6M,153
479
479
  rapidata/rapidata_client/referee/_base_referee.py,sha256=MdFOhdxt3sRnWXLDKLJZKFdVpjBGn9jypPnWWQ6msQA,496
480
480
  rapidata/rapidata_client/referee/_early_stopping_referee.py,sha256=ULbokQZ91wc9D_20qHUhe55D28D9eTY1J1cMp_-oIDc,2088
@@ -524,7 +524,7 @@ rapidata/service/__init__.py,sha256=s9bS1AJZaWIhLtJX_ZA40_CK39rAAkwdAmymTMbeWl4,
524
524
  rapidata/service/credential_manager.py,sha256=FAH9PJreDAw3G9cJ_iwzvz99s9RnFDrxxV0BHb2VYAI,8698
525
525
  rapidata/service/local_file_service.py,sha256=pgorvlWcx52Uh3cEG6VrdMK_t__7dacQ_5AnfY14BW8,877
526
526
  rapidata/service/openapi_service.py,sha256=J07TB4P3cz9KCU7k_fwuMQwGXlq_nJx_m1_xHbZoCg0,4867
527
- rapidata-2.24.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
528
- rapidata-2.24.3.dist-info/METADATA,sha256=9dL8bjuN63DD69C-hxONBvtA-1OlF2_64jOaJKejqC4,1228
529
- rapidata-2.24.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
530
- rapidata-2.24.3.dist-info/RECORD,,
527
+ rapidata-2.25.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
528
+ rapidata-2.25.0.dist-info/METADATA,sha256=nVc2cYGcY7Ql3y1PB1RiMEnIi9PLVXsdJBtYi5OvEmQ,1268
529
+ rapidata-2.25.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
530
+ rapidata-2.25.0.dist-info/RECORD,,