Skip to content

patsteph/beginnings

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 

Repository files navigation

Beginnings

This is just a playground to get familiar with what you need for the other course we are working on. This is meant to be a place to learn, test coding, help each other, and above all else HAVE FUN! It could be said that the number one skill you need as a modern developer is how to effectively use source control. As git (and GitHub) are the most widely used tools in modern development, investing the time to become a power user of these tools is critical for your success. I hope you enjoy the tasks and embrace the platform for a different type of collaboration.

The Ingredients

Team Members

Tools2Use


The Recipe

Prepping your environment

First things first lets make sure you have a Github account. Click HERE to get a github accont. Be sure to chooose a name you want to be around forever and also to secure it with a good password.

Now that you have an account what can you do with Github? Well thats a little out of scope for what we are doing however this is a good guide to get started with Github.

Since you have Github installed and spent 3 whole minutes perusing the quickstart guide before being bored you are now ready for a installing some software.

The first thing we need if we are going to be working with code is a code editor. For the sake of this work we will be using Vissual Studio Code. There are quite a few code editors oout there and whiel they are all good and customizable we will be using Visual Studio Code for our work. If you want to look into some other vode editors I have compiled a few other options for you.

  • Brackets A good editor from Adobe BUT they are discontinuing it in Septemeber of this year. Maybe Dan can talk to them about keeping it around. 😄
  • Atom Another really cusstomizable eidtor and this one is made by Github.
  • Notepad++ Windows only editor that has a cult following and gets love from everyone for being a great free editor.

To install Visual Studion code you click HERE and follow the platfrom specific instructions.

Now that that is done, select your platfrom from below for some more things to install.

PC Instructions

Did you click that? Are you mad now? It is a joke. 😆 (do you really have a PC)

Mac Installation

Step 1. Install Xcode on your Mac. Once it is installed move on to step 1a. Step 1a. Open Terminal and type the following:

xcode-select --install

Step 2. Run the following command to install Homebrew on your Mac.

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Step 3. Now we need to update the stock Python on the Mac from 2.x to 3.7. Let's run this in terminal to update Python.

brew install python

Step 4. Now we are getting somewhere. BTW PIP should have been installed with Homebrew but we can update it with the following command from terminal.

python -m pip install -U pip

Step 5. (Optional) If your python is showing as 2.7 instead of 3.x then manually set the python version to 3.9.

ln -s -f /usr/local/bin/python3.9 /usr/local/bin/python

After you run this command you have to quit terminal and relaunch to check the version.

python --version

We should have all the software we need to get started. Now we are going to move onto Challenge 1.

Challenge 1

Hello World

Build and run a Python script (Hello World), ensuring to use a virtual environment to do it per pluralsight course on setting up a workspace and using PIP all using Visual Studio Code.

Challenge 2

Local to Git

Create a new git repo locally, commit your script to it and push it to a new repo on Github.

Challenge 3

Build as a team - Forking

Step 1. Fork this reposiory.(You are already looking a the README.md so you are on the right site to fork, but just to make sure and look in the URL for github.com/GESWCollab/beginnings Once you fork the repository you will see it has all the ssame components as this main site but it will be in your github environment. Example: I forked the repository logged in as me and it creates https://github.com/patsteph/beginnings

Now lets get the file local so we can work on it.

cd ~/coding
git clone https://github.com/<YOUR GITHUB USER>/beginnings

Change into that local directory and make sure you see the README.md file.

cd beginnings
ls -la

Now that you know the file is there lets open it with Visual Studio code and make some Markdown changes.

In Code click File --> Open... Navigate to your coding/beginnings folder and select the README.md file.

Once the file opens find the Team Members section and add your name and email with appropriate formatting. Now that you have it updated we need to push it back up tot the cloud.

git add README.md
git commit -m "Added <your name> to README file"
git push

You have now written a code change but that code is only in your FORK of the repository, not the original repo. We can ask that the ppstream repository to "PULL" our changes into it by opening a "Pull Request"

In GitHub in your repository, click the "New pull request" button

You'll be given a chance to view the changes, and then click "Create pull request" Be sure and add a note with it so I know what I am pulling into the main repo.

After opening, you'll be taken back to the PR list on the upstream repository.

Challenge 3 Alternate

We can actually do all the Forking exercise on the web as well. Here are the Alternate instructions.

First make sure you are logged in (upper right corner) and then click the Fork button below the login area.

Fork Repo

Now you will be switched over to your forked (copy) version of the main repository. Notice it says my Github username and not GESWCollab.

My Forked Repository

In the center of my Readme.md page on the right side there is a pencil. Click that.

Forked Readme md

Once in the editor mode you can see all the Markdown language and you can go edit to insert your name and email information. (You can also preview changes before commiting)

Readme md editor

Now that I have edited the Readme.md I want to put a note on the commit for WHY I did something to the code. This is a simple name change or add but in real code it could be a bug fix.

Commit Message

After I click Commit changes, my screen will change back to non editor mode and I will see the note from my commit as a message letting me know what has been done. Again not a huge thing when you are working on your code and making a small change like name update but on a larger team with many people making fixes and changes it is a nice to know.

My Commit shows

Now that I have updated code in my Forked repository I need to let the main project know that I made updates and let them decide if they want that in their main code base. I need to create a Pull Request.

Create Pull Requests

Once I create the Pull request it opens up to a semi-confusing page but it is basically saying I want my changes to go to the main project code base. I have indicated the "from" and "to" fields in the picture. You can also see that handy note about WHAT I changed in the Commits section below.

Compare Pull Request

Now I get a chance to add comments on what I did and why.

Pull Request Detail and Comments

This picture is from the main GESWCollab repositry and it tells me someone made changes and it shows me their comments and lets me know that there is no code conflicts so it is safe to merge. I trust myself so I will merge. 😉

Pull Request Detail Merge View

Once the code is merge the page will refresh and I will see that there is a merge comment at the top of the age and since we were editing the Readme.md which is displayed on this page we will see my edits.

It Worked!!!

Great Job! We will work on some autmatic ways to compare and merge in a later Challenge so that we can skip some of this stuff.

Challenge 4

Why dont we try working on some Python code specific to our endpoints. Chris had posted this in our Webex space. Lets get a copy of the xAPI over WebSockets Library and work with it on our local machine. The main github site for this library is here PYOWS.

git clone https://github.com/cisco-ce/pyxows.git

Now that you have your own copy you can work on it. Navigate locally to your pyxows directory. Once in your pyxows directory run the setup script.

python setup.py install

Now install the async library.

pip install asyncio

Challenge 5 Coming Soon!

Challenge 6 Coming Soon!

What are some other things we could create in this way?

Releases

No releases published

Packages

No packages published