CISCO DevNet - Coding & API's

https://developer.cisco.com/startnow/#coding-apis-v0

Setting Up Dev Workstation - Windows Setup:

GIT and git-bash

  • Install GIT on Windows Laptop

    • Navigate and download GIT to your computer

    • Click on the "Windows" icon and once downloaded, install using default and with the following considerations.

      • Consider checking the box to add "Additional Icons > On the Desktop"

      • Consider changing the default text editor for Git to another option, if you have one available. For example, Notepad++

    • Open git-bash using Desktop or Start menu shortcut and verify all is working OK

      • run the following commands to test

        • git --version

        • git clone https://github.com/CiscoDevNet/hello_network

Terminals and Shells

The git-bash shell interpreter for Windows was installed along as part of the git install done previously. Lets run a script:

cd /hello_network ./network.sh Hello World!

Python and Nodejs

  • Open a git-bash terminal and verify if Python installed OK

  • py -3 -V

  • Python 3.9.2

Note: To open an interactive Python interpreter you can typically just use the command python at the command prompt. Within git-bash you need to use the command python -i to explicitly start the iinteractive interpreter.

Python Virtual Environments

A Python installation may not meet the requirements of every application. If application A needs v1 of a particular module and application B needs v2 - then we have problems as only ONE of the 2 applications will work, not both as required. This is where virtual environments come in. Application A can have its own virtual environment wctith v1 installed and application B will have its own virtual environment with v2. If B needed to be upgraded to v3 it wont affect application A.

To create a VE, decide upon a directory where you want to place it and run the venv module as a script with the directory path:

python3 -m venv mynamed-placethis will create the mynamed-place directory if it doesn't exist. A common directory location for a VE is .venv. This name keeps the directory typically hidden in your shell and thus out of your way. It also prevents clashing with .env environment variable definition files that some tooling supports.

To ACTIVATE this environment source mynamed-place\Scripts\activate (This script is written for the bash shell. If you use the csh or fish shells, there are alternate activate.csh and activate.fish scripts you should use instead.)

Look for the name of the virtual environment to be enclosed in parenthesis after activation.

Test that Python is linked to the venev and we can see above it is :)

We will now deactivate that test mynamed-place venv

deactivate

Installing Nodejs

  • Download nodejs and download the "Windows Installer"

  • Open git-bash terminal

  • Check the installed version

    • node -v

Last updated