Skip to content

Draft #433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 23 commits into
base: master
Choose a base branch
from
Draft

Draft #433

wants to merge 23 commits into from

Conversation

mzuenni
Copy link
Collaborator

@mzuenni mzuenni commented Mar 5, 2025

Not part of the spec, but now that we're changing things anyway:

  • Rename testsession in contest.yaml to test_session

New features to BAPCtools that can also be added separately from upgrading the current implementation from legacy to 2023-07-draft:

@mzuenni
Copy link
Collaborator Author

mzuenni commented Mar 7, 2025

Move *.hint and *.desc to testcase.yaml keys hint: and description:

do we want to move those keys or add a new key yaml here that gets written verbatim?

@mpsijm
Copy link
Collaborator

mpsijm commented Mar 7, 2025

Good question, I think the latter. Since <testcase>.yaml contains more keys (see the spec), I think it makes sense to have a key yaml that contains this extra configuration, since this configuration should be written to a .yaml file with the same base name as the test case. So, we could have something like this, where we get 1.in, 1.ans, and 1.yaml:

data:
  sample:
    "1":
      in: Hello
      ans: World!
      yaml:
        args: -n 42  # This makes no sense in the Hello World example, I just wanted to spam all the keys 😛
        input_validator_args: case_insensitive
        output_validator_args: case_insensitive
        full_feedback: True
        hint: Greet the world!
        description: A test case in which the world is greeted.

mzuenni and others added 11 commits March 30, 2025 17:23
* implemented constants

* expose constants in more latex files

* rewrote zip export

* small changes

* remove print

* fix typos

* substitute in testdata.yaml

* add test problem

* add test

* fix submission dir

* update tests

* add tests

* fix?

* fix

* allow substitution in generator commands

* update file name regex

* fix

* restric problem name

* mock constants

* small changes

* fix

---------

Co-authored-by: Maarten Sijm <[email protected]>
* add bt upgrade

* implemented todos

* introduce SPEC constant

* remove legacy parsing

* fix

* fix

* simplify code

* upgrade test files

* remove empty keys

* updated test yamls

* fix

* fix name

* use newer version of bt upgrade

* improve bt upgrade

* add missing dir

* [upgrade] Remove comments from limits if both limits are the new default

* [upgrade] Ad-hoc import for CommentedMap and CommentedSeq

* try to insert testdata before data

* try to preserve the right comments

* try to preserve the right comments

* [upgrade] Improve preserving of comments when removing keys

* [upgrade] Improve replacing of keys at their original position

* fix errors

* rerun upgrade

* readd output validator dir

* [upgrade] Only write generators.yaml when it changed

---------

Co-authored-by: Maarten Sijm <[email protected]>
…oblem_slide/` (#434)

* use new paths

* update latex template files

* update skel

* ran bt upgrade

* remove stem call

* implemented suggestions

* export more stuff

* Rewrite problem_statement to statement/solution/problem_slide in documentation

* [export] Move files in solution/ or problem_slide/ to problem_statement/, not statement/

* use pdfType everywhere

* dont create empty keys

* return empty list on error

* update glob patterns

---------

Co-authored-by: Maarten Sijm <[email protected]>
* use output_validator

* upgraded tests

* updated skel

* fix symlink

* create output_validators dir

* changed class constants

* fix source_dir(s)

* copy symlinks

* export legacy

* [export] Fix typo in comment

---------

Co-authored-by: Maarten Sijm <[email protected]>
…age-format#372 (#437)

* [problem] Update parsing of problem.yaml based on Kattis/problem-package-format#372

Changes:
- **C1**: Keywords are now a list of strings (we used to still parse them as a single string, woops)
- **C2**: No change needed, this was just a "bug" in the human-readable text of the specification
- **C3**: Add constraints to float/int types in `limits` and warnings when any of the values are out of range
- **C5**: Do not allow lists to be empty (if a list-field is optional, it should be either `None` or a non-empty list)

The discussion for **C4** was moved to Kattis/problem-package-format#378 and is pending consensus, and the proposals for **C6**, **Q1**, and **Q2** were dropped.

* [problem] Fix parsing of ProblemSource, thanks to Thore's extra tests

* [test] Add some more tests for license/rights_owner

Note that I haven't thoroughly tested the combination of `license` and `rights_owner`.
Similar to embargo_until, BAPCtools doesn't really do much with this information anyway,
so the parser there is currently quite lenient, and as such I'll consider it out-of-scope for this PR.
If others feel like improving and adding tests for this, feel free to do so 🙂
* partially implement draft for samples

* only set out path if necessary

* fix missing key

* only check necessary .out files

* use outpath if possible

* some types

* use string type name...

* fix union type?

* fix typing

* drop .out support

* dont warn here

* add .out support

* fix tests

* made ans=out assumption optional

* fix code

* allow ans validators for interactive and multipass problems

* add missing validator

* properly handle samples in export

* properly handle samples in export

* properly handle samples in export

* allow more answer validators

* properly find testcases

* [doc] Improve grammar in documentation

* [validate] Replace import of Union with string type hint

* hide A stat for interactive problems

* dont always create empty ans files

* add comment

* rename

* fix samples

* only drop known suffixes

* simplify code

* add more tests

* allow standalone in.statement

* removed outdated assert

* removed outdated if

* undo namechange

* update files

* remove wip file

* [export] bt samplezip: check for duplicate files from attachments/

* [validate] Skip sanity checks for empty .ans files for interactive problems

* [test] samplezip/zip: assert that the correct samples are in the zip files

* [test] Add samples for constants problem

* [export] build_problem_zip: Make sure that .*.download files also end up in the zip

* improve warning

* [problem] Problem._samples: split warning message for has_raw over multiple lines

* [export] Simplify getting of all samples: .interaction is included in KNOWN_DATA_EXTENSIONS

* [generate] For interactive and/or multi-pass samples, allow .in.download and .interaction when both .in and .in.statement are missing

Also generate empty .ans.statement or .ans.download files if they don't exist yet.

* simplify code

* i hate python tuples

* [generate] generate_empty_interactive_sample_ans: stop when .ans file exists

* [generate] Move generate_empty_interactive_sample_ans to later step

* generators.cue: Add '{in,ans}.{statement,download}' to #testcase

* [test] Fix test_schemata.sh: run from correct directory, replace {%placeholders%}

* [test] test_schemata.sh: Skip empty snippets for now

* [generate] Allow writing empty hardcoded files

Kinda ugly, but should be caught by validators and sanity checks anyway,
so having the check here should™ be redundant.
This does allow writing empty .{in,ans}.{statement,download} files,
which are _not_ sanity-checked.

---------

Co-authored-by: Maarten Sijm <[email protected]>
* remove format_validators

* rename folders

* [problem] Problem._validators: remove `assert cls.source_dir`

because all {Input,Answer,Output}Validator classes now only have source_dir, instead of source_dirs.

---------

Co-authored-by: Maarten Sijm <[email protected]>
* make legacy export an explicit command

* [export] Add all the directories!

* [export] Legacy: remove solution/ and problem_slide/ from export dir

* [export] Make answer_validators/ not required

Apparently, `bt validate` also doesn't require them?

* prepend problem name

* fix test

* handle languages

* use ngerman

* add german to wsl

* keep languages in sync

* keep languages in sync

* [export] Add comment explaining why name in problems.yaml can also be str

* [doc] Improve singular/plural in explanation of `--languages`

* [export][latex] Rename --languages flag to --lang

* [test][export] Add assertions for which PDFs should be in the ZIPs

* [test] TestContest.test_zip: also remove constituent zip files after test completes

---------

Co-authored-by: Maarten Sijm <[email protected]>
* use source_dir at all places

* use source_dir even more

* fix bits/stdc++ check
mzuenni and others added 2 commits March 30, 2025 22:17
* drop bad support

* fix

* Fix log messages when renaming data/bad/*

* [stats] Rename "bad" to "inv" and "good" to "v_o" to stay closer to their actual names

---------

Co-authored-by: Maarten Sijm <[email protected]>
mzuenni and others added 5 commits April 2, 2025 15:03
* changed order from ccs

* Update bin/tools.py

Co-authored-by: Maarten Sijm <[email protected]>

* fix call

---------

Co-authored-by: Maarten Sijm <[email protected]>
* copied from mpsijm

* update identity

* update schemas

* update doc

* default value for action

* move visualizer

* remove testcases

* add warning for outdated visualizer

* add output visualizer (and made open more consistent)

* add comments

* implemented output visualizer

* change visualizer interface

* handle args

* dont use answer_validator_args

* properly resolve problem paths

* fix

* typing

* typing

* typing

* typing

* allow empty .ans files for multipass

* fix test

* refactored movetree

* allow moving sylinks

* improve _move_dir

* improved user experience

* add extra assert

* substitute more constants in export

* implement visualizer for interactive problems

* `identity` output-visualize also ans and in

* add example arg

* fix arg passing

* fix wsl

* disable output visualizer again

* removed outdated warning

* always copy output visualizer from skel

* `guess` output visualizer for an interactive problem

* update type

* more feedback

* Update skel/problem/input_visualizer/readme.md

Co-authored-by: Maarten Sijm <[email protected]>

* Update skel/problem/input_visualizer/readme.md

Co-authored-by: Maarten Sijm <[email protected]>

* Update bin/generate.py

Co-authored-by: Maarten Sijm <[email protected]>

* update version

* format

* format

* added example

* update visualizer logic

* fix mode

* fix mode

* simplify code

* add warning for deprecated root key

* Problem._parse_testdata_yaml: enforce validator/visualizer args to be lists of strings

* [visualize] Rename InputVisualizer to TestCaseVisualizer

---------

Co-authored-by: Thore Husfeldt <[email protected]>
Co-authored-by: Maarten Sijm <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support singular output_validator/ for 2023-07-draft spec bt upgrade port old problems to new spec
2 participants