earthlab / abc-classroom

Tools to automate github classroom and autograding workflows
https://abc-classroom.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
29 stars 21 forks source link

What is the abc-classroom Student template workflow? #105

Closed lwasser closed 4 years ago

lwasser commented 4 years ago

working through all of the steps it seems like we need to think more about the actual workflow associated with

  1. quickstart and
  2. creating and pushing an assignment template to github.

in the most recently merged pr, #91 there was in an issue in my workflow where i started to see abc-classroom doing git things for me but then it stopped. the workflow was:

  1. i ran quickstart

  2. i ran nbgrader create assignment

  3. i ran abc-assignment-template

  4. i didn't expect step 3 to automatically push to github. this is not ideal because i'd like to cehck the repo before pushing it. For instance perhaps i want to update the readme or make other tweaks. i need a way to do that

  5. when i saw issues in my repo and did want to update, i expected to be able to just run abc-assignment again. however this failed because now the repo exists and a new commit and push are needed but no repo needs to be created.

We need to think through what the correct workflow is for this. each command should be carefully scoped out

Could it be

  1. create-assignment-repo assignment-name : this would simply create the repo, and initialize it as a git repo.
  2. push-assignment-repo assignment name --commit-message: this would commit and push changes to github checking to see if the repo already exists or not.

the big question for me here is where to place the moving of files if for instance you release new nbgrader files. Maybe push assignment repo could optionally look in the release dir for new files? i'm not sure where to put this or where a user would expect it. @kcranston thoughts? @jlpalomino ?

kcranston commented 4 years ago

Let's brainstorm some possible workflows that a user might want:

  1. Create a new local assignment-template repository, move assignment files from another location (I'll call this the 'working-directory'), and git add-and-commit the changes.
  2. Add some new files to the working-directory, update the assignment-template directory with any changed or new files in working-directory, and git-add-and-commit the changes.
  3. Create a remote repository on GitHub.
  4. Associate the local git repo with a remote git repo and push to the remote.
  5. Make changes to the assignment-template repo and add-commit-push.

What other combinations of actions can you imagine?

kcranston commented 4 years ago

@lwasser and I discussed this today, and want to support two basic workflows:

We can support both of these with the existing abc-assignment-template script and available arguments, but to make these common workflows easier, we propose to replace with two helper scripts - new-assignment-template and update-assignment-template which would call the same functions but have different defaults.

kcranston commented 4 years ago

In the midst of implementing this, and making note of one tricky scenario. If you go through the full workflow (create local repo, create remote repo, add remote to local, push to github) and then re-run with --mode delete (which deletes the local repo and re-creates it) you end up in a scenario where your local repo has no common history with the remote repo. In this case git pull exits with fatal: refusing to merge unrelated histories.

What we probably want to do in this scenario (i.e. if mode == "delete" and remote_repo_exists) is to delete the local directory, then clone from the existing remote, make the changes there, then push.

There is an --allow-unrelated-histories option for git pull, but this seems dangerous.

kcranston commented 4 years ago

Just to complete the conversation here, the resolution for the --mode delete issue above is to delete everything but the .git directory (implemented by simply moving the .git dir to a new temporary location, re-creating the template directory, and moving it back).