-
Notifications
You must be signed in to change notification settings - Fork 3
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
Modernize command line interaction #122
Merged
Benezivas
merged 114 commits into
Algorithmic-Battle:4.0.0-rc
from
ImogenBits:util_scripts
Sep 20, 2023
Merged
Modernize command line interaction #122
Benezivas
merged 114 commits into
Algorithmic-Battle:4.0.0-rc
from
ImogenBits:util_scripts
Sep 20, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These are some very impressive changes, thank you very much. I will merge this PR early and vote for more extensive testing before the final release, as we need to demo the code for the upcoming semester soon. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a rather hefty PR that probably should've been split up but 🤷🏻♀️
The main idea of this is to update the command line interface to not be based on argparse and curses, but on typer and rich. This gives the tool a look and UX actually fitting of it being developed in 2023 :3
It also let us easily add the utility features we brought up a while ago, namely being able to do a quick test of student programs, and making the Docker learning curve not as steep. This is done by adding a bunch of subcommands:
algobattle run
: this is the oldalgobattle
, does the same thing with slightly different arguments and a much, much nicer UIalgobattle config
: opens the global config filealgobattle test
: runs a quick test of the programs, building both, and running basically a single fight to make sure they at least perform correct IO operationsalgobattle init
: This is where the real magic happens. It takes the file specifying a problem that students download from the algobattle website and initializes the student's project directory. This lets us easily manage problem specific dependencies since we can just install them here, lets us bundle the various python and config, and documentation files for each problem together in a user friendly way, and most importantly takes the burden of the students first having to learn how Docker works of their shoulders. Students can now just download the.algo
file from the website, runalgobattle init --problem path/to/download.algo --generator python --solver rust
and everything will be set up for them, including basic generator/solver projects with a Dockerfile that they'll only need to modify if they want to create more advanced programs.algobattle package
: The reverse of the init command, takes various problem files and packages them into a.algo
problem spec. Students will never need to run this, and course instructors very rarely if ever since the web server will take care of this step automatically. It's just included here for completeness's sake and in case you want to use algobattle on its own.There's still a lot of functionality to be added to these commands, but even in their current form they should make it a lot easier for students to get into things and a much, much better UX overall. In particular, while I've tried to add support for every reasonably popular language, some of the templates are very rudimentary. Python, Rust, Javascript, and Typescript all have fully featured templates that setup a project skeleton suitable for algobattle programs. But Java, C, C++, C#, and Go only contain rudimentary hello world scripts. I'm just not familiar enough with these languages to setup a basic json parsing and file io program and include an actual dependency manager in the Dockerfile.
I've also updated and reworked the docs to reflect these changes and also just be more cohesive and easy to understand in general. They also look marginally nicer with some new mkdocs features.
Finally, some screenshots of the new UI just to show it off :3
Running a match with a single team:
Testing programs:
Building programs during a match:
A match with multiple battles being run at once: