abc-classroom.template

abcclassroom.template.add_assignment_to_readme(path_to_readme, assignment)[source]
abcclassroom.template.copy_files_to_template_repo(config, template_repo_path, assignment, release_path)[source]

Copies files and directories for the assignment recursively into the local template repository. Looks in release_dir and extra_files for files to copy.

If extra_files contains a readme, updates the readme with the assignment name.

Excludes files and directories that match patterns in files_to_ignore.

abcclassroom.template.create_or_update_remote(template_repo_path, organization, repo_name, token)[source]

Push template repo to GitHub. If remote does not yet exist, creates it before pushing.

Parameters
  • template_repo_path (string) – The path to the template repo on your local computer.

  • organization (string) – The name of the organization where your GitHub Classroom lives.

  • repo_name (string) – The name of the template repository to create on GitHub

  • token (github token) – Used to authenticate with GitHub via the API. Created by running abc-init

abcclassroom.template.create_template(assignment_name, mode='fail', push_to_github=False, commit_message='Initial commit')[source]

Classroom package function that creates or updates an assignment template repository. Implementation of both the new_template and update_template console scripts (which perform the same basic functions but with different command line arguments and defaults).

Creates an assignment directory in template_dir if it does not exist already. Copies files from course_materials/release and from extra_files, initializes as a git repo, and commits all changes.

Creates an assignment entry in the config file if one does not already exist.

If push_to_github = True, then also pushes to github (creating the remote repository if it does not already exist).

Parameters
  • push_to_github (boolean) – True if you want to push to GH

  • mode (merge, fail) –

  • commit_message (string) – Sets a custom git commit message. For new templates, default is “Initial commit” and for updating templates, default is “Updating assignment”

  • assignment_name (string) – name of the assignment

abcclassroom.template.create_template_dir(config, assignment, mode='fail')[source]

Creates a new directory in template_dir that will become the template repository for the assignment. If directory exists and mode is merge, do nothing. If directory exists and mode is delete, remove contents but leave .git directory.

abcclassroom.template.new_update_template(args)[source]

Command line function that creates or updates an assignment template repository. Implementation of both the new_template and update_template console scripts (which perform the same basic functions but with different command line arguments and defaults).

Creates an assignment entry in the config file if one does not already exist.

Parameters

args (command line arguments) –