-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython-project.sh
executable file
·40 lines (28 loc) · 1.14 KB
/
python-project.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
# sets up an Ada Python project
repo=${1}
# check if $repo variable is empty
if [ -z "$repo" ]
then
# give directions on how to run the script if no repo provided
echo "When you run the file, you must also specify the repo you want to clone."
echo "Type the location of the python-projects.sh file, followed by the Github clone url."
echo "For example:"
echo "ada-project-setup/python-project.sh https://github.com/user-name/repository-name.git"
exit
else
git clone $repo
# regex to get the directory_name name, thank you Internet commenters (source: https://serverfault.com/questions/417241/extract-repository-name-from-github-url-in-bash)
directory_name=$(basename $repo .git)
# navigate to the directory
cd $directory_name
echo "You have cloned a repo from":
git remote -v
# setup the virtual environment
python3 -m venv venv
source venv/bin/activate
# install project requirements
pip install -r requirements.txt
#for some reason I always get a reminder to upgrade pip no matter how many times I upgrade it so I'll just put that here
pip install --upgrade pip
fi