rbx.cp 0.5.12__tar.gz → 0.5.14__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 (163) hide show
  1. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/PKG-INFO +4 -4
  2. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/pyproject.toml +4 -4
  3. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/builder.py +43 -13
  4. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/cd.py +1 -2
  5. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/checkers.py +25 -0
  6. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/compile.py +17 -23
  7. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/contest/contest_package.py +7 -1
  8. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/contest/main.py +26 -0
  9. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/contest/statements.py +8 -1
  10. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/environment.py +12 -6
  11. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/generators.py +10 -6
  12. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/main.py +96 -20
  13. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/package.py +7 -1
  14. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/presets/__init__.py +28 -3
  15. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/solutions.py +37 -11
  16. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/statements/build_statements.py +9 -1
  17. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/stresses.py +4 -3
  18. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/stressing/finder_parser.py +2 -2
  19. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/validators.py +42 -1
  20. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/clone.py +1 -1
  21. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading/judge/digester.py +6 -0
  22. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading/steps.py +70 -8
  23. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/LICENSE +0 -0
  24. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/README.md +0 -0
  25. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/__init__.py +0 -0
  26. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/annotations.py +0 -0
  27. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/autoenum.py +0 -0
  28. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/__init__.py +0 -0
  29. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/code.py +0 -0
  30. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/conftest.py +0 -0
  31. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/contest/__init__.py +0 -0
  32. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/contest/build_contest_statements.py +0 -0
  33. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/contest/contest_utils.py +0 -0
  34. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/contest/schema.py +0 -0
  35. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/creation.py +0 -0
  36. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/download.py +0 -0
  37. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/extensions.py +0 -0
  38. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/generators_test.py +0 -0
  39. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/packaging/boca/extension.py +0 -0
  40. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/packaging/boca/packager.py +0 -0
  41. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/packaging/contest_main.py +0 -0
  42. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/packaging/main.py +0 -0
  43. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/packaging/packager.py +0 -0
  44. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/packaging/polygon/packager.py +0 -0
  45. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/packaging/polygon/test.py +0 -0
  46. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/packaging/polygon/xml_schema.py +0 -0
  47. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/presets/fetch.py +0 -0
  48. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/presets/lock_schema.py +0 -0
  49. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/presets/schema.py +0 -0
  50. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/schema.py +0 -0
  51. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/solutions_test.py +0 -0
  52. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/statements/__init__.py +0 -0
  53. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/statements/builders.py +0 -0
  54. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/statements/joiners.py +0 -0
  55. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/statements/latex.py +0 -0
  56. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/statements/latex_jinja.py +0 -0
  57. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/statements/schema.py +0 -0
  58. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/stressing/__init__.py +0 -0
  59. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/stressing/generator_parser.py +0 -0
  60. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/testcases.py +0 -0
  61. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/ui/__init__.py +0 -0
  62. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/ui/captured_log.py +0 -0
  63. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/ui/css/app.tcss +0 -0
  64. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/ui/main.py +0 -0
  65. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/ui/run.py +0 -0
  66. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/box/validators_test.py +0 -0
  67. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/checker.py +0 -0
  68. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/config.py +0 -0
  69. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/conftest.py +0 -0
  70. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/console.py +0 -0
  71. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/create.py +0 -0
  72. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/edit.py +0 -0
  73. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading/__init__.py +0 -0
  74. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading/caching.py +0 -0
  75. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading/conftest.py +0 -0
  76. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading/judge/__init__.py +0 -0
  77. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading/judge/cacher.py +0 -0
  78. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading/judge/sandbox.py +0 -0
  79. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading/judge/sandboxes/__init__.py +0 -0
  80. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading/judge/sandboxes/isolate.py +0 -0
  81. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading/judge/sandboxes/stupid_sandbox.py +0 -0
  82. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading/judge/sandboxes/timeit.py +0 -0
  83. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading/judge/storage.py +0 -0
  84. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading/judge/test.py +0 -0
  85. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading/judge/testiso.py +0 -0
  86. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading/steps_with_caching.py +0 -0
  87. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading/steps_with_caching_run_test.py +0 -0
  88. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/grading_utils.py +0 -0
  89. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/hydration.py +0 -0
  90. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/main.py +0 -0
  91. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/metadata.py +0 -0
  92. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/providers/__init__.py +0 -0
  93. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/providers/codeforces.py +0 -0
  94. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/providers/provider.py +0 -0
  95. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/checkers/boilerplate.cpp +0 -0
  96. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/default_config.json +0 -0
  97. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/envs/default.rbx.yml +0 -0
  98. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/envs/isolate.rbx.yml +0 -0
  99. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/packagers/boca/checker.sh +0 -0
  100. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/packagers/boca/compare +0 -0
  101. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/packagers/boca/compile/c +0 -0
  102. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/packagers/boca/compile/cc +0 -0
  103. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/packagers/boca/compile/cpp +0 -0
  104. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/packagers/boca/compile/java +0 -0
  105. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/packagers/boca/compile/kt +0 -0
  106. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/packagers/boca/compile/pas +0 -0
  107. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/packagers/boca/compile/py2 +0 -0
  108. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/packagers/boca/compile/py3 +0 -0
  109. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/packagers/boca/run/c +0 -0
  110. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/packagers/boca/run/cc +0 -0
  111. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/packagers/boca/run/cpp +0 -0
  112. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/packagers/boca/run/java +0 -0
  113. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/packagers/boca/run/kt +0 -0
  114. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/packagers/boca/run/py2 +0 -0
  115. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/packagers/boca/run/py3 +0 -0
  116. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/contest/contest.rbx.yml +0 -0
  117. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/contest/statement/contest.rbx.tex +0 -0
  118. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/contest/statement/olymp.sty +0 -0
  119. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/contest/statement/template.rbx.tex +0 -0
  120. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/preset.rbx.yml +0 -0
  121. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/problem/.gitignore +0 -0
  122. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/problem/gen.cpp +0 -0
  123. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/problem/problem.rbx.yml +0 -0
  124. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/problem/random.py +0 -0
  125. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/problem/random.txt +0 -0
  126. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/problem/sols/main.cpp +0 -0
  127. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/problem/sols/slow.cpp +0 -0
  128. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/problem/sols/wa.cpp +0 -0
  129. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/problem/statement/olymp.sty +0 -0
  130. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/problem/statement/projecao.png +0 -0
  131. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/problem/statement/statement.rbx.tex +0 -0
  132. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/problem/statement/template.rbx.tex +0 -0
  133. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/problem/tests/samples/000.in +0 -0
  134. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/problem/tests/samples/001.in +0 -0
  135. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/problem/validator.cpp +0 -0
  136. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/presets/default/problem/wcmp.cpp +0 -0
  137. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/resources/templates/template.cpp +0 -0
  138. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/run.py +0 -0
  139. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/schema.py +0 -0
  140. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/submit.py +0 -0
  141. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/submitors/__init__.py +0 -0
  142. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/submitors/codeforces.py +0 -0
  143. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/submitors/submitor.py +0 -0
  144. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/test.py +0 -0
  145. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testcase.py +0 -0
  146. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testcase_rendering.py +0 -0
  147. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testdata/box1/gen1.cpp +0 -0
  148. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testdata/box1/gen2.cpp +0 -0
  149. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testdata/box1/genScript.py +0 -0
  150. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testdata/box1/hard-tle.sol.cpp +0 -0
  151. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testdata/box1/ole.cpp +0 -0
  152. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testdata/box1/problem.rbx.yml +0 -0
  153. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testdata/box1/re.sol.cpp +0 -0
  154. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testdata/box1/sol.cpp +0 -0
  155. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testdata/box1/tests/1.in +0 -0
  156. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testdata/box1/tle-and-incorrect.sol.cpp +0 -0
  157. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testdata/box1/tle.sol.cpp +0 -0
  158. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testdata/box1/validator.cpp +0 -0
  159. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testdata/box1/wa.sol.cpp +0 -0
  160. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testdata/caching/executable.py +0 -0
  161. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testdata/compatible +0 -0
  162. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/testing_utils.py +0 -0
  163. {rbx_cp-0.5.12 → rbx_cp-0.5.14}/rbx/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rbx.cp
3
- Version: 0.5.12
3
+ Version: 0.5.14
4
4
  Summary:
5
5
  Author: Roberto Sales
6
6
  Requires-Python: >=3.9,<4.0
@@ -10,7 +10,7 @@ Classifier: Programming Language :: Python :: 3.10
10
10
  Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Requires-Dist: chardet (>=5.2.0,<6.0.0)
13
- Requires-Dist: fastapi (>=0.111.0,<0.112.0)
13
+ Requires-Dist: fastapi (>=0.115.8,<0.116.0)
14
14
  Requires-Dist: filelock (>=3.14.0,<4.0.0)
15
15
  Requires-Dist: gevent (>=24.2.1,<25.0.0)
16
16
  Requires-Dist: gitpython (>=3.1.43,<4.0.0)
@@ -26,9 +26,9 @@ Requires-Dist: python-iso639 (>=2024.4.27,<2025.0.0)
26
26
  Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
27
27
  Requires-Dist: questionary (>=2.1.0,<3.0.0)
28
28
  Requires-Dist: requests (>=2.32.3,<3.0.0)
29
- Requires-Dist: rich (>=13.7.1,<14.0.0)
29
+ Requires-Dist: rich (>=13.9.4,<14.0.0)
30
30
  Requires-Dist: textual (>=0.79.1,<0.80.0)
31
- Requires-Dist: typer[all] (>=0.12.3,<0.13.0)
31
+ Requires-Dist: typer (>=0.15.1,<0.16.0)
32
32
  Description-Content-Type: text/markdown
33
33
 
34
34
  <p align="center">
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "rbx.cp"
3
- version = "0.5.12"
3
+ version = "0.5.14"
4
4
  description = ""
5
5
  packages = [
6
6
  {include = "rbx"}
@@ -10,14 +10,14 @@ readme = "README.md"
10
10
 
11
11
  [tool.poetry.dependencies]
12
12
  python = "^3.9"
13
- typer = {extras = ["all"], version = "^0.12.3"}
14
- fastapi = "^0.111.0"
13
+ typer = "^0.15.1"
14
+ fastapi = "^0.115.8"
15
15
  filelock = "^3.14.0"
16
16
  gevent = "^24.2.1"
17
17
  mechanize = "^0.4.10"
18
18
  jinja2 = "^3.1.4"
19
19
  pydantic = "2.8.2"
20
- rich = "^13.7.1"
20
+ rich = "^13.9.4"
21
21
  pyyaml = "^6.0.1"
22
22
  requests = "^2.32.3"
23
23
  latexbuild = "^0.2.2"
@@ -9,14 +9,23 @@ from rbx.box.solutions import (
9
9
  print_run_report,
10
10
  run_solutions,
11
11
  )
12
- from rbx.box.validators import print_validation_report, validate_testcases
12
+ from rbx.box.validators import (
13
+ has_validation_errors,
14
+ print_validation_report,
15
+ validate_testcases,
16
+ )
13
17
 
14
18
 
15
19
  def build(
16
20
  verification: environment.VerificationParam,
17
21
  groups: Optional[Set[str]] = None,
18
- output: bool = True,
19
- ) -> None:
22
+ output: Optional[bool] = True,
23
+ ) -> bool:
24
+ no_main_solution_report = False
25
+ if output is None:
26
+ output = package.get_main_solution() is not None
27
+ no_main_solution_report = not output
28
+
20
29
  with utils.StatusProgress(
21
30
  'Building testcases...',
22
31
  'Built [item]{processed}[/item] testcases...',
@@ -24,6 +33,28 @@ def build(
24
33
  ) as s:
25
34
  generate_testcases(s, groups=groups)
26
35
 
36
+ if verification > 0:
37
+ validator = package.get_validator_or_nil()
38
+ if validator is None:
39
+ console.console.print(
40
+ '[warning]No validator found, skipping validation.[/warning]'
41
+ )
42
+
43
+ if validator is not None:
44
+ with utils.StatusProgress(
45
+ 'Validating testcases...',
46
+ 'Validated [item]{processed}[/item] testcases...',
47
+ keep=True,
48
+ ) as s:
49
+ infos = validate_testcases(s, groups=groups)
50
+ print_validation_report(infos)
51
+
52
+ if has_validation_errors(infos):
53
+ console.console.print(
54
+ '[error]Validation failed, check the report above.[/error]'
55
+ )
56
+ return False
57
+
27
58
  with utils.StatusProgress(
28
59
  'Building outputs for testcases...',
29
60
  'Built [item]{processed}[/item] outputs...',
@@ -32,23 +63,22 @@ def build(
32
63
  if output:
33
64
  generate_outputs_for_testcases(s, groups=groups)
34
65
 
35
- if verification > 0:
36
- with utils.StatusProgress(
37
- 'Validating testcases...',
38
- 'Validated [item]{processed}[/item] testcases...',
39
- keep=True,
40
- ) as s:
41
- infos = validate_testcases(s, groups=groups)
42
- print_validation_report(infos)
43
-
44
66
  console.console.print(
45
67
  '[success]Problem built.[/success] '
46
68
  '[warning]Check the output for verification errors![/warning]'
47
69
  )
48
70
 
71
+ if no_main_solution_report:
72
+ console.console.print(
73
+ '[warning]No main solution found, skipping generating samples for the statement.[/warning]'
74
+ )
75
+
76
+ return True
77
+
49
78
 
50
79
  def verify(verification: environment.VerificationParam) -> bool:
51
- build(verification=verification)
80
+ if not build(verification=verification):
81
+ return False
52
82
 
53
83
  if verification < VerificationLevel.FAST_SOLUTIONS.value:
54
84
  return True
@@ -3,9 +3,8 @@ import pathlib
3
3
  from typing import Optional
4
4
 
5
5
  import typer
6
- from rich import console
7
6
 
8
- from rbx import utils
7
+ from rbx import console, utils
9
8
 
10
9
 
11
10
  def find_package(root: pathlib.Path = pathlib.Path()) -> Optional[pathlib.Path]:
@@ -119,6 +119,31 @@ def check(
119
119
  )
120
120
  message = package.get_digest_as_string(error.value or '') or ''
121
121
 
122
+ if (
123
+ checker_run_log is not None
124
+ and checker_run_log.exitcode != 0
125
+ and (
126
+ checker_run_log.exitstatus != SandboxBase.EXIT_NONZERO_RETURN
127
+ or checker_run_log.exitcode not in [0, 1, 2, 3]
128
+ )
129
+ ):
130
+ console.console.print(
131
+ f'[error]Checker [item]{package.get_checker().path}[/item] failed unexpectedly.[/error]'
132
+ )
133
+ console.console.print(
134
+ f'[error]Summary:[/error] {checker_run_log.get_summary()}'
135
+ )
136
+ console.console.print(
137
+ f'[error]Testcase input:[/error] [item]{testcase.inputPath}[/item]'
138
+ )
139
+ console.console.print(
140
+ f'[error]Testcase output:[/error] [item]{testcase.outputPath}[/item]'
141
+ )
142
+ console.console.print(
143
+ f'[error]Program output:[/error] [item]{program_output}[/item]'
144
+ )
145
+ raise typer.Exit(1)
146
+
122
147
  if checker_run_log is None or checker_run_log.exitcode not in [0, 1, 2, 3]:
123
148
  return CheckerResult(outcome=Outcome.INTERNAL_ERROR)
124
149
 
@@ -22,35 +22,29 @@ def _compile(item: CodeItem):
22
22
  out_path.chmod(0o755)
23
23
 
24
24
  console.console.print(
25
- f'[success]Compiled file written at [item]{out_path}[/item].[/success]'
25
+ f'[success]Compiled file written at [item]{out_path}[/item][/success]'
26
26
  )
27
27
 
28
28
 
29
- @app.command('any, a', help='Compile an asset given its path.')
30
- @package.within_problem
31
29
  def any(path: str):
32
- _compile(CodeItem(path=pathlib.Path(path)))
33
-
34
-
35
- @app.command('solution, s', help='Compile a solution given its path.')
36
- @package.within_problem
37
- def solution(path: str):
38
- _compile(package.get_solution(path))
30
+ pkg = package.find_problem_package_or_die()
39
31
 
32
+ solution = package.get_solution_or_nil(path)
33
+ if solution is not None:
34
+ _compile(solution)
35
+ return
40
36
 
41
- @app.command('generator, gen, g', help='Compile a generator given its name.')
42
- @package.within_problem
43
- def generator(name: str):
44
- _compile(package.get_generator(name))
37
+ for generator in pkg.generators:
38
+ if generator.path == pathlib.Path(path) or generator.name == path:
39
+ _compile(generator)
40
+ return
45
41
 
42
+ if pkg.checker is not None and pkg.checker.path == pathlib.Path(path):
43
+ _compile(pkg.checker)
44
+ return
46
45
 
47
- @app.command('checker, c', help='Compile the checker.')
48
- @package.within_problem
49
- def checker():
50
- _compile(package.get_checker())
46
+ if pkg.validator is not None and pkg.validator.path == pathlib.Path(path):
47
+ _compile(pkg.validator)
48
+ return
51
49
 
52
-
53
- @app.command('validator, v', help='Compile the main validator.')
54
- @package.within_problem
55
- def validator():
56
- _compile(package.get_validator())
50
+ _compile(CodeItem(path=pathlib.Path(path)))
@@ -3,6 +3,7 @@ import pathlib
3
3
  from typing import List, Optional
4
4
 
5
5
  import typer
6
+ from pydantic import ValidationError
6
7
 
7
8
  from rbx import console, utils
8
9
  from rbx.box.contest.schema import Contest
@@ -30,7 +31,12 @@ def find_contest_package(root: pathlib.Path = pathlib.Path()) -> Optional[Contes
30
31
  contest_yaml_path = find_contest_yaml(root)
31
32
  if not contest_yaml_path:
32
33
  return None
33
- return utils.model_from_yaml(Contest, contest_yaml_path.read_text())
34
+ try:
35
+ return utils.model_from_yaml(Contest, contest_yaml_path.read_text())
36
+ except ValidationError as e:
37
+ console.console.print(e)
38
+ console.console.print('[error]Error parsing contest.rbx.yml.[/error]')
39
+ raise typer.Exit(1) from e
34
40
 
35
41
 
36
42
  def find_contest_package_or_die(root: pathlib.Path = pathlib.Path()) -> Contest:
@@ -160,6 +160,32 @@ def add(path: str, short_name: str, preset: Optional[str] = None):
160
160
  )
161
161
 
162
162
 
163
+ @app.command('remove, r', help='Remove problem from contest.')
164
+ @within_contest
165
+ def remove(path_or_short_name: str):
166
+ contest = find_contest_package_or_die()
167
+
168
+ kept_problems = []
169
+ removed_problems = []
170
+ for problem in contest.problems:
171
+ if (
172
+ problem.path == pathlib.Path(path_or_short_name)
173
+ or problem.short_name == path_or_short_name
174
+ ):
175
+ removed_problems.append(problem)
176
+ else:
177
+ kept_problems.append(problem)
178
+
179
+ contest.problems = kept_problems
180
+ save_contest(contest)
181
+
182
+ for problem in removed_problems:
183
+ shutil.rmtree(str(problem.path), ignore_errors=True)
184
+ console.console.print(
185
+ f'Problem [item]{problem.short_name}[/item] removed from contest at [item]{problem.path}[/item].'
186
+ )
187
+
188
+
163
189
  @app.command(
164
190
  'each',
165
191
  help='Run a command for each problem in the contest.',
@@ -51,7 +51,14 @@ def build(
51
51
  )
52
52
  with utils.new_cd(problem.get_path()):
53
53
  contest_utils.clear_package_cache()
54
- builder.build(verification=verification, groups=set(['samples']))
54
+
55
+ if not builder.build(
56
+ verification=verification, groups=set(['samples']), output=None
57
+ ):
58
+ console.console.print(
59
+ '[error]Failed to build statements with samples, aborting.[/error]'
60
+ )
61
+ raise typer.Exit(1)
55
62
 
56
63
  contest = find_contest_package_or_die()
57
64
  candidate_languages = languages
@@ -4,7 +4,7 @@ from enum import Enum
4
4
  from typing import Annotated, List, Optional, Type, TypeVar
5
5
 
6
6
  import typer
7
- from pydantic import BaseModel, ConfigDict
7
+ from pydantic import BaseModel, ConfigDict, ValidationError
8
8
 
9
9
  from rbx import config, console, utils
10
10
  from rbx.box.extensions import Extensions, LanguageExtensions
@@ -19,9 +19,8 @@ class VerificationLevel(Enum):
19
19
  NONE = 0
20
20
  VALIDATE = 1
21
21
  FAST_SOLUTIONS = 2
22
- ASAN = 3
23
- ALL_SOLUTIONS = 4
24
- FULL = 5
22
+ ALL_SOLUTIONS = 3
23
+ FULL = 4
25
24
 
26
25
 
27
26
  VerificationParam = Annotated[
@@ -31,7 +30,7 @@ VerificationParam = Annotated[
31
30
  '--verification',
32
31
  '-v',
33
32
  help='Verification level to use when building package.',
34
- default_factory=lambda: VerificationLevel.ALL_SOLUTIONS.value,
33
+ default_factory=lambda: VerificationLevel.FULL.value,
35
34
  ),
36
35
  ]
37
36
 
@@ -193,7 +192,14 @@ def get_environment(env: Optional[str] = None) -> Environment:
193
192
  f'Environment file [item]{env_path}[/item] not found.', style='error'
194
193
  )
195
194
  raise typer.Exit()
196
- return utils.model_from_yaml(Environment, env_path.read_text())
195
+ try:
196
+ return utils.model_from_yaml(Environment, env_path.read_text())
197
+ except ValidationError as e:
198
+ console.console.print(e)
199
+ console.console.print(
200
+ f'[error]Error parsing environment file [item]{env_path}[/item][/error]'
201
+ )
202
+ raise typer.Exit(1) from e
197
203
 
198
204
 
199
205
  @functools.cache
@@ -82,6 +82,8 @@ def _run_generator(
82
82
  console.console.print(
83
83
  f'[error]Failed generating test {i} from group path {group_path}[/error]',
84
84
  )
85
+ if run_log is not None:
86
+ console.console.print(f'[error]Summary:[/error] {run_log.get_summary()}')
85
87
  if generation_stderr.value is not None:
86
88
  console.console.print('[error]Stderr:[/error]')
87
89
  console.console.print(
@@ -142,9 +144,7 @@ def generate_output_for_testcase(
142
144
  f'[error]Failed generating output for [item]{testcase.inputPath}[/item][/error]',
143
145
  )
144
146
  if run_log is not None:
145
- console.console.print(
146
- f'[error]Main solution exited with code [item]{-run_log.exitcode}[/item][/error]',
147
- )
147
+ console.console.print(f'[error]Summary:[/error] {run_log.get_summary()}')
148
148
  checker_result = checkers.check_with_no_output(run_log)
149
149
  console.console.print(
150
150
  f'[warning]Time: [item]{run_log.time:.2f}s[/item][/warning]',
@@ -238,7 +238,7 @@ def _run_generator_script(testcase: TestcaseSubgroup, cacher: FileCacher) -> str
238
238
  )
239
239
  if run_log is not None:
240
240
  console.console.print(
241
- f'[error]Script exited with code [item]{-run_log.exitcode}[/item][/error]',
241
+ f'[error]Summary:[/error] {run_log.get_summary()}'
242
242
  )
243
243
  if run_stderr.value is not None:
244
244
  console.console.print('[error]Stderr:[/error]')
@@ -339,8 +339,12 @@ def generate_standalone(
339
339
  )
340
340
  if not generation_log or generation_log.exitcode != 0:
341
341
  console.console.print(
342
- f'[error]Failed generating test using generator call [info]{call.name} {expanded_args_str}[/info].[/error]',
342
+ f'[error]Failed generating test using generator call [info]{call.name} {expanded_args_str}[/info][/error]',
343
343
  )
344
+ if generation_log is not None:
345
+ console.console.print(
346
+ f'[error]Summary:[/error] {generation_log.get_summary()}'
347
+ )
344
348
  if generation_stderr.value is not None:
345
349
  console.console.print('[error]Stderr:[/error]')
346
350
  console.console.print(
@@ -357,7 +361,7 @@ def generate_standalone(
357
361
  ok, message, *_ = validators.validate_test(output, validator, validator_digest)
358
362
  if not ok:
359
363
  console.console.print(
360
- f'[error]Failed validating testcase generated by call [info]{call.name} {expanded_args_str}[/info].[/error]'
364
+ f'[error]Failed validating testcase generated by call [info]{call.name} {expanded_args_str}[/info][/error]'
361
365
  )
362
366
  console.console.print(f'[error]Message:[/error] {message}')
363
367
  console.console.print(f'Testcase written at [item]{output}[/item]')
@@ -3,11 +3,12 @@ from gevent import monkey
3
3
 
4
4
  monkey.patch_all()
5
5
 
6
+ import tempfile
6
7
  import shlex
7
8
  import sys
8
9
  import typing
9
10
 
10
- from rbx.box.schema import CodeItem, ExpectedOutcome
11
+ from rbx.box.schema import CodeItem, ExpectedOutcome, TestcaseGroup
11
12
 
12
13
 
13
14
  import pathlib
@@ -31,6 +32,7 @@ from rbx.box import (
31
32
  compile,
32
33
  presets,
33
34
  stresses,
35
+ validators,
34
36
  )
35
37
  from rbx.box.contest import main as contest
36
38
  from rbx.box.environment import VerificationLevel, get_environment_path
@@ -42,7 +44,6 @@ from rbx.box.solutions import (
42
44
  run_solutions,
43
45
  )
44
46
  from rbx.box.statements import build_statements
45
- from rbx.box.ui import main as ui_pkg
46
47
 
47
48
  app = typer.Typer(no_args_is_help=True, cls=annotations.AliasGroup)
48
49
  app.add_typer(
@@ -69,15 +70,12 @@ app.add_typer(
69
70
  app.add_typer(
70
71
  contest.app, name='contest', cls=annotations.AliasGroup, help='Contest management.'
71
72
  )
72
- app.add_typer(
73
- compile.app, name='compile', cls=annotations.AliasGroup, help='Compile assets.'
74
- )
75
73
 
76
74
 
77
- @app.command('ui', hidden=True)
78
- @package.within_problem
79
- def ui():
80
- ui_pkg.start()
75
+ # @app.command('ui', hidden=True)
76
+ # @package.within_problem
77
+ # def ui():
78
+ # ui_pkg.start()
81
79
 
82
80
 
83
81
  @app.command('edit, e', help='Open problem.rbx.yml in your default editor.')
@@ -96,13 +94,6 @@ def build(verification: environment.VerificationParam):
96
94
  builder.build(verification=verification)
97
95
 
98
96
 
99
- @app.command('verify, v', help='Build and verify all the tests for the problem.')
100
- @package.within_problem
101
- def verify(verification: environment.VerificationParam):
102
- if not builder.verify(verification=verification):
103
- console.console.print('[error]Verification failed, check the report.[/error]')
104
-
105
-
106
97
  @app.command('run, r', help='Build and run solution(s).')
107
98
  @package.within_problem
108
99
  def run(
@@ -139,7 +130,14 @@ def run(
139
130
  )
140
131
  check = False
141
132
 
142
- builder.build(verification=verification, output=check)
133
+ if not builder.build(verification=verification, output=check):
134
+ return
135
+
136
+ if verification <= VerificationLevel.VALIDATE.value:
137
+ console.console.print(
138
+ '[warning]Verification level is set to [item]validate (-v1)[/item], so rbx only build tests and validated them.[/warning]'
139
+ )
140
+ return
143
141
 
144
142
  with utils.StatusProgress('Running solutions...') as s:
145
143
  tracked_solutions = None
@@ -206,6 +204,12 @@ def irun(
206
204
  console.console.print(
207
205
  '[warning]Outputs will be written to files. If you wish to print them to the terminal, use the "-p" parameter.'
208
206
  )
207
+ if verification < VerificationLevel.ALL_SOLUTIONS.value:
208
+ console.console.print(
209
+ '[warning]Verification level should be at least [item]all solutions (-v4)[/item] to run solutions interactively.'
210
+ )
211
+ return
212
+
209
213
  main_solution = package.get_main_solution()
210
214
  if check and main_solution is None:
211
215
  console.console.print(
@@ -248,7 +252,13 @@ def create(
248
252
  @app.command('stress', help='Run a stress test.')
249
253
  @package.within_problem
250
254
  def stress(
251
- name: str,
255
+ name: Annotated[
256
+ str,
257
+ typer.Argument(
258
+ help='Name of the stress test to run (specified in problem.rbx.yml), '
259
+ 'or the generator to run, in case -g is specified.'
260
+ ),
261
+ ],
252
262
  generator_args: Annotated[
253
263
  Optional[str],
254
264
  typer.Option(
@@ -325,9 +335,27 @@ def stress(
325
335
 
326
336
  testgroup = questionary.select(
327
337
  'Choose the testgroup to add the tests to.\nOnly test groups that have a .txt generatorScript are shown below: ',
328
- choices=list(groups_by_name) + ['(skip)'],
338
+ choices=list(groups_by_name) + ['(create new script)', '(skip)'],
329
339
  ).ask()
330
340
 
341
+ if testgroup == '(create new script)':
342
+ new_script_name = questionary.text(
343
+ 'Enter the name of the new .txt generatorScript file: '
344
+ ).ask()
345
+ new_script_path = pathlib.Path(new_script_name).with_suffix('.txt')
346
+ new_script_path.parent.mkdir(parents=True, exist_ok=True)
347
+ new_script_path.touch()
348
+
349
+ # Temporarily create a new testgroup with the new script.
350
+ testgroup = new_script_path.stem
351
+ groups_by_name[testgroup] = TestcaseGroup(
352
+ name=testgroup, generatorScript=CodeItem(path=new_script_path)
353
+ )
354
+ console.console.print(
355
+ f'[warning]A testgroup for [item]{new_script_path}[/item] will not be automatically added to the problem.rbx.yml file for you.\n'
356
+ 'Please add it manually. [/warning]'
357
+ )
358
+
331
359
  if testgroup not in groups_by_name:
332
360
  break
333
361
  try:
@@ -355,6 +383,47 @@ def stress(
355
383
  break
356
384
 
357
385
 
386
+ @app.command('compile', help='Compile an asset given its path.')
387
+ @package.within_problem
388
+ def compile_command(
389
+ path: Annotated[str, typer.Argument(help='Path to the asset to compile.')],
390
+ ):
391
+ compile.any(path)
392
+
393
+
394
+ @app.command('validate', help='Run the validator in a one-off fashion, interactively.')
395
+ @package.within_problem
396
+ def validate(
397
+ path: Annotated[
398
+ Optional[str],
399
+ typer.Option('--path', '-p', help='Path to the testcase to validate.'),
400
+ ] = None,
401
+ ):
402
+ validator_tuple = validators.compile_main_validator()
403
+ if validator_tuple is None:
404
+ console.console.print('[error]No validator found for this problem.[/error]')
405
+ raise typer.Exit(1)
406
+
407
+ validator, validator_digest = validator_tuple
408
+
409
+ input = console.multiline_prompt('Testcase input')
410
+
411
+ if path is None:
412
+ with tempfile.TemporaryDirectory() as tmpdir:
413
+ tmppath = pathlib.Path(tmpdir) / '000.in'
414
+ tmppath.write_text(input)
415
+
416
+ info = validators.validate_one_off(
417
+ pathlib.Path(tmppath), validator, validator_digest
418
+ )
419
+ else:
420
+ info = validators.validate_one_off(
421
+ pathlib.Path(path), validator, validator_digest
422
+ )
423
+
424
+ validators.print_validation_report([info])
425
+
426
+
358
427
  @app.command('environment, env', help='Set or show the current box environment.')
359
428
  def environment_command(
360
429
  env: Annotated[Optional[str], typer.Argument()] = None,
@@ -417,10 +486,17 @@ def activate():
417
486
  console.console.print(
418
487
  '[error]Preset is not installed. Install it manually, or specify a URI in [item].preset-lock.yml[/item].[/error]'
419
488
  )
420
- raise
489
+ raise typer.Exit(1)
421
490
  presets.install(preset_lock.uri)
422
491
 
423
492
  preset = presets.get_installed_preset(preset_lock.preset_name)
493
+
494
+ # Install the environment from the preset if it's not already installed.
495
+ presets.optionally_install_environment_from_preset(
496
+ preset, root=presets.get_preset_installation_path(preset_lock.name)
497
+ )
498
+
499
+ # Activate the environment.
424
500
  if preset.env is not None:
425
501
  environment_command(preset.name)
426
502
 
@@ -3,6 +3,7 @@ import pathlib
3
3
  from typing import Dict, List, Optional, Tuple
4
4
 
5
5
  import typer
6
+ from pydantic import ValidationError
6
7
 
7
8
  from rbx import config, console, utils
8
9
  from rbx.box import environment
@@ -74,7 +75,12 @@ def find_problem_package(root: pathlib.Path = pathlib.Path()) -> Optional[Packag
74
75
  problem_yaml_path = find_problem_yaml(root)
75
76
  if not problem_yaml_path:
76
77
  return None
77
- return utils.model_from_yaml(Package, problem_yaml_path.read_text())
78
+ try:
79
+ return utils.model_from_yaml(Package, problem_yaml_path.read_text())
80
+ except ValidationError as e:
81
+ console.console.print(e)
82
+ console.console.print('[error]Error parsing problem.rbx.yml.[/error]')
83
+ raise typer.Exit(1) from e
78
84
 
79
85
 
80
86
  def find_problem_package_or_die(root: pathlib.Path = pathlib.Path()) -> Package: