rapidata 2.24.3__py3-none-any.whl → 2.26.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 +2 -0
- rapidata/rapidata_client/filter/_base_filter.py +31 -0
- rapidata/rapidata_client/filter/rapidata_filters.py +11 -0
- rapidata/rapidata_client/order/rapidata_order.py +16 -2
- rapidata/rapidata_client/rapidata_client.py +23 -1
- {rapidata-2.24.3.dist-info → rapidata-2.26.0.dist-info}/METADATA +2 -1
- {rapidata-2.24.3.dist-info → rapidata-2.26.0.dist-info}/RECORD +9 -9
- {rapidata-2.24.3.dist-info → rapidata-2.26.0.dist-info}/LICENSE +0 -0
- {rapidata-2.24.3.dist-info → rapidata-2.26.0.dist-info}/WHEEL +0 -0
rapidata/__init__.py
CHANGED
|
@@ -8,3 +8,34 @@ class RapidataFilter:
|
|
|
8
8
|
@abstractmethod
|
|
9
9
|
def _to_model(self) -> Any:
|
|
10
10
|
pass
|
|
11
|
+
|
|
12
|
+
def __or__(self, other):
|
|
13
|
+
"""Enable the | operator to create OrFilter combinations."""
|
|
14
|
+
if not isinstance(other, RapidataFilter):
|
|
15
|
+
return NotImplemented
|
|
16
|
+
|
|
17
|
+
from rapidata.rapidata_client.filter.or_filter import OrFilter
|
|
18
|
+
|
|
19
|
+
# If self is already an OrFilter, extend its filters list
|
|
20
|
+
if isinstance(self, OrFilter):
|
|
21
|
+
if isinstance(other, OrFilter):
|
|
22
|
+
return OrFilter(self.filters + other.filters)
|
|
23
|
+
else:
|
|
24
|
+
return OrFilter(self.filters + [other])
|
|
25
|
+
# If other is an OrFilter, prepend self to its filters
|
|
26
|
+
elif isinstance(other, OrFilter):
|
|
27
|
+
return OrFilter([self] + other.filters)
|
|
28
|
+
# Neither is an OrFilter, create a new one
|
|
29
|
+
else:
|
|
30
|
+
return OrFilter([self, other])
|
|
31
|
+
|
|
32
|
+
def __invert__(self):
|
|
33
|
+
"""Enable the ~ operator to create NotFilter negations."""
|
|
34
|
+
from rapidata.rapidata_client.filter.not_filter import NotFilter
|
|
35
|
+
|
|
36
|
+
# If self is already a NotFilter, return the original filter (double negation)
|
|
37
|
+
if isinstance(self, NotFilter):
|
|
38
|
+
return self.filter
|
|
39
|
+
# Create a new NotFilter
|
|
40
|
+
else:
|
|
41
|
+
return NotFilter(self)
|
|
@@ -33,6 +33,17 @@ class RapidataFilters:
|
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
This ensures the order is only shown to users in the US and Germany whose phones are set to English.
|
|
36
|
+
|
|
37
|
+
Info:
|
|
38
|
+
The or and not filter support the | and ~ operators respectively.
|
|
39
|
+
The and is given by the elements in the list.
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from rapidata import AgeFilter, LanguageFilter, CountryFilter
|
|
43
|
+
filters=[~AgeFilter([AgeGroup.UNDER_18]), CountryFilter(["US"]) | LanguageFilter(["en"])]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
This would return users who are not under 18 years old and are from the US or whose phones are set to English.
|
|
36
47
|
"""
|
|
37
48
|
user_score = UserScoreFilter
|
|
38
49
|
age = AgeFilter
|
|
@@ -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.
|
|
3
|
+
Version: 2.26.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
|
|
1
|
+
rapidata/__init__.py,sha256=-VgZCDa6OZStviIU7xxYoZBzjVfW72BWMJt0uNsOdkE,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
|
|
@@ -442,7 +442,7 @@ rapidata/rapidata_client/country_codes/country_codes.py,sha256=ePHqeb7y9DWQZAndd
|
|
|
442
442
|
rapidata/rapidata_client/demographic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
443
443
|
rapidata/rapidata_client/demographic/demographic_manager.py,sha256=RE4r6NNAXinNAlRMgAcG4te4pF4whv81xbyAW2V9XMM,1192
|
|
444
444
|
rapidata/rapidata_client/filter/__init__.py,sha256=SqxlEotA_O1Lgw3Um6VPBE2P5Hw7OUVZRSBbsv1GJbI,514
|
|
445
|
-
rapidata/rapidata_client/filter/_base_filter.py,sha256=
|
|
445
|
+
rapidata/rapidata_client/filter/_base_filter.py,sha256=EytjAqeDX_x3D5WoFwwtr8L2ok5-Ga-JEvkRnkuBQbw,1433
|
|
446
446
|
rapidata/rapidata_client/filter/age_filter.py,sha256=oRjGY65gE_X8oa0D0XRyvKAb4_Z6XOOaGTWykRSfLFA,739
|
|
447
447
|
rapidata/rapidata_client/filter/campaign_filter.py,sha256=6ZT11-gub8349QcRwuHt8AcBY18F7BdLRZ2Ch_vjLyU,735
|
|
448
448
|
rapidata/rapidata_client/filter/country_filter.py,sha256=JqCzxePRizXQbN4YzwLmrx9ozKgw0ra6N_enEq36imI,948
|
|
@@ -455,7 +455,7 @@ rapidata/rapidata_client/filter/models/gender.py,sha256=aXg6Kql2BIy8d5d1lCVi1axM
|
|
|
455
455
|
rapidata/rapidata_client/filter/new_user_filter.py,sha256=qU7d6cSslGEO_N1tYPS4Ru3cGbQYH2_I5dJPNPHvtCM,369
|
|
456
456
|
rapidata/rapidata_client/filter/not_filter.py,sha256=I7crEyOCs53uS0VI48s9EqC6PAFfV9EZG3upwFBJwZo,1189
|
|
457
457
|
rapidata/rapidata_client/filter/or_filter.py,sha256=u6vkXMTG_j15SbY3bkbnXbxJMDgEsH5rdoFLbuoLQmo,1345
|
|
458
|
-
rapidata/rapidata_client/filter/rapidata_filters.py,sha256=
|
|
458
|
+
rapidata/rapidata_client/filter/rapidata_filters.py,sha256=mx_r6rqEtm6pEe8d0hCEamk2nyplzZ9Hp-AlH98IhRU,1910
|
|
459
459
|
rapidata/rapidata_client/filter/response_count_filter.py,sha256=sDv9Dvy0FbnIQRSAxFGrUf9SIMISTNxnlAQcrFKBjXE,1989
|
|
460
460
|
rapidata/rapidata_client/filter/user_score_filter.py,sha256=2C78zkWm5TnfkxGbV1ER2xB7s9ynpacaibzyRZKG8Cc,1566
|
|
461
461
|
rapidata/rapidata_client/logging/__init__.py,sha256=WXXytdvJxZyE84tIFt4DGFqkqjmyyRdWBjET3RCbOVY,101
|
|
@@ -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=
|
|
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=
|
|
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.
|
|
528
|
-
rapidata-2.
|
|
529
|
-
rapidata-2.
|
|
530
|
-
rapidata-2.
|
|
527
|
+
rapidata-2.26.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
528
|
+
rapidata-2.26.0.dist-info/METADATA,sha256=LCq_MJWKADL3XBFDHUaTNu8pFfCR79H3XaCEbXz08_w,1268
|
|
529
|
+
rapidata-2.26.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
530
|
+
rapidata-2.26.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|