Week 1 - Principles and Practices




Assignment



Principles and Practices (part 1 of 2)

  • Plan and sketch a potential final project

Project Management (part 2 of 2)

  • Read, sign (add your name to) the student agreement and commit it to your repo.
  • Work through a git tutorial.
  • Build a personal website in the class archive describing yourself and your final project. Refer to the lecture material for examples.
  • Upload parts 1 and 2, to the class archive.

From Assignment Details




Ideas

  • Idea 1 - 3D Printing on a Normal 2D Printer,
  • Idea 2 - Peripherals for BioGun Extruder,
  • Idea 3 - A Big Plotter,
  • Idea 4 - Ghost Bus Stop,
  • Idea 5 - 3D Printer exclosure.
  • Idea 6 - Cat Academy Projects.
  • ...Detail on Final Project Development Page

Student Agreement

Git

I have a little experience with Git. I maintain this Gitbook instance for our Fab Lab, and we use a GitBook/Markdown workflow, that I will continue to use in Fab Academy.

Setting Up Git

I am on a MacBook, using Terminal and ZSH, with Git already installed.

I added SSH keys to GitLab. Generated Public/Private keys: ssh-keygen -t rsa -C "$your_email". Useful command (Mac Only): cat ~/.ssh/id_rsa.pub | pbcopy.

And I configure my local user so that I can make pushes to GitLab, as follows.

git config user.name "Your Name"
git config user.email "your.email@example.com"

I hadn't used Mkdocs. I read the Mkdocs documentation and, additionally, Madrus' documentation. In case it overwrote everything, I kept the templated htmls, see the cp command below.

git clone {{repository link, SSH}}
cd repo
cp -r public/* old
mkdocs new

As it was mentioned in the Week 1, I first used the python http server. But reading about mkdocs build and mkdocs serve in the MKDocs documentations I started using them instead.

Issue number 1 - I'm on a Mac. MacOS already has Python, but the system's python isn't the same...

From Madros' blog also:

Installation on MacOS

When you’re running the pre-installed version of Python on macOS, pip tries to install packages in a folder for which your user might not have the adequate permissions. There are two possible solutions for this:

Installing in user space (recommended): Provide the –user flag to the install command and pip will install the package in a user-site location. This is the recommended way.

Switching to a homebrewed Python: Upgrade your Python installation to a self-contained solution by installing Python with Homebrew. This should eliminate a lot of problems you may be having with pip.

So, basically, I replaced python with python3 whenever it came up, and pip with pip3, and added /usr/bin/ for safe measure. Sometimes I think something is installed globally, but, for the above reasons, it is not seen by the instance of python I am using.

Issue Number 2 - GIT RESET

At some point, I had to do a git reset command. It wasn't clear to me, what the different arguments meant. Clarified a bit better for me in this Stack Overflow. I used a Hard reset, which put me back a little bit too far, but only had a few steps to redo.

I was in the habit of using git add ., so I added a .gitignore file to keep from accidentally staging a few things in future:

echo "site/" >> .gitignore
echo "*/.DS_Store" >> .gitignore

The Zed Editor is new to me (former Atom and Sublime Text user, so immediately familiar). I had ZSH, Oh-My-Zsh and various Aliases before the start of Fab Academy. Most useful is gup 'comment', which adds changes, commits and pushes in one go. I keep forgetting to build before committing, so probably need to update this command.

I used aliases in my workflow

From nano ~/.zshrc:

alias serve="mkdocs serve" 
alias build="mkdocs build"
alias ga="git add ."
alias gc="git commit -m"
alias gp="git push --all"
alias serve_old="/usr/bin/python3 -m http.server 8000"
alias open="/usr/bin/open http://127.0.0.1:8000/public/"

Ok, so next, you can chain commands in a single alias using ; (From Stack Overflow, posted by @simont). But, in order to take an argument, you have to create it as a function. These follow the format:

some_function() {
    if [-z "$1" ]; then
      echo "don't forget to include your comment"
      return 1
    fi
    echo "thnks xoxox"
}

Git Ignore

TODO: Make a Git Ignore File, add "DS_Store", etc, and "_site"

VENV

Python Virtual Environment. On a Mac System Python Makes a problem

python -m venv ./fab.venv

source ./fab.venv/bin/activate/ (replace with location of venv folder)

ChatGPT Logs

I used ChatGPT to write a bash script and list all filenames within a directory (to prepare links to use in MarkDown).

Script Screenshot

Log File


I used ChatGPT to figure out why installed themes weren't loading. I guess it was because Homebrew-installed Mkdocs is different than system python and user python. Having Homebrew install the theme instead of Pip was the fix.

Log File