uwhackweek / schedule-2024

Combined Hackweek Schedule for 2024 Event
MIT License
0 stars 0 forks source link

Plenary: From notebooks to packages #23

Open scottyhq opened 2 months ago

scottyhq commented 2 months ago

Lead: Don Setiawan and Romina Piunno Date: 22/08/2024 Start Time: 0900 Duration: 90 Description: All about python packaging

Details

### Learning Outcomes * Understanding of modular, object oriented, python programming * Understanding of the best practice for a scientific software development ### People Developing the Tutorial (content creation, helpers, teachers) Authors: Don & Romina ### Summary Description ### Dependencies (things people should know in advance of the tutorial) Some knowledge of Jupyter Notebook, Git, and Installing python package ### Technical Needs (GPUs? Large file storage? Unique libraries?) N/A, All can be done from scratch

### Tasks
- [ ] Create Python OOP Tutorial
- [ ] Create Simple Python Package Tutorial
lsetiawan commented 1 month ago

@RomiP I've given a bit of thought on this and here's my potential idea for the tutorial

Tutorial Outline

  1. Python OOP and modules tutorial
  2. Exercise: Participants go through their project notebooks and start creating python modules. Outcome: Participants now have python modules and can import directly from the original notebook(s)
  3. Simple Python Package Codebase (src/package)
  4. Exercise: Participants move their modules to the designated src/package_name directory. Now try importing... does this work? ask to troubleshoot, what can we do? Outcome: Participants now understand the struggle and non-reproducible nature of their current setup
  5. Setup package metadata and build config (pyproject.toml), dependencies, and licensing
  6. Execise: Participants create a pyproject.toml and choose a license. Then they pip install current directory. Now try importing from their notebook. Tutorial try to install their package directly from github and see the power of this setup Outcome: Participants now understand the structure of pyproject toml and have a grasp of various common licenses.
  7. Further additions for a full fledged package: documentation, tests, build infrastructure. Demo an already built package.
lsetiawan commented 2 weeks ago

@RomiP what do you think of the above idea? I'd like your input on that. Thanks 😊

RomiP commented 6 days ago

@RomiP what do you think of the above idea? I'd like your input on that. Thanks 😊

@lsetiawan I love the outline. Do we have an update about making the tut 90mins instead of 45? I'm thinking during the tutorial, we live-code our own small package (and example that comes to mind is a phone book). My previous tutorials on OOP seemed to be well-received following this format. Here's some brainstorming following from your outline

1a. Motivate use of OOP and packaging 1b. Define OOP 1c. Draw out UML style pictogram of phonebook (Attributes: contacts; Methods: add contact, remove contact). To demonstrate inheritance, "contact" will be an abstract class (Attributes: Name, phone number), child classes will be "personal" so this is a friend that also has a "birthdate", or "professional" this is a business that offers a "service" (e.g. electrician) 1d. Implement these classes live (maybe have starter code depending on time constraints)

  1. Exercise

  2. Simple Python Package Codebase (src/package)

  3. Exercise

  4. Setup package metadata etc. but do this using the phonebook code we wrote live

  5. Exercise

  6. Additions - we can again demo using our phonebook code but write tests and things beforehand to save on time

JessicaS11 commented 3 days ago

@lsetiawan @RomiP We've extended this tutorial to be 90 minutes instead of 45. We're excited about the hands-on nature enabling participants to apply the content to their ongoing projects. As a side note: we'd also like to make sure we have enough helpers familiar with this workflow to help participants during the interactive portions.