unitlab 2.1.7__tar.gz → 2.1.9__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unitlab
3
- Version: 2.1.7
3
+ Version: 2.1.9
4
4
  Home-page: https://github.com/teamunitlab/unitlab-sdk
5
5
  Author: Unitlab Inc.
6
6
  Author-email: team@unitlab.ai
@@ -21,10 +21,10 @@ To get started with the Unitlab.ai CLI/Python SDK, you'll need to install it usi
21
21
 
22
22
  Once you have successfully installed the Unitlab package, you can conveniently handle all projects using the terminal.
23
23
 
24
- [This tutorial](https://docs.unitlab.ai/cli-python-sdk/cli) walks you through the most common CLI commands.
24
+ [This tutorial](https://docs.unitlab.ai/cli-python-sdk/unitlab-cli) walks you through the most common CLI commands.
25
25
 
26
26
  ## Quickstart
27
- Follow [the quickstart guide for the Python SDK](https://docs.unitlab.ai/cli-python-sdk/python-sdk).
27
+ Follow [the quickstart guide for the Python SDK](https://docs.unitlab.ai/cli-python-sdk/unitlab-python-sdk).
28
28
 
29
29
 
30
30
  ## Documentation
@@ -2,7 +2,7 @@ from setuptools import find_packages, setup
2
2
 
3
3
  setup(
4
4
  name="unitlab",
5
- version="2.1.7",
5
+ version="2.1.9",
6
6
  license="MIT",
7
7
  author="Unitlab Inc.",
8
8
  author_email="team@unitlab.ai",
@@ -9,8 +9,9 @@ import aiohttp
9
9
  import requests
10
10
  import tqdm
11
11
 
12
- from . import exceptions, utils
12
+ from . import exceptions
13
13
  from .dataset import DatasetUploadHandler
14
+ from .utils import handle_exceptions
14
15
 
15
16
  logger = logging.getLogger(__name__)
16
17
 
@@ -19,7 +20,7 @@ class UnitlabClient:
19
20
  """A client with a connection to the Unitlab.ai platform.
20
21
 
21
22
  Note:
22
- Please refer to the `Python SDK quickstart <https://docs.unitlab.ai/tutorials/python-sdk-quickstart>`__ for a full example of working with the Python SDK.
23
+ Please refer to the `Python SDK quickstart <https://docs.unitlab.ai/cli-python-sdk/unitlab-python-sdk>`__ for a full example of working with the Python SDK.
23
24
 
24
25
  First install the SDK.
25
26
 
@@ -48,12 +49,7 @@ class UnitlabClient:
48
49
  :exc:`~unitlab.exceptions.AuthenticationError`: If an invalid API key is used or (when not passing the API key directly) if ``UNITLAB_API_KEY`` is not found in your environment.
49
50
  """
50
51
 
51
- def __init__(self, api_key: str = None, api_url: str = None):
52
- if api_key is None:
53
- api_key = utils.get_api_key()
54
- if api_url is None:
55
- api_url = utils.get_api_url()
56
-
52
+ def __init__(self, api_key, api_url: str = "https://api.unitlab.ai"):
57
53
  self.api_key = api_key
58
54
  self.api_url = api_url
59
55
  self.api_session = requests.Session()
@@ -95,13 +91,13 @@ class UnitlabClient:
95
91
  def _get_headers(self):
96
92
  return {"Authorization": f"Api-Key {self.api_key}"}
97
93
 
98
- @utils.handle_exceptions
94
+ @handle_exceptions
99
95
  def _get(self, endpoint):
100
96
  return self.api_session.get(
101
97
  urllib.parse.urljoin(self.api_url, endpoint), headers=self._get_headers()
102
98
  )
103
99
 
104
- @utils.handle_exceptions
100
+ @handle_exceptions
105
101
  def _post(self, endpoint, data=None):
106
102
  return self.api_session.post(
107
103
  urllib.parse.urljoin(self.api_url, endpoint),
@@ -6,8 +6,8 @@ import typer
6
6
  import validators
7
7
  from typing_extensions import Annotated
8
8
 
9
+ from . import utils
9
10
  from .client import UnitlabClient
10
- from .utils import get_api_key, write_config
11
11
 
12
12
  app = typer.Typer()
13
13
  project_app = typer.Typer()
@@ -20,7 +20,7 @@ app.add_typer(dataset_app, name="dataset", help="Dataset commands")
20
20
  API_KEY = Annotated[
21
21
  str,
22
22
  typer.Option(
23
- default_factory=get_api_key, help="The api-key obtained from unitlab.ai"
23
+ default_factory=utils.get_api_key, help="The api-key obtained from unitlab.ai"
24
24
  ),
25
25
  ]
26
26
 
@@ -46,7 +46,7 @@ def configure(
46
46
  ):
47
47
  if not validators.url(api_url, simple_host=True):
48
48
  raise typer.BadParameter("Invalid api url")
49
- write_config(api_key=api_key, api_url=api_url)
49
+ utils.write_config(api_key=api_key, api_url=api_url)
50
50
 
51
51
 
52
52
  def get_client(api_key: str) -> UnitlabClient:
@@ -53,7 +53,7 @@ def get_api_key() -> str:
53
53
  return config.get("default", "api_key")
54
54
  except Exception:
55
55
  raise exceptions.ConfigurationError(
56
- f"Key `api_key` not found in {CONFIG_FILE_PATH}. Please run `unitlab configure` or provide one"
56
+ f"Key `api_key` not found in {CONFIG_FILE_PATH}. Please run `unitlab configure` or provide the api-key using the --api-key option."
57
57
  )
58
58
 
59
59
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unitlab
3
- Version: 2.1.7
3
+ Version: 2.1.9
4
4
  Home-page: https://github.com/teamunitlab/unitlab-sdk
5
5
  Author: Unitlab Inc.
6
6
  Author-email: team@unitlab.ai
File without changes
File without changes
File without changes
File without changes
File without changes