crunch-cli 12.0.2__tar.gz → 12.0.3__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 (93) hide show
  1. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/PKG-INFO +2 -2
  2. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/__version__.py +1 -1
  3. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_errors.py +30 -29
  4. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/command/push.py +8 -4
  5. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/library.py +14 -7
  6. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch_cli.egg-info/PKG-INFO +2 -2
  7. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch_cli.egg-info/requires.txt +1 -1
  8. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/README.md +0 -0
  9. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/__init__.py +0 -0
  10. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/__main__.py +0 -0
  11. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/__init__.py +0 -0
  12. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_auth.py +0 -0
  13. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_client.py +0 -0
  14. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/__init__.py +0 -0
  15. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/common.py +0 -0
  16. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/competition.py +0 -0
  17. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/crunch.py +0 -0
  18. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/data_release.py +0 -0
  19. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/enum_.py +0 -0
  20. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/leaderboard.py +0 -0
  21. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/library.py +0 -0
  22. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/metric.py +0 -0
  23. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/phase.py +0 -0
  24. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/prediction.py +0 -0
  25. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/project.py +0 -0
  26. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/quickstarter.py +0 -0
  27. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/round.py +0 -0
  28. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/run.py +0 -0
  29. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/runner.py +0 -0
  30. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/score.py +0 -0
  31. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/submission.py +0 -0
  32. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/submission_file.py +0 -0
  33. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/target.py +0 -0
  34. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/upload.py +0 -0
  35. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_domain/user.py +0 -0
  36. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_identifiers.py +0 -0
  37. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_pagination.py +0 -0
  38. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_resource.py +0 -0
  39. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/api/_types.py +0 -0
  40. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/cli.py +0 -0
  41. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/command/__init__.py +0 -0
  42. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/command/convert.py +0 -0
  43. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/command/download.py +0 -0
  44. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/command/init.py +0 -0
  45. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/command/quickstarter.py +0 -0
  46. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/command/setup.py +0 -0
  47. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/command/test.py +0 -0
  48. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/command/update_token.py +0 -0
  49. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/constants.py +0 -0
  50. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/container.py +0 -0
  51. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/dev/__init__.py +0 -0
  52. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/dev/cli.py +0 -0
  53. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/dev/phala.py +0 -0
  54. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/downloader.py +0 -0
  55. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/external/__init__.py +0 -0
  56. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/external/gitignorefile.py +0 -0
  57. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/external/humanfriendly.py +0 -0
  58. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/external/inflection.py +0 -0
  59. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/inline.py +0 -0
  60. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/monkey_patches.py +0 -0
  61. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/runner/__init__.py +0 -0
  62. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/runner/cloud.py +0 -0
  63. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/runner/cloud_executor.py +0 -0
  64. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/runner/local.py +0 -0
  65. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/runner/runner.py +0 -0
  66. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/runner/tracing.py +0 -0
  67. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/runner/types.py +0 -0
  68. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/runner/unstructured.py +0 -0
  69. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/store.py +0 -0
  70. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/tester.py +0 -0
  71. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/unstructured/__init__.py +0 -0
  72. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/unstructured/_code_loader.py +0 -0
  73. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/unstructured/_execute.py +0 -0
  74. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/unstructured/_file.py +0 -0
  75. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/unstructured/_module/__init__.py +0 -0
  76. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/unstructured/_module/leaderboard.py +0 -0
  77. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/unstructured/_module/reward.py +0 -0
  78. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/unstructured/_module/runner.py +0 -0
  79. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/unstructured/_module/scoring.py +0 -0
  80. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/unstructured/_module/submission.py +0 -0
  81. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/unstructured/cli.py +0 -0
  82. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/unstructured/utils.py +0 -0
  83. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch/utils.py +0 -0
  84. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch-monkeypatch.pth +0 -0
  85. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch_cli.egg-info/SOURCES.txt +0 -0
  86. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch_cli.egg-info/dependency_links.txt +0 -0
  87. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch_cli.egg-info/entry_points.txt +0 -0
  88. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch_cli.egg-info/not-zip-safe +0 -0
  89. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/crunch_cli.egg-info/top_level.txt +0 -0
  90. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/setup.cfg +0 -0
  91. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/setup.py +0 -0
  92. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/tests/test_container.py +0 -0
  93. {crunch_cli-12.0.2 → crunch_cli-12.0.3}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crunch-cli
3
- Version: 12.0.2
3
+ Version: 12.0.3
4
4
  Summary: crunch-cli - CLI of the CrunchDAO Platform
5
5
  Home-page: https://github.com/crunchdao/crunch-cli
6
6
  Author: Enzo CACERES
@@ -11,7 +11,7 @@ Classifier: Programming Language :: Python :: 3.7
11
11
  Requires-Python: >=3
12
12
  Description-Content-Type: text/markdown
13
13
  Requires-Dist: click
14
- Requires-Dist: crunch-convert>=0.10.1
14
+ Requires-Dist: crunch-convert>=0.12.1
15
15
  Requires-Dist: crunch-encrypt
16
16
  Requires-Dist: coloredlogs
17
17
  Requires-Dist: dataclasses_json
@@ -1,6 +1,6 @@
1
1
  __title__ = 'crunch-cli'
2
2
  __description__ = 'crunch-cli - CLI of the CrunchDAO Platform'
3
- __version__ = '12.0.2'
3
+ __version__ = '12.0.3'
4
4
  __author__ = 'Enzo CACERES'
5
5
  __author_email__ = 'enzo.caceres@crunchdao.com'
6
6
  __url__ = 'https://github.com/crunchdao/crunch-cli'
@@ -1,7 +1,10 @@
1
1
  import json
2
2
  import sys
3
+ from dataclasses import dataclass
3
4
  from typing import Any, Dict, List, Optional, Union
4
5
 
6
+ from dataclasses_json import DataClassJsonMixin
7
+
5
8
  from crunch.api._domain.phase import PhaseType
6
9
  from crunch.api._domain.project import ProjectTokenType
7
10
  from crunch.external.humanfriendly import format_size
@@ -38,9 +41,6 @@ class ApiException(Exception):
38
41
 
39
42
  class InternalServerException(ApiException):
40
43
 
41
- def __init__(self, message: str):
42
- super().__init__(message)
43
-
44
44
  def print_helper(
45
45
  self,
46
46
  **kwargs: Any,
@@ -97,9 +97,6 @@ class ValidationFailedException(ApiException):
97
97
 
98
98
  class CheckException(ApiException):
99
99
 
100
- def __init__(self, message: str):
101
- super().__init__(message)
102
-
103
100
  def print_helper(
104
101
  self,
105
102
  **kwargs: Any,
@@ -180,12 +177,6 @@ class CrunchNotPublishedException(ApiException):
180
177
 
181
178
  class CurrentPhaseNotFoundException(ApiException):
182
179
 
183
- def __init__(
184
- self,
185
- message: str
186
- ):
187
- super().__init__(message)
188
-
189
180
  def print_helper(
190
181
  self,
191
182
  **kwargs: Any,
@@ -219,16 +210,25 @@ class DailySubmissionLimitExceededException(ApiException):
219
210
  _print_contact("you should get more")
220
211
 
221
212
 
213
+ @dataclass
214
+ class ForbiddenRequirement(DataClassJsonMixin):
215
+ name: str
216
+ language: str
217
+
218
+
222
219
  class ForbiddenLibraryException(ApiException):
223
220
 
224
221
  def __init__(
225
222
  self,
226
223
  message: str,
227
- packages: List[str]
224
+ requirements: List[dict[str, Any]]
228
225
  ):
229
226
  super().__init__(message)
230
227
 
231
- self.packages = packages
228
+ self.requirements = [
229
+ ForbiddenRequirement.from_dict(item) # pyright: ignore[reportUnknownMemberType]
230
+ for item in requirements
231
+ ]
232
232
 
233
233
  def print_helper(
234
234
  self,
@@ -245,16 +245,29 @@ class ForbiddenLibraryException(ApiException):
245
245
  client = Client.from_env()
246
246
 
247
247
  print("\nProblematic packages:")
248
- for package in self.packages:
249
- print(f"- {package}")
248
+ for requirement in self.requirements:
249
+ print(f"- {requirement.name}")
250
250
 
251
251
  if competition_name is not None:
252
- url = client.format_web_url(f'/competitions/{competition_name}/resources/whitelisted-libraries?requestName={package}')
252
+ request_language_param = "&requestLanguage={requirement.language}" if requirement.language != "PYTHON" else ""
253
+ url = client.format_web_url(f'/competitions/{competition_name}/resources/whitelisted-libraries?requestName={requirement.name}{request_language_param}')
253
254
  print(f" >> Request to whitelist: {url}")
254
255
 
255
256
  _print_contact("the package should be allowed")
256
257
 
257
258
 
259
+ class RequirementParseError(ApiException):
260
+
261
+ def print_helper(
262
+ self,
263
+ **kwargs: Any,
264
+ ) -> None:
265
+ print("There was an error while trying to parse your requirements file:")
266
+
267
+ for line in str(self.message).splitlines():
268
+ print(f" {line}")
269
+
270
+
258
271
  class InvalidProjectTokenException(ApiException):
259
272
 
260
273
  def __init__(
@@ -353,9 +366,6 @@ class ModelTooBigException(ApiException):
353
366
 
354
367
  class NeverSubmittedException(ApiException):
355
368
 
356
- def __init__(self, message: str):
357
- super().__init__(message)
358
-
359
369
  def print_helper(
360
370
  self,
361
371
  **kwargs: Any,
@@ -365,9 +375,6 @@ class NeverSubmittedException(ApiException):
365
375
 
366
376
  class EncryptedSubmissionException(ApiException):
367
377
 
368
- def __init__(self, message: str):
369
- super().__init__(message)
370
-
371
378
  def print_helper(
372
379
  self,
373
380
  **kwargs: Any,
@@ -377,12 +384,6 @@ class EncryptedSubmissionException(ApiException):
377
384
 
378
385
  class PredictionSubmissionNotAllowedException(ApiException):
379
386
 
380
- def __init__(
381
- self,
382
- message: str,
383
- ):
384
- super().__init__(message)
385
-
386
387
  def print_helper(
387
388
  self,
388
389
  **kwargs: Any,
@@ -245,10 +245,14 @@ def _upload_files(
245
245
  with open(path, "r") as fd:
246
246
  original_requirements_file = fd.read()
247
247
 
248
- requirements = requirements_txt.parse_from_file(
249
- language=language,
250
- file_content=original_requirements_file,
251
- )
248
+ try:
249
+ requirements = requirements_txt.parse_from_file(
250
+ language=language,
251
+ file_content=original_requirements_file,
252
+ )
253
+ except requirements_txt.RequirementParseError as error:
254
+ print(f"{language.txt_file_name}: {error}")
255
+ raise click.Abort()
252
256
 
253
257
  whitelist = requirements_txt.CachedWhitelist(
254
258
  requirements_txt.CrunchHubWhitelist(
@@ -5,9 +5,10 @@ from collections import defaultdict
5
5
  from types import ModuleType
6
6
  from typing import Any, Dict, List, NamedTuple, Optional, Set, overload
7
7
 
8
+ import click
8
9
  from crunch_convert import RequirementLanguage
9
10
  from crunch_convert.notebook import BadCellHandling, extract_from_cells
10
- from crunch_convert.requirements_txt import CachedWhitelist, CrunchHubWhitelist, MultipleLibraryAliasCandidateException, Whitelist, parse_from_file
11
+ from crunch_convert.requirements_txt import CachedWhitelist, CrunchHubWhitelist, MultipleLibraryAliasCandidateException, RequirementParseError, Whitelist, parse_from_file
11
12
 
12
13
  import crunch.store as store
13
14
  from crunch.api import Client
@@ -37,16 +38,22 @@ def extract_from_requirements(
37
38
  return set()
38
39
 
39
40
  with open(file_path, "r") as fd:
41
+ file_content = fd.read()
42
+
43
+ try:
40
44
  requirements = parse_from_file(
41
45
  language=language,
42
- file_content=fd.read(),
46
+ file_content=file_content,
43
47
  )
48
+ except RequirementParseError as error:
49
+ print(f"{language.txt_file_name}: {error}")
50
+ raise click.Abort()
44
51
 
45
- return {
46
- requirement.name
47
- for requirement in requirements
48
- if requirement.language == language
49
- }
52
+ return {
53
+ requirement.name
54
+ for requirement in requirements
55
+ if requirement.language == language
56
+ }
50
57
 
51
58
 
52
59
  def extract_from_notebook_modules(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crunch-cli
3
- Version: 12.0.2
3
+ Version: 12.0.3
4
4
  Summary: crunch-cli - CLI of the CrunchDAO Platform
5
5
  Home-page: https://github.com/crunchdao/crunch-cli
6
6
  Author: Enzo CACERES
@@ -11,7 +11,7 @@ Classifier: Programming Language :: Python :: 3.7
11
11
  Requires-Python: >=3
12
12
  Description-Content-Type: text/markdown
13
13
  Requires-Dist: click
14
- Requires-Dist: crunch-convert>=0.10.1
14
+ Requires-Dist: crunch-convert>=0.12.1
15
15
  Requires-Dist: crunch-encrypt
16
16
  Requires-Dist: coloredlogs
17
17
  Requires-Dist: dataclasses_json
@@ -1,5 +1,5 @@
1
1
  click
2
- crunch-convert>=0.10.1
2
+ crunch-convert>=0.12.1
3
3
  crunch-encrypt
4
4
  coloredlogs
5
5
  dataclasses_json
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes