swe4py
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # "Software Engineering Practices with Python" Course Preparation "loose guideline": Follow the order in which concerns pop up when starting a new project. ## Submitted Repos - https://github.com/GridTools/gt4py, standard reasonably organized big pure python project, uses uv - https://github.com/GridTools/icon4py, monorepo with all complications, uses uv - https://git.cscs.ch/ws-dwdi/job_reporting, mixed levels of static checking, python primarily as glue code (?) - https://github.com/spcl/dace, all kinds of wild stuff in there, good old setup.py - https://github.com/GridTools/jace - https://github.com/C2SM/Sirocco, young project, uses hatch - https://github.com/arbor-sim/arbor/blob/master/pyproject.toml, example for scikit-build usage NOTE: keep in sync with published agenda in Confluence! https://confluence.cscs.ch/x/0JKYMw ## DAY 1 (Foundational Breadth) (Red / Orange) ### MORNING (9:30 - 12:30 w/ 15 mins break) - Basic Python environment configuration (30 mins) (enrique, rico, tomas) - Python runtime * Configuration: env variables, `sys.path`, site-packages, `.pth` files, ... PYTHONPATH * Running scripts vs modules (-m, effects on interpreter and sys variables) - Environment management (seek for hands-on / interactive stuff for after lunch) * example of version clash if there's no venvs * can you run different python/lib versions - **EXERCISE** - Create and activate an environment (to use in later exercises) - Create 2 different environments with 1 python versions - Quick introduction to other options available in the ecosystem (but we'll not covered them in detail) - Conda (why? differences?) - uv - spack (why) - Setting common Python ground (1h45) (enrique, tomas, rico) rotate enrique / tomas - The Object Model * Mention: Annotations have no effect at runtime * What is an object? Everything! * Mental model for variables (with handout) w.r.t memory model * Scopes w.r.t variables usage * `__magic_methods__` - Attribute access * Nothing is actually private, embrace it! * attributes & properties vs variables - **EXERCISE** `instance.attr` is really running code, not simple data access - [Imports](https://hackmd.io/Hm08vRY6QmSiQd8oLGleVQ) * Robust mental model for what import does (with handout) * Remember imports have side effects (don't import *) - **EXERCISE** - spot the problem with broken import? - import cycle - monkey patching (import foo vs. from foo import bar) - 30 mins buffer ?? ### AFTERNOON (13:30 - 17:00 w/ 15 mins break) - Advanced configuration of Python Environments (1h15) (ricoh, enrique, tomas) - Installing and using Packages * git clone + pip install * External packages installation: `pip` and other frontends, editable installation, installation from VCS, version constraints, freezing dependencies - Basic package creation ?? - **EXERCISE** - Collaboration (2h) (rico, enrique, tomas) rotate presenter / co-presenter * organize a project (lib vs apps?) * IDE-agnostic dev setting sync * Linting and typing (static analysis) * Packaging for collaboration * Project Management * **EXERCISE** * Setting up a pipeline with linting? or * Pushing to a repo with a pipeline without breaking (or fixing) typical collaboration issues * Typing exercises -> maybe run mypy on code developed without it or show off some pros for collab ? ## DAY 2 (Engineering & Collaboration Depth) (Orange and Up) ### MORNING (9:00 - 12:30 w/ 15 mins break) - Testing (1h45) (tomas, rico, enrique) * Creating Testing Environment consistency (i.e. local dev / CI parity) * Writing testable code: dependency injection principle, single-purpose * Writing test best practices with Pytest examples * Mocking and stubbing (connecting to import mental model) * **EXERCISE** * Remove repetitions with pytest fixtures? or * Test a composed function mocking its dependency? * Adding coverage to a project with tests? * Adding tests to a project with no tests? * Paralellization of tests execution - Pythonic Patterns Thought-provoking Demo + Q&A (1h30) (rico, tomas, enrique) <!-- find cheat-seet of patter people can look --> * open-closed dos and don'ts (e.g. respecting public interfaces) * list comprehensions instead of c-like fors * generators (iterables) vs lists (yield!) * dataclasses instead of structs (and extensions with runtime checking) * attr vs class attr vs descriptors vs methods ?? * decorators & contextmanagers * exceptions handling (raise&catch) for good citizens ### AFTERNOON (13:30 - 16:30 w/ 15 mins break) - Advanced Python Features a-la-carte (45 min) * metaclasses * alternatives: __init_subclass__() * code in class bodies (e.g. spack) * generated code * pdb + object inspecting with dir et. al * buffer protocol * optional: DLPack * optional: how to use with custom C/C++ cpython extensions - **EXERCISE** (??) - Find improvements to submitted code repos where patterns/advanced features can be applied? - https://github.com/C2SM/Sirocco + guidance where to look for improvements - work in groups, if available with BYO code - Advanced Use-cases break-outs - AI "copilot" tips exchange - async, multithreading, multiprocessing? - compiled extensions - benchmarking?? --- ## Topics for next one! - Profiling - Debuging

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully