sciop-cli 0.2.0__tar.gz → 0.2.2__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.
Files changed (46) hide show
  1. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/PKG-INFO +1 -1
  2. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/pyproject.toml +1 -1
  3. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/api.py +8 -4
  4. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/cli/api.py +2 -1
  5. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/cli/main.py +2 -1
  6. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/config.py +2 -0
  7. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/LICENSE +0 -0
  8. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/README.md +0 -0
  9. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/__init__.py +0 -0
  10. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/__main__.py +0 -0
  11. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/cli/__init__.py +0 -0
  12. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/cli/client.py +0 -0
  13. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/cli/manifest.py +0 -0
  14. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/cli/torrent.py +0 -0
  15. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/clients/__init__.py +0 -0
  16. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/clients/base.py +0 -0
  17. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/clients/qbt.py +0 -0
  18. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/const.py +0 -0
  19. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/data.py +0 -0
  20. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/exceptions.py +0 -0
  21. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/models/__init__.py +0 -0
  22. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/models/sciop.py +0 -0
  23. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/schema.py +0 -0
  24. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/torrent.py +0 -0
  25. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/src/sciop_cli/types.py +0 -0
  26. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/__init__.py +0 -0
  27. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/conftest.py +0 -0
  28. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/data/basic/part_1/subdir/part_1 +0 -0
  29. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/data/basic/part_2/subdir/part_2 +0 -0
  30. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/data/basic_hybrid.torrent +0 -0
  31. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/data/basic_v2.torrent +0 -0
  32. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/data/distributions/dlc_chrysler_ver02.json +0 -0
  33. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/data/distributions/nbu_arwen_ver01.json +0 -0
  34. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/fixtures/__init__.py +0 -0
  35. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/fixtures/base.py +0 -0
  36. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/fixtures/fabricators.py +0 -0
  37. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_api.py +0 -0
  38. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_cli/__init__.py +0 -0
  39. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_cli/test_api.py +0 -0
  40. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_cli/test_torrent.py +0 -0
  41. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_client/__init__.py +0 -0
  42. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_client/test_client_config.py +0 -0
  43. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_config.py +0 -0
  44. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_data.py +0 -0
  45. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_temp.py +0 -0
  46. {sciop_cli-0.2.0 → sciop_cli-0.2.2}/tests/test_torrent.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sciop-cli
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: A CLI for sciop
5
5
  Author-Email: cosmicexplorer <dmcC2@hypnicjerk.ai>, sneakers-the-rat <sneakers-the-rat@protonmail.com>
6
6
  License: EUPL-1.2
@@ -25,7 +25,7 @@ dependencies = [
25
25
  ]
26
26
  requires-python = ">=3.11"
27
27
  readme = "README.md"
28
- version = "0.2.0"
28
+ version = "0.2.2"
29
29
 
30
30
  [project.license]
31
31
  text = "EUPL-1.2"
@@ -226,7 +226,9 @@ def claim_next(dataset: str) -> DatasetClaim | None:
226
226
  return DatasetClaim(**claim)
227
227
 
228
228
 
229
- def upload_torrent(path: Path, timeout: float | None = 60.0) -> TorrentFile:
229
+ def upload_torrent(path: Path, timeout: float | None = None) -> TorrentFile:
230
+ if timeout is None:
231
+ timeout = get_config().upload_timeout
230
232
  with open(path, "rb") as f:
231
233
  response = api_call("torrents", files={"file": f}, timeout=timeout)
232
234
  tf = cast(TorrentFile, response.json())
@@ -240,7 +242,7 @@ def create_upload(
240
242
  infohash: str | None = None,
241
243
  method: str | Path | None = None,
242
244
  description: str | Path | None = None,
243
- timeout: float | None = 60.0,
245
+ timeout: float | None = None,
244
246
  ) -> Upload:
245
247
  """
246
248
  Create an upload for a dataset or dataset parts.
@@ -259,8 +261,7 @@ def create_upload(
259
261
  that are not contained within the dataset description, e.g. additional structure,
260
262
  if this is some sub-component of a dataset, and so on
261
263
  timeout (float | None): Timeout in seconds to wait for the upload to complete.
262
- Defaults to 60 seconds since processing uploads can take some time,
263
- explicitly pass `None` to use `config.request_timeout`
264
+ If `None`, use Config.upload_timeout
264
265
  """
265
266
  if torrent_path and infohash or not (torrent_path or infohash):
266
267
  raise ValueError("Must pass torrent path OR infohash")
@@ -268,6 +269,9 @@ def create_upload(
268
269
  tf = upload_torrent(path=torrent_path, timeout=timeout)
269
270
  infohash = tf["v1_infohash"] if tf["version"] == "v1" else tf["v2_infohash"]
270
271
 
272
+ if timeout is None:
273
+ timeout = get_config().upload_timeout
274
+
271
275
  kwargs: dict[str, str | list[str] | None] = {
272
276
  "infohash": infohash,
273
277
  "dataset_slug": dataset,
@@ -37,7 +37,7 @@ def login(username: str, password: str, instance_url: str | None = None) -> None
37
37
  "--torrent",
38
38
  help="Path to the torrent file to upload",
39
39
  required=False,
40
- type=click.Path(),
40
+ type=click.Path(exists=True, dir_okay=False, path_type=Path),
41
41
  default=None,
42
42
  )
43
43
  @click.option(
@@ -80,6 +80,7 @@ def upload(
80
80
  upload = create_upload(
81
81
  dataset=dataset,
82
82
  dataset_parts=part,
83
+ torrent_path=torrent,
83
84
  infohash=infohash,
84
85
  method=method,
85
86
  description=description,
@@ -2,7 +2,7 @@ import logging
2
2
 
3
3
  import click
4
4
 
5
- from sciop_cli.cli.api import claims, login
5
+ from sciop_cli.cli.api import claims, login, upload
6
6
  from sciop_cli.cli.client import client
7
7
  from sciop_cli.cli.manifest import manifest
8
8
  from sciop_cli.cli.torrent import torrent
@@ -24,6 +24,7 @@ def cli(debug: bool) -> None:
24
24
  # top-level API commands
25
25
  cli.add_command(login)
26
26
  cli.add_command(claims)
27
+ cli.add_command(upload)
27
28
 
28
29
  # command groups
29
30
  cli.add_command(client)
@@ -67,6 +67,8 @@ class Config(BaseSettings):
67
67
  password: KeychainSecretStr() = None # type: ignore[valid-type]
68
68
  request_timeout: float = 5
69
69
  """Default timeout to use in API requests."""
70
+ upload_timeout: float = 300
71
+ """Default timeout for file uploads in seconds"""
70
72
  token: TokenSecretStr = None
71
73
  """Expiring jwt, stored in config to reuse between cli calls"""
72
74
  clients: list[ClientConfigs] = Field(default_factory=list)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes