PyBites-Open-Source / eatlocal

This package helps users solve PyBites code challenges on their local machine.
MIT License
20 stars 9 forks source link

download is not using REPO #24

Closed pmayd closed 2 years ago

pmayd commented 2 years ago

Currently when downloading via eatlocal download 1 the repo is downloaded in the current working directory. However, when you want to display the just downloaded bite via eatlocal display 1 you get an IndexError if the env var PYBITES_REPO is set. This is because display has a parameter bite_path that defaults to BITE_REPO, which in return is set to PYBITES_REPO. So you can download a bite to the cwd, but not display it? This is strange.

I suggest that the download should also per default download bites to the local bite repo unless the env var is not set, then default to cwd.

rhelmstedter commented 2 years ago

Ah, that makes sense because all the gitpython stuff was added after the download function but before the display function. That should also be an easy fix (famous last words).

rhelmstedter commented 2 years ago

After doing some thinking, should we just change the code to download to BITE_REPO always instead of the current directory? The repo is required to use the submit feature and display already utilizes it. Maybe just display a warning immediately if any of the the three constants (username, password, and repo) haven't been set yet?

rhelmstedter commented 2 years ago

Decided to change the defaults from cwd to BITE_REPO as determined by the $PYBITES_REPO environment variable. Users can also provide a path for download/extraction, display, and submitting. What do you think about this? e54ed8d419eed06f5121cfefc6b280bdcf40e86b

pmayd commented 2 years ago

made a few detailed comments to your commit ;)

rhelmstedter commented 2 years ago

Oh man, I didn't even know you could do that! It's like commenting on a google doc (can you tell I'm a teacher?). Thanks I'll look it over and see what I can fix.

pmayd commented 2 years ago

Yep, normally you only comment on PR, but Github allows to comment on every commit in the history. But its not a review then, only single comments, a proper review is only done in the context of a PR

rhelmstedter commented 2 years ago

Tried to address all of your comments: 259b3353bd8c4319c60a7de3c56331756acd6a5f

rhelmstedter commented 2 years ago

Going with the init command addresses this issue. init mode - Issue #27