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

Potential bug with pushing to the template dir? #172

Closed lwasser closed 3 years ago

lwasser commented 4 years ago

When i run abc-template in merge mode:

Loading configuration from config.yml
Template directory /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/assignment-template-repos/ea-python-2020-03-spatial-vector-template already exists; will keep directory but overwrite existing files with same names
repo path: /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/assignment-template-repos/ea-python-2020-03-spatial-vector-template
Getting assignment files
copying /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/nbgrader-files/release/ea-python-2020-03-spatial-vector/.DS_Store to /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/assignment-template-repos/ea-python-2020-03-spatial-vector-template
copying /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/nbgrader-files/release/ea-python-2020-03-spatial-vector/earth-lab-logo-rgb.png to /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/assignment-template-repos/ea-python-2020-03-spatial-vector-template
copying /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/nbgrader-files/release/ea-python-2020-03-spatial-vector/colored-bar.png to /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/assignment-template-repos/ea-python-2020-03-spatial-vector-template
copying /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/nbgrader-files/release/ea-python-2020-03-spatial-vector/ea-python-2020-03-spatial-vector-data-hw.ipynb to /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/assignment-template-repos/ea-python-2020-03-spatial-vector-template
copying /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/nbgrader-files/release/ea-python-2020-03-spatial-vector/.ipynb_checkpoints to /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/assignment-template-repos/ea-python-2020-03-spatial-vector-template
Traceback (most recent call last):
  File "/Users/leahwasser/miniconda3/envs/earth-analytics-python/bin/abc-new-template", line 11, in <module>
    load_entry_point('abc-classroom', 'console_scripts', 'abc-new-template')()
  File "/Users/leahwasser/Documents/github/0-python/abc-classroom/abcclassroom/__main__.py", line 181, in new_template
    template.new_update_template(args)
  File "/Users/leahwasser/Documents/github/0-python/abc-classroom/abcclassroom/template.py", line 30, in new_update_template
    copy_assignment_files(config, template_repo_path, assignment)
  File "/Users/leahwasser/Documents/github/0-python/abc-classroom/abcclassroom/template.py", line 166, in copy_assignment_files
    shutil.copy(fpath, template_repo)
  File "/Users/leahwasser/miniconda3/envs/earth-analytics-python/lib/python3.7/shutil.py", line 248, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/Users/leahwasser/miniconda3/envs/earth-analytics-python/lib/python3.7/shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
IsADirectoryError: [Errno 21] Is a directory: '/Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/nbgrader-files/release/ea-python-2020-03-spatial-vector/.ipynb_checkpoints'

this mkight be a separate issue but also my template repo did not push to github and also it doesn't have a remote.. really weird. i'll start over.

lwasser commented 4 years ago

Just a note that this is still happening

(earth-analytics-python) cu-biot-2-10:2020-ea-python-course leahwasser$ abc-update-template ea-python-2020-05-what-the-fork-who-did-this
Loading configuration from config.yml
Template directory /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/assignment-template-repos/ea-python-2020-05-what-the-fork-who-did-this-template already exists; will keep directory but overwrite existing files with same names
repo path: /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/assignment-template-repos/ea-python-2020-05-what-the-fork-who-did-this-template
Getting assignment files
copying /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/nbgrader-files/release/ea-python-2020-05-what-the-fork-who-did-this/earth-lab-logo-rgb.png to /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/assignment-template-repos/ea-python-2020-05-what-the-fork-who-did-this-template
copying /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/nbgrader-files/release/ea-python-2020-05-what-the-fork-who-did-this/colored-bar.png to /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/assignment-template-repos/ea-python-2020-05-what-the-fork-who-did-this-template
copying /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/nbgrader-files/release/ea-python-2020-05-what-the-fork-who-did-this/ea-python-2020-05-what-the-fork-who-did-this.ipynb to /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/assignment-template-repos/ea-python-2020-05-what-the-fork-who-did-this-template
copying /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/nbgrader-files/release/ea-python-2020-05-what-the-fork-who-did-this/.ipynb_checkpoints to /Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/assignment-template-repos/ea-python-2020-05-what-the-fork-who-did-this-template
Traceback (most recent call last):
  File "/Users/leahwasser/miniconda3/envs/earth-analytics-python/bin/abc-update-template", line 8, in <module>
    sys.exit(update_template())
  File "/Users/leahwasser/miniconda3/envs/earth-analytics-python/lib/python3.7/site-packages/abcclassroom/__main__.py", line 205, in update_template
    template.new_update_template(args)
  File "/Users/leahwasser/miniconda3/envs/earth-analytics-python/lib/python3.7/site-packages/abcclassroom/template.py", line 31, in new_update_template
    copy_assignment_files(config, template_repo_path, assignment)
  File "/Users/leahwasser/miniconda3/envs/earth-analytics-python/lib/python3.7/site-packages/abcclassroom/template.py", line 168, in copy_assignment_files
    shutil.copy(fpath, template_repo)
  File "/Users/leahwasser/miniconda3/envs/earth-analytics-python/lib/python3.7/shutil.py", line 248, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/Users/leahwasser/miniconda3/envs/earth-analytics-python/lib/python3.7/shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
IsADirectoryError: [Errno 21] Is a directory: '/Users/leahwasser/Documents/github/1-courses/0-professional-certificate/2020-ea-python-course/nbgrader-files/release/ea-python-2020-05-what-the-fork-who-did-this/.ipynb_checkpoints'
(earth-analytics-python) cu-biot-2-10:2020-ea-python-course leahwasser$ ??›

@kcranston will the pr above fix this? it's the same thing with the check points!! we will have ci files however that might start with a . so we may need to manage this carefully.

kcranston commented 4 years ago

PR #173 is the fix for skipping subdirectories.

Sounds like we want to think more about the patterns we want to include / skip, though.

lwasser commented 3 years ago

i am still running into this same issue. i still think we should have a way to control what this function copies over

raceback (most recent call last):
  File "/Users/leahwasser/opt/miniconda3/envs/abc-dev/bin/abc-new-template", line 33, in <module>
    sys.exit(load_entry_point('abc-classroom', 'console_scripts', 'abc-new-template')())
  File "/Users/leahwasser/github/0-python/abc-classroom/abcclassroom/__main__.py", line 185, in new_template
    template.new_update_template(args)
  File "/Users/leahwasser/github/0-python/abc-classroom/abcclassroom/template.py", line 33, in new_update_template
    copy_assignment_files(config, template_repo_path, assignment)
  File "/Users/leahwasser/github/0-python/abc-classroom/abcclassroom/template.py", line 195, in copy_assignment_files
    shutil.copy(fpath, template_repo)
  File "/Users/leahwasser/opt/miniconda3/envs/abc-dev/lib/python3.8/shutil.py", line 415, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/Users/leahwasser/opt/miniconda3/envs/abc-dev/lib/python3.8/shutil.py", line 261, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
IsADirectoryError: [Errno 21] Is a directory: '/Users/leahwasser/github/1-bootcamp-course/fall-2020-abc-ea-bootcamp/ea-bootcamp-fall-2020-nbgrader/release/bootcamp-2020-05-pandas/.ipynb_checkpoints'
kcranston commented 3 years ago

Ah, https://github.com/earthlab/abc-classroom/pull/173 never got merged (because it got mixed up with the extra-files changes - see conversation). I think we need to add the functionality related to copying directories that was in that PR.

The simplest solution is to copy everything when creating / updating the template repo and to use the .gitignore to control what gets committed and pushed.

lwasser commented 3 years ago

this has been resolved by adding files_to_ignore which allows you to ignore system files and directories or anything that you don't want abc-classroom pushing around.