My Python Dev Setup

What they didnt tell you when working with macOS Python and AWS

alt

Installing Python

Install macOS developer tools first

xcode-select --install

# Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

# Edit Profile
vi ~/.bash_profile

Paste the following into the file after pressing i

export PATH=/usr/local/bin:$PATH

Press :wq then run the following to activate.

source ~/.bash_profile

Then after that intall Python3.

# install python
brew update
brew install python3
 
# install and upgrade some essential packages
pip3 install --upgrade pip setuptools pipenv
 
# optionally install some handy development tools
pip3 install flake8 autopep8 ipython cookiecutter

Installing VSC

https://code.visualstudio.com/download

Essential VSC Plugins

alt

VSC Config

{
    "editor.fontSize": 14,
    "terminal.integrated.fontSize": 14,
}

Install AWSCLI

pip3 install awscli

Then configure your aws enviroment

aws configure
# Follow the on screen instructions and enter your credentials

Getting a RSA Key for yourself

This will be useful for connecting to Github and AWSCodeCommit using SSH.

# Generate Key
ssh-keygen -t rsa

# Enter a passphrase then press enter

# Copy Public Key to Clipboard
pbcopy < ~/.ssh/id_rsa.pub

Github and AWSCodeCommit will require you to paste whats on your clipboard to their respective options page

Git Setup

Adding your username and email.

git config --global user.name "MR X"
git config --global user.email "[email protected]"

Starting a new Python Project

I usually key my projects in a Projects directory in my home folder. I will create a new folder and python enviroment for each project.

cd Projects
mkdir NEWPROJECT
cd NEWPROJECT

pipenv --three
pipenv install pylint --dev
touch .gitignore

Generate a gitignore using the following website and add it into the .gitignore file

vi .gitignore

Paste the contents into the file (after press i to insert content) and exit VIM!

:wq

Launch VSC and open the folder.

Press cmd + shift + p and type select python interpreter Navigate to the newly created enviroment and click on it.

You are ready to code!

comments powered by Disqus