Workflow
Published September 1, 2024
I enjoy pursuing a better workflow. I believe what looks good is good. I mean if a workflow is simple, smooth, something beautiful, then it is a good workflow for me. Often I can get stuck with too many tributaries to the project's river. So many frayed threads begging for attention before I can weave anything into a rope.
I have an idea to automate announcements to my class. Often I want to tell the class something, and I have to log onto the school's LMS, Canvas. I have two classes with two sections each. After finding the class, clicking on announcements, and posting the message, I have to copy it to the other class. I want to reduce this to one script.
Where to start? I'll use the power of AI to help me, of course. I am not a programmer. One of the threads or tributaries to this idea is where to begin. Should I write a Word document, a text file, create a project folder, or use Git and GitHub? I have started with this blog entry. I want to learn about my creative workflow by writing about my creative workflow.
In my context, I am aware that I am going to teach an intro to Python Programming class this semester. And I am focused on strengthening the core skills of the business school student body. With this context in mind, I'll choose to use Git and Github.
Github
I have an account, and I am logged in: https://github.com/gregdyche
A repository is a project (if I understand correctly), so I'll create a repository, canvas_announcements. I go with public, add a README, and wonder which license if any I should use. I decide to skip the license decision for now. Click create repository.
Github will act as my shared cloud project folder and so much more, but what am I going to use to write my python script? I'll likely encourage my students to use Jupyter Notebooks since they are used so widely in data work.
Jupyter
It appears Jupyter has two options: JupyterLab (newest interface) or Jupyter Notebook (classic interface). I'll ask Gemini, Google's AI tool, which I should choose.
prompt: I'm a university professor needing to automate announcements posted to a canvas lms. I want to use python and Jupyter as my main tools. I am also going to teach sophomore students the basics of python, and I'll use this project as an example in class. Should I start with JypyterLab or Jupyter Notebook?
answer: AI is always a little too long winded for my taste, so I'll spare you the word for word response. The basic idea is to use the "classic" Jupyter Notebook and then transition to JupyterLab once the students are comfortable.
I agree; Jupyter Notebook it is.
While I am a big believer in environment management (virtual contexts to each program), I'll go with the straightforward installation using pip since it will be closest to where I start with students.
It worked, but I did see a message about upgrading a portion to avoid some trouble.
pip install -U "jupyter-server<2.0.0"
This worked without error. Moving on.
Tips:
How to start Jupyter Notebook (the tool, not the project)? At the command prompt:
jupyter notebook
Jupyter opens the default web browser to a local web page running the notebook. The terminal window will give you a URL to access the notebook. Copy this and save for later. The default URL for my installation is http://localhost:8888/tree.
Next, I'll check out the documentation to refresh my memory on how to get started and use Notebooks: https://jupyter-notebook.readthedocs.io/en/stable/notebook.html
All Notebooks are plain text JSON files that end with .ipynb. I ask Gemini what the ending stands for: Jupyter Notebooks started out as part of the iPython project, so we get "i - py - nb", iPython Notebook. It isn't important, but I like knowing what the acronyms mean.
How to create a new notebook?
"New Notebook
" button in the Jupyter Notebook web window that started.
In my version, it is a drop down button on the right corner of the "files" tab. I selected Python 3 (ipykernel). The documentation is excellent, and I'm not going to copy and paste the contents -- save you and I some confusion.
How to save, stop, and reopen a notebook?
Good news: it autosaves, but just in case, there is a little disk icon under the file menu that will save and checkpoint your work.
Click "File" and select "download as" and pick "Notebook"; that's the .ipynb file.
Next: click "file" and select "close and halt" to stop the kernel from running.
In the terminal window that's still running the Jupyter process, type control-c to stop it.
GitHub again
Now I'm going to upload the few files I care about to GitHub for safe keeping. I'll work on versions and upload changes as I make them.
Remember the README I created earlier? It's empty, so I'll put a short message there first. I only have the empty notebook for now, and I'll upload that next. From the repository GitHub web interface, click the "+" (plus) symbol to upload the .ipynb file that was downloaded when the Notebook was shut down for the day.
Next Time
I've made a couple of structural decisions: Jupyter Notebooks and Github, and I have an empty file and an empty repository created. I have added this project to my list. Now I need to go mow the grass.