-
Notifications
You must be signed in to change notification settings - Fork 24
Absolute2 #442
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
base: draft
Are you sure you want to change the base?
Conversation
@RagnarGrootKoerkamp I closed the other PR since it was really outdated... this should use absolute where it is ok |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I guess this is not a stacked diff but a diff containing all the other PRs into draft as well.
anyway lgtm i gues
What was the original reason for preferring absolute paths again exactly? #356 mentions that |
I'm not sure, actually 😅 I think it's difficult to test the implications of this, I don't have a mental list of all the ways how symlinks are used in BAPCtools. Also, we may want to check if log/warn/error messages don't get blown up with full absolute paths now, in cases where shorter relative paths would suffice. Also, I don't think this really belongs to the |
Most error reporting already makes paths relative to elsewhere. Thinking of it, that may be the reason why this is a good change: given two absolute paths it's much more reliable to the relative version from one to the other. After this change, we can probably have a problem directory that's a symlink to another place and it should behave more consistently as if the symlink wasn't there at all? |
I think the only reason why we want to change this is if the problem itself is symlinked somewhere else? Then |
Can we:
|
May be a bit over the top to have a precommit hook, but that stuff is fast anyway so why not 🤷 |
I just think it would be a shame if this decision gets lost/forgotten in the future, when nothing is preventing the use of |
Not sure how to add such a hook... and how to handle those three cases where
|
* 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
* 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]>
* add order key to contest.yaml
* 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]>
No description provided.