Use specific python version for autograding

Is it possible to specify the Python version for executing the assignment tests without manually modifying the .github/workflows files?

The default classroom workflow uses the Ubuntu runner which comes with python 3.8.10 installed as default (for both python and python3).

You should be able to use the ‘run command’ tests in augograding to change the python version. (Something like sudo apt-get install python_version number you need_ and sudo update-alternatives --install /usr/bin/python python /usr/bin/python_version_number_you_need_ 1.) Don’t set any points for these ‘tests’ and they should configure the test environment for any following tests.

I haven’t tried this, so can’t say that it definitely works. Honestly, it’s a lot easier to edit the classroom.yml workflow and add the setup python action as a step before autograding.

Thanks @markpatterson27 for your suggestion.

If I can do without the classroom’s autograding tests and having the possibility to specify points per test, I can indeed just write a custom workflow.yml file. I managed to setup a specific conda environment using the setup-miniconda GH action.

But still it would be nice to have the option of specifying the python version and/or virtual environment in the classroom’s UI. It’s such a common thing to want to change…

Where could I mention this as a enhancement proposal for GHC?

If you include workflow and autograding files in your template repo, Autograding in Classroom will pick it up and report the autograding points in the Classroom UI. Files need to be named the same as the files created for grading by Classroom. You need .github/classroom/autograding.json defining the tests and points for autograding, and you need .github/workflows/classroom.yml to define the workflow. The workflow will need to include the autograding action.

If you look in my repo on autograding with SQL server you can see the format to follow for autograding.json and classroom.yml in the .github folder. (If you are feeling really brave, you can look here to see how far you can custimize the workflow while still having Autograding reporting scores in the Classroom UI.)

Don’t define tests in the Classroom UI, otherwise your custom workflow and autograding tests will be overwritten.

© 2017 GitHub, Inc.
with by
GitHub Education