rbx.cp 0.6.0__py3-none-any.whl → 0.6.1__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.
rbx/box/cd.py CHANGED
@@ -1,7 +1,7 @@
1
1
  import contextlib
2
2
  import functools
3
3
  import pathlib
4
- from typing import Optional
4
+ from typing import List, Optional
5
5
 
6
6
  import typer
7
7
 
@@ -25,6 +25,16 @@ def find_package(root: pathlib.Path = pathlib.Path()) -> Optional[pathlib.Path]:
25
25
  return root
26
26
 
27
27
 
28
+ def find_all_ancestor_packages(
29
+ root: pathlib.Path = pathlib.Path(),
30
+ ) -> List[pathlib.Path]:
31
+ packages = []
32
+ while (pkg := find_package(root)) is not None:
33
+ packages.append(pkg)
34
+ root = pkg.parent
35
+ return packages
36
+
37
+
28
38
  def is_problem_package(root: pathlib.Path = pathlib.Path()) -> bool:
29
39
  dir = find_package(root)
30
40
  if dir is None:
rbx/box/checkers.py CHANGED
@@ -141,9 +141,16 @@ def _is_checker_exitcode(exitcode: int) -> bool:
141
141
  return exitcode in [0, 1, 2, 3]
142
142
 
143
143
 
144
+ def _get_last_line(message: str) -> str:
145
+ if not message:
146
+ return ''
147
+ return message.strip().split('\n')[-1]
148
+
149
+
144
150
  def process_checker_run_log(
145
151
  checker_run_log: Optional[RunLog], message: str
146
152
  ) -> CheckerResult:
153
+ message = _get_last_line(message)
147
154
  if (
148
155
  checker_run_log is not None
149
156
  and checker_run_log.exitstatus == SandboxBase.EXIT_SANDBOX_ERROR
@@ -352,7 +359,8 @@ async def check_communication(
352
359
  return _extra_check_and_sanitize(result)
353
360
 
354
361
  # Just a defensive pattern to ensure result is not None, should never happen.
355
- result = check_with_no_output(interactor_run_log)
362
+ if result is None:
363
+ result = check_with_no_output(interactor_run_log)
356
364
  if result.outcome != Outcome.ACCEPTED:
357
365
  if result.outcome == Outcome.RUNTIME_ERROR:
358
366
  result.outcome = Outcome.JUDGE_FAILED
rbx/box/cli.py CHANGED
@@ -26,7 +26,7 @@ from rbx.box import (
26
26
  )
27
27
  from rbx.box.contest import main as contest
28
28
  from rbx.box.contest.contest_package import find_contest_yaml
29
- from rbx.box.environment import VerificationLevel, get_environment_path
29
+ from rbx.box.environment import VerificationLevel, get_app_environment_path
30
30
  from rbx.box.header import generate_header
31
31
  from rbx.box.packaging import main as packaging
32
32
  from rbx.box.schema import CodeItem, ExpectedOutcome, TestcaseGroup
@@ -333,7 +333,7 @@ async def run(
333
333
  )
334
334
 
335
335
 
336
- async def _time_impl(check: bool, detailed: bool) -> Optional[int]:
336
+ async def _time_impl(check: bool, detailed: bool, runs: int = 0) -> Optional[int]:
337
337
  if package.get_main_solution() is None:
338
338
  console.console.print(
339
339
  '[warning]No main solution found, so cannot estimate a time limit.[/warning]'
@@ -353,6 +353,7 @@ async def _time_impl(check: bool, detailed: bool) -> Optional[int]:
353
353
  check=check,
354
354
  verification=VerificationLevel(verification),
355
355
  timelimit_override=-1, # Unlimited for time limit estimation
356
+ nruns=runs,
356
357
  )
357
358
 
358
359
  console.console.print()
@@ -397,6 +398,12 @@ async def time(
397
398
  '-d',
398
399
  help='Whether to print a detailed view of the tests using tables.',
399
400
  ),
401
+ runs: int = typer.Option(
402
+ 0,
403
+ '--runs',
404
+ '-r',
405
+ help='Number of runs to perform for each solution. Zero means the config default.',
406
+ ),
400
407
  ):
401
408
  main_solution = package.get_main_solution()
402
409
  if check and main_solution is None:
@@ -411,7 +418,7 @@ async def time(
411
418
  if not await builder.build(verification=verification, output=check):
412
419
  return None
413
420
 
414
- await _time_impl(check, detailed)
421
+ await _time_impl(check, detailed, runs)
415
422
 
416
423
 
417
424
  @app.command(
@@ -814,6 +821,7 @@ def header():
814
821
  generate_header()
815
822
 
816
823
 
824
+ # TODO: warn when using a preset (or show it)
817
825
  @app.command(
818
826
  'environment, env',
819
827
  rich_help_panel='Configuration',
@@ -831,15 +839,14 @@ def environment_command(
831
839
  ] = None,
832
840
  ):
833
841
  if env is None:
834
- cfg = config.get_config()
835
- console.console.print(f'Current environment: [item]{cfg.boxEnvironment}[/item]')
836
842
  console.console.print(
837
- f'Location: {environment.get_environment_path(cfg.boxEnvironment)}'
843
+ f'Current environment: [item]{environment.get_active_environment_description()}[/item]'
838
844
  )
845
+ console.console.print(f'Location: {environment.get_active_environment_path()}')
839
846
  return
840
847
  if install_from is not None:
841
848
  environment.install_environment(env, pathlib.Path(install_from))
842
- if not get_environment_path(env).is_file():
849
+ if not get_app_environment_path(env).is_file():
843
850
  console.console.print(
844
851
  f'[error]Environment [item]{env}[/item] does not exist.[/error]'
845
852
  )
@@ -852,7 +859,7 @@ def environment_command(
852
859
  )
853
860
  return
854
861
  console.console.print(
855
- f'Changing box environment from [item]{cfg.boxEnvironment}[/item] to [item]{env}[/item]...'
862
+ f'Changing global environment from [item]{cfg.boxEnvironment}[/item] to [item]{env}[/item]...'
856
863
  )
857
864
  cfg.boxEnvironment = env
858
865
  config.save_config(cfg)
@@ -861,43 +868,6 @@ def environment_command(
861
868
  clear()
862
869
 
863
870
 
864
- @app.command(
865
- 'activate',
866
- rich_help_panel='Configuration',
867
- help='Activate the environment of the current preset used by the package.',
868
- )
869
- @cd.within_closest_package
870
- def activate():
871
- preset_lock = presets.get_preset_lock()
872
- if preset_lock is None:
873
- console.console.print(
874
- '[warning]No configured preset to be activated for this package.[/warning]'
875
- )
876
- raise typer.Exit(1)
877
-
878
- preset = presets.get_installed_preset_or_null(preset_lock.preset_name)
879
- if preset is None:
880
- if preset_lock.uri is None:
881
- console.console.print(
882
- '[error]Preset is not installed. Install it manually, or specify a URI in [item].preset-lock.yml[/item].[/error]'
883
- )
884
- raise typer.Exit(1)
885
- presets.install(preset_lock.uri)
886
-
887
- preset = presets.get_installed_preset(preset_lock.preset_name)
888
-
889
- # Install the environment from the preset if it's not already installed.
890
- presets.optionally_install_environment_from_preset(
891
- preset, root=presets.get_preset_installation_path(preset_lock.name)
892
- )
893
-
894
- # Activate the environment.
895
- if preset.env is not None:
896
- environment_command(preset.name)
897
-
898
- console.console.print(f'[success]Preset [item]{preset.name}[/item] is activated.')
899
-
900
-
901
871
  @app.command(
902
872
  'languages',
903
873
  rich_help_panel='Configuration',
@@ -918,6 +888,40 @@ def languages():
918
888
  console.console.print()
919
889
 
920
890
 
891
+ @app.command(
892
+ 'stats',
893
+ rich_help_panel='Management',
894
+ help='Show stats about current and related packages.',
895
+ )
896
+ @cd.within_closest_package
897
+ def stats(
898
+ transitive: bool = typer.Option(
899
+ False,
900
+ '--transitive',
901
+ '-t',
902
+ help='Show stats about all reachable packages.',
903
+ ),
904
+ ):
905
+ from rbx.box import stats
906
+
907
+ if transitive:
908
+ stats.print_reachable_package_stats()
909
+ else:
910
+ stats.print_package_stats()
911
+
912
+
913
+ @app.command(
914
+ 'fix',
915
+ rich_help_panel='Management',
916
+ help='Format files of the current package.',
917
+ )
918
+ @cd.within_closest_package
919
+ def fix():
920
+ from rbx.box import linting
921
+
922
+ linting.fix_package()
923
+
924
+
921
925
  @app.command(
922
926
  'clear, clean',
923
927
  rich_help_panel='Management',
rbx/box/code.py CHANGED
@@ -408,6 +408,7 @@ def _precompile_header(
408
408
  input_artifact: GradingFileInput,
409
409
  force_warnings: bool = False,
410
410
  verbose: bool = False,
411
+ include_other_headers: bool = False,
411
412
  ) -> GradingFileInput:
412
413
  """
413
414
  Precompile a header file (.h).
@@ -435,11 +436,12 @@ def _precompile_header(
435
436
  precompilation_artifacts = GradingArtifacts()
436
437
 
437
438
  # Keep only header files.
438
- precompilation_artifacts.inputs = [
439
- input
440
- for input in artifacts.inputs
441
- if input.src is not None and input.src.suffix == '.h'
442
- ]
439
+ if include_other_headers:
440
+ precompilation_artifacts.inputs = [
441
+ input
442
+ for input in artifacts.inputs
443
+ if input.src is not None and input.src.suffix == '.h'
444
+ ]
443
445
  precompilation_artifacts.inputs.append(
444
446
  GradingFileInput(
445
447
  src=input_artifact.src,
@@ -572,14 +574,14 @@ def compile_item(
572
574
  if is_cxx_command(get_exe_from_command(command))
573
575
  ]
574
576
 
575
- # Precompile C++ header files.
577
+ # Precompile C++ interesting header files.
576
578
  if precompile and _should_precompile(commands):
577
579
  precompilation_inputs = []
578
580
  for input in artifacts.inputs:
579
581
  if (
580
582
  input.src is not None
581
583
  and input.src.suffix == '.h'
582
- and input.dest.suffix == '.h'
584
+ and input.dest.name in ['stdc++.h', 'jngen.h', 'testlib.h']
583
585
  ):
584
586
  precompilation_inputs.append(
585
587
  _precompile_header(
@@ -9,7 +9,7 @@ from pydantic import ValidationError
9
9
  from rbx import console, utils
10
10
  from rbx.box import cd
11
11
  from rbx.box.contest.schema import Contest
12
- from rbx.box.package import find_problem_package_or_die, warn_preset_deactivated
12
+ from rbx.box.package import find_problem_package_or_die
13
13
  from rbx.box.schema import Package
14
14
 
15
15
  YAML_NAME = 'contest.rbx.yml'
@@ -24,7 +24,6 @@ def find_contest_yaml(root: pathlib.Path = pathlib.Path()) -> Optional[pathlib.P
24
24
  contest_yaml_path = root / YAML_NAME
25
25
  if not contest_yaml_path.is_file():
26
26
  return None
27
- warn_preset_deactivated(root)
28
27
  return contest_yaml_path
29
28
 
30
29
 
@@ -84,12 +83,10 @@ def get_problems(contest: Contest) -> List[Package]:
84
83
  return problems
85
84
 
86
85
 
87
- def get_ruyaml() -> Tuple[ruyaml.YAML, ruyaml.Any]:
88
- contest_yaml_path = find_contest_yaml()
86
+ def get_ruyaml(root: pathlib.Path = pathlib.Path()) -> Tuple[ruyaml.YAML, ruyaml.Any]:
87
+ contest_yaml_path = find_contest_yaml(root)
89
88
  if contest_yaml_path is None:
90
- console.console.print(
91
- f'Contest not found in {pathlib.Path().absolute()}', style='error'
92
- )
89
+ console.console.print(f'[error]Contest not found in {root.absolute()}[/error]')
93
90
  raise typer.Exit(1)
94
91
  res = ruyaml.YAML()
95
92
  return res, res.load(contest_yaml_path.read_text())
rbx/box/contest/main.py CHANGED
@@ -17,7 +17,6 @@ from rbx.box.contest.contest_package import (
17
17
  )
18
18
  from rbx.box.contest.schema import ContestProblem
19
19
  from rbx.box.packaging import contest_main as packaging
20
- from rbx.box.presets.fetch import get_preset_fetch_info
21
20
  from rbx.box.schema import Package
22
21
  from rbx.config import open_editor
23
22
 
@@ -40,53 +39,18 @@ app.add_typer(
40
39
  def create(
41
40
  path: str,
42
41
  preset: Annotated[
43
- str,
42
+ Optional[str],
44
43
  typer.Option(
45
44
  '--preset',
46
45
  '-p',
47
- help='Which preset to use to create this package. Can be a named of an already installed preset, or an URI, in which case the preset will be downloaded.',
46
+ help='Which preset to use to create this package. Can be a named of an already installed preset, or an URI, in which case the preset will be downloaded.\n'
47
+ 'If not provided, the default preset will be used, or the active preset if any.',
48
48
  ),
49
- ] = 'default',
50
- local: bool = typer.Option(
51
- False,
52
- '--local',
53
- '-l',
54
- help='Whether to inline the installed preset within the contest folder.',
55
- ),
49
+ ] = None,
56
50
  ):
57
51
  console.console.print(f'Creating new contest at [item]{path}[/item]...')
58
52
 
59
- fetch_info = get_preset_fetch_info(preset)
60
- if fetch_info is None:
61
- console.console.print(
62
- f'[error]Invalid preset name/URI [item]{preset}[/item][/error]'
63
- )
64
- raise typer.Exit(1)
65
-
66
- if fetch_info.is_remote():
67
- preset = presets.install_from_remote(fetch_info)
68
- elif fetch_info.is_local_dir():
69
- preset = presets.install_from_local_dir(fetch_info)
70
-
71
- preset_cfg = presets.get_installed_preset(preset)
72
- preset_path = (
73
- presets.get_preset_installation_path(preset)
74
- if preset_cfg.contest is not None
75
- else presets.get_preset_installation_path('default')
76
- )
77
-
78
- contest_path = (
79
- presets.get_preset_installation_path(preset) / preset_cfg.contest
80
- if preset_cfg.contest is not None
81
- else presets.get_preset_installation_path('default') / 'contest'
82
- )
83
-
84
- if not contest_path.is_dir():
85
- console.console.print(
86
- f'[error]Contest template [item]{contest_path}[/item] does not exist.[/error]'
87
- )
88
- raise typer.Exit(1)
89
-
53
+ fetch_info = presets.get_preset_fetch_info_with_fallback(preset)
90
54
  dest_path = pathlib.Path(path)
91
55
 
92
56
  if dest_path.exists():
@@ -100,23 +64,11 @@ def create(
100
64
  )
101
65
  raise typer.Exit(1)
102
66
 
103
- dest_path.mkdir(parents=True, exist_ok=True)
104
- shutil.copytree(str(contest_path), str(dest_path), dirs_exist_ok=True)
105
- shutil.rmtree(str(dest_path / 'build'), ignore_errors=True)
106
- shutil.rmtree(str(dest_path / '.box'), ignore_errors=True)
107
- shutil.rmtree(str(dest_path / '.local.rbx'), ignore_errors=True)
108
- # TODO: consider clearing build and .box recursively for nested problem directories
109
- for lock in dest_path.rglob('.preset-lock.yml'):
110
- lock.unlink(missing_ok=True)
111
-
112
- if local:
113
- presets.copy_local_preset(
114
- preset_path, dest_path, remote_uri=fetch_info.uri or preset_cfg.uri
115
- )
67
+ presets.install_contest(dest_path, fetch_info)
116
68
 
117
69
  with cd.new_package_cd(dest_path):
118
70
  contest_utils.clear_all_caches()
119
- presets.generate_lock(preset if not local else presets.LOCAL)
71
+ presets.generate_lock()
120
72
 
121
73
 
122
74
  @app.command('edit, e', help='Open contest.rbx.yml in your default editor.')
@@ -143,9 +95,6 @@ def add(path: str, short_name: str, preset: Optional[str] = None):
143
95
  )
144
96
  raise typer.Exit(1)
145
97
 
146
- preset_lock = presets.get_preset_lock()
147
- if preset is None and preset_lock is not None:
148
- preset = preset_lock.preset_name
149
98
  creation.create(name, preset=preset, path=pathlib.Path(path))
150
99
 
151
100
  contest = find_contest_package_or_die()
rbx/box/creation.py CHANGED
@@ -1,12 +1,10 @@
1
1
  import pathlib
2
- import shutil
3
2
  from typing import Annotated, Optional
4
3
 
5
4
  import typer
6
5
 
7
6
  from rbx import console, utils
8
7
  from rbx.box import package, presets
9
- from rbx.box.presets.fetch import get_preset_fetch_info
10
8
 
11
9
 
12
10
  def create(
@@ -26,33 +24,9 @@ def create(
26
24
  ] = None,
27
25
  path: Optional[pathlib.Path] = None,
28
26
  ):
29
- preset = preset or 'default'
30
27
  console.console.print(f'Creating new problem [item]{name}[/item]...')
31
28
 
32
- fetch_info = get_preset_fetch_info(preset)
33
- if fetch_info is None:
34
- console.console.print(
35
- f'[error]Invalid preset name/URI [item]{preset}[/item].[/error]'
36
- )
37
- raise typer.Exit(1)
38
-
39
- if fetch_info.fetch_uri is not None:
40
- preset = presets.install_from_remote(fetch_info)
41
-
42
- preset_cfg = presets.get_installed_preset(preset)
43
-
44
- problem_path = (
45
- presets.get_preset_installation_path(preset) / preset_cfg.problem
46
- if preset_cfg.problem is not None
47
- else presets.get_preset_installation_path('default') / 'problem'
48
- )
49
-
50
- if not problem_path.is_dir():
51
- console.console.print(
52
- f'[error]Problem template [item]{problem_path}[/item] does not exist.[/error]'
53
- )
54
- raise typer.Exit(1)
55
-
29
+ fetch_info = presets.get_preset_fetch_info_with_fallback(preset)
56
30
  dest_path = path or pathlib.Path(name)
57
31
 
58
32
  if dest_path.exists():
@@ -61,18 +35,11 @@ def create(
61
35
  )
62
36
  raise typer.Exit(1)
63
37
 
64
- dest_path.parent.mkdir(parents=True, exist_ok=True)
65
- shutil.copytree(str(problem_path), str(dest_path))
66
-
67
- # Remove a few left overs.
68
- shutil.rmtree(str(dest_path / 'build'), ignore_errors=True)
69
- shutil.rmtree(str(dest_path / '.box'), ignore_errors=True)
70
- for lock in dest_path.rglob('.preset-lock.yml'):
71
- lock.unlink(missing_ok=True)
38
+ presets.install_problem(dest_path, fetch_info)
72
39
 
73
40
  # Change problem name.
74
41
  ru, problem = package.get_ruyaml(dest_path)
75
42
  problem['name'] = name
76
43
  utils.save_ruyaml(dest_path / 'problem.rbx.yml', ru, problem)
77
44
 
78
- presets.generate_lock(preset, root=dest_path)
45
+ presets.generate_lock(dest_path)
rbx/box/environment.py CHANGED
@@ -7,6 +7,7 @@ import typer
7
7
  from pydantic import BaseModel, ConfigDict, Field, ValidationError
8
8
 
9
9
  from rbx import config, console, utils
10
+ from rbx.box import presets
10
11
  from rbx.box.extensions import Extensions, LanguageExtensions
11
12
  from rbx.grading.judge.sandbox import SandboxBase, SandboxParams
12
13
  from rbx.grading.judge.sandboxes.isolate import IsolateSandbox
@@ -185,22 +186,33 @@ class Environment(BaseModel):
185
186
  extensions: Optional[Extensions] = None
186
187
 
187
188
 
188
- def get_environment_path(env: str) -> pathlib.Path:
189
+ def get_app_environment_path(env: str) -> pathlib.Path:
189
190
  return config.get_app_file(pathlib.PosixPath('envs') / f'{env}.rbx.yml')
190
191
 
191
192
 
192
- def get_local_environment_path() -> Optional[pathlib.Path]:
193
- # TODO: implement logic to get env from local preset
194
- return None
193
+ def get_active_environment_path() -> pathlib.Path:
194
+ env_path = presets.get_preset_environment_path()
195
+ if env_path is None:
196
+ env_path = get_app_environment_path(config.get_config().boxEnvironment)
197
+ return env_path
198
+
199
+
200
+ @functools.cache
201
+ def get_active_environment_description() -> str:
202
+ env_path = presets.get_preset_environment_path()
203
+ if env_path is None:
204
+ return config.get_config().boxEnvironment
205
+ preset = presets.get_active_preset()
206
+ return f'preset - {preset.name}'
195
207
 
196
208
 
197
209
  @functools.cache
198
210
  def get_environment(env: Optional[str] = None) -> Environment:
199
211
  env_path = (
200
- get_environment_path(env) if env is not None else get_local_environment_path()
212
+ get_app_environment_path(env)
213
+ if env is not None
214
+ else get_active_environment_path()
201
215
  )
202
- if env_path is None:
203
- env_path = get_environment_path(config.get_config().boxEnvironment)
204
216
  if not env_path.is_file():
205
217
  console.console.print(
206
218
  f'Environment file [item]{env_path}[/item] not found.', style='error'
@@ -232,8 +244,8 @@ def install_environment(name: str, file: pathlib.Path):
232
244
  )
233
245
  raise typer.Exit(1)
234
246
 
235
- get_environment_path(name).parent.mkdir(parents=True, exist_ok=True)
236
- get_environment_path(name).write_bytes(file.read_bytes())
247
+ get_app_environment_path(name).parent.mkdir(parents=True, exist_ok=True)
248
+ get_app_environment_path(name).write_bytes(file.read_bytes())
237
249
  console.console.print(
238
250
  f'[success]Environment [item]{name}[/item] was installed from [item]{file}[/item]'
239
251
  )
rbx/box/linting.py ADDED
@@ -0,0 +1,26 @@
1
+ import pathlib
2
+
3
+ import yamlfix
4
+ import yamlfix.model
5
+
6
+ from rbx import console
7
+ from rbx.box.cd import is_contest_package, is_problem_package
8
+ from rbx.box.stats import find_problem_packages_from_contest
9
+
10
+
11
+ def fix_yaml(path: pathlib.Path, verbose: bool = True):
12
+ config = yamlfix.model.YamlfixConfig(quote_basic_values=True)
13
+ _, changed = yamlfix.fix_files([str(path)], dry_run=False, config=config)
14
+ if changed and verbose:
15
+ console.console.print(
16
+ f'Formatting [item]{path}[/item].',
17
+ )
18
+
19
+
20
+ def fix_package(root: pathlib.Path = pathlib.Path()):
21
+ if is_problem_package(root):
22
+ fix_yaml(root / 'problem.rbx.yml')
23
+ if is_contest_package(root):
24
+ fix_yaml(root / 'contest.rbx.yml')
25
+ for problem in find_problem_packages_from_contest(root):
26
+ fix_yaml(problem / 'problem.rbx.yml')
rbx/box/package.py CHANGED
@@ -10,10 +10,9 @@ import ruyaml
10
10
  import typer
11
11
  from pydantic import ValidationError
12
12
 
13
- from rbx import config, console, utils
14
- from rbx.box import cd, environment
13
+ from rbx import console, utils
14
+ from rbx.box import cd
15
15
  from rbx.box.environment import get_sandbox_type
16
- from rbx.box.presets import get_installed_preset_or_null, get_preset_lock
17
16
  from rbx.box.schema import (
18
17
  CodeItem,
19
18
  ExpectedOutcome,
@@ -38,33 +37,6 @@ TEMP_DIR = None
38
37
  CACHE_STEP_VERSION = 1
39
38
 
40
39
 
41
- def warn_preset_deactivated(root: pathlib.Path = pathlib.Path()):
42
- preset_lock = get_preset_lock(root)
43
- if preset_lock is None:
44
- return
45
-
46
- preset = get_installed_preset_or_null(preset_lock.preset_name)
47
- if preset is None:
48
- console.console.print(
49
- f'[warning]WARNING: [item]{preset_lock.preset_name}[/item] is not installed. '
50
- 'Run [item]rbx presets sync && rbx activate[/item] to install and activate this preset.'
51
- )
52
- console.console.print()
53
- return
54
-
55
- if preset.env is not None and (
56
- not environment.get_environment_path(preset.name).is_file()
57
- or config.get_config().boxEnvironment != preset.name
58
- ):
59
- console.console.print(
60
- '[warning]WARNING: This package uses a preset that configures a custom environment, '
61
- f' but instead you are using the environment [item]{config.get_config().boxEnvironment}[/item]. '
62
- 'Run [item]rbx activate[/item] to use the environment configured by your preset.'
63
- )
64
- console.console.print()
65
- return
66
-
67
-
68
40
  @functools.cache
69
41
  def find_problem_yaml(root: pathlib.Path = pathlib.Path()) -> Optional[pathlib.Path]:
70
42
  root = root.resolve()
@@ -74,7 +46,6 @@ def find_problem_yaml(root: pathlib.Path = pathlib.Path()) -> Optional[pathlib.P
74
46
  problem_yaml_path = root / YAML_NAME
75
47
  if not problem_yaml_path.is_file():
76
48
  return None
77
- warn_preset_deactivated(root)
78
49
  return problem_yaml_path
79
50
 
80
51
 
@@ -130,9 +101,7 @@ def save_package(
130
101
  def get_ruyaml(root: pathlib.Path = pathlib.Path()) -> Tuple[ruyaml.YAML, ruyaml.Any]:
131
102
  problem_yaml_path = find_problem_yaml(root)
132
103
  if problem_yaml_path is None:
133
- console.console.print(
134
- f'Problem not found in {pathlib.Path().absolute()}', style='error'
135
- )
104
+ console.console.print(f'[error]Problem not found in {root.absolute()}[/error]')
136
105
  raise typer.Exit(1)
137
106
  res = ruyaml.YAML()
138
107
  return res, res.load(problem_yaml_path.read_text())