Python Script in VS Code

Automating your Development Process with Fish shell & Python

Use a fish function to kick off your development process. One command will create a React app, create a GitHub repository and start up VS Code!

See my article on creating functions in Fish here


Quickly create a project with one line in your fish terminal

Custom fish function + Python script + Github API = One touch project starter

newproject my-react-project
> Repository my-react-project created

At the conclusion of this script you will have:

1. Project repo in Github
2. Project file folder on local machine
3. Create-react-app boilerplate (with initial commit to Github)
4. VS Code open and ready to go!

Requirements: Python3, pip3, fish shell

Fish Function

Create a basic function to be updated later, after creating the Python Script

Create a function in Fish shell

function newproject
echo “React App”

Save the function

funcsave newproject

Python Script

The goal of this script is to use the Github API to log into your account and create a new repository

Navigate to a folder where you store all things code related, create a folder to store your Python scripts

mkdir scripts

Create a new file


Install PyGithub

pip install PyGithub

Open your favorite Python IDE and copy the following code

# system imports
import sys
import os
from github import Github

# path to your dev folder — this will need to be updated!
path = “/Users/christopherwatson/Documents/code/”

username = “” # Insert your github username here
password = “” # Insert your github password here

# function to create repo
def create():
# makes a new directory at the selected path and appends new
# project name
os.makedirs(path + str(sys.argv[1]))
# creates a new user object to provide to Github API
user = Github(username, password).get_user()
# creates a repo for the provided user
# success message!
print(“Succesfully created repository {}”.format(sys.argv[1]))

if __name__ == “__main__”:

Finish Fish Function

Using a parameter, this function will create a folder and repository for development

Navigate to the fish .config folder

cd ~/.config/fish/functions

Edit the function


Insert the following into your .fish file, replacing the path to your Python scripts and Github user name

In the above code, you are updating the previously created function newproject. Line 2 will check to see if a parameter is passed, and throw an error message if not. Else, we’ll run the script to create a file path and repository based on the argument passed after our function call. We’ll then initialize a local git repository at our new file path, add a new remote, and run create-react-app. Then your new code will be pushed up to the new repository, and VS Code will open at your project location

Using the Function

Quickly create a project with one line in your fish terminal

newProject my-react-project
> Repository my-react-project created

Use this function at any location in your Fish shell!



teacher | full stack web dev | software engineer

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store