$30 off During Our Annual Pro Sale. View Details »

PAHFIT HackDay Open-Dev Model

Karl Gordon
January 08, 2021

PAHFIT HackDay Open-Dev Model

Intro for PAHFIT code development model (11 Jan 2021)

Karl Gordon

January 08, 2021
Tweet

More Decks by Karl Gordon

Other Decks in Science

Transcript

  1. Open-Development Techniques
    PAHFIT HackDay
    11 Jan 2021
    Karl D. Gordon
    Astronomer at STScI
    [email protected]
    @karllark2000
    karllark@github
    “Have Dust – Will Study”
    Image source: https://github.blog/2015-07-29-git-2-5-including-multiple-worktrees-and-triangular-workflows/

    View Slide

  2. Distributed Coding

    Geographically, temporally distributed

    Astropy Affiliated Package

    Github

    View Slide

  3. Astropy Affiliated Package

    http://docs.astropy.org/en/stable/development/af
    filiated-packages.html

    Take advantage of the community knowledge of
    how to do distributed/social code development

    View Slide

  4. View Slide

  5. View Slide

  6. Github

    Social coding

    Provides an easy to use user interface to git
    – Git = version control for tracking changes

    Manage development via issues

    Fork-Clone-Pull model

    View Slide

  7. https://github.blog/2015-07-29-git-2-5-including-multiple-worktrees-and-triangular-workflows/

    View Slide

  8. https://github.com/sf-wdi-21/notes

    View Slide

  9. View Slide

  10. View Slide

  11. Issues

    Centralized location for code management

    Allows for anyone anywhere to keep up-to-date

    Anyone can raise an issue

    Anyone can comment on an issue

    All work should be tracked via an issue
    – Avoids multiple people working on the same thing

    Issues assigned to specific people
    – Others can contact and coordinate

    View Slide

  12. View Slide

  13. Fork-Clone-Pull Model

    Everyone forks the master repository

    When updated code/docs/etc ready, issue a pull
    request to master repository
    – Identify the issue(s) this pull request addresses

    Review and discussion of pull request

    Pull request approved → code merged

    View Slide

  14. View Slide

  15. Who is contributing?

    View Slide

  16. Work needed - Issues

    All work this week needs an issue
    – Gets us into the habit
    – Central organization
    – Allows remote participation
    – Keeps track of work

    Major Areas
    – Code, cleanup and enhancements
    – Documentation, more and setup with readthedocs
    – Testing, more and setup with travis
    – Build, setup and test
    – Logo?

    View Slide

  17. Github Details

    View Slide

  18. How to Fork

    https://help.github.com/articles/fork-a-repo/

    On github, got to the master PAHFIT repository
    – Find the fork button
    – Makes a copy of the repository in your github area

    View Slide

  19. Clone the fork to your computer
    (& setup sync to master)

    In your github area, find the code button

    On command line in the directory you want the copy
    – git clone [email protected]:YOURGITNAME/pahfit.git

    Configure your clone version to sync with master BEAST version
    – In the github master BEAST respository
    – Find the clone button
    – Goto the directory with your clone version
    – git remote add upstream [email protected]:PAHFIT/pahfit.git

    View Slide

  20. Clone the fork to your computer
    (& setup sync to master)

    In your github area, find the code button

    On command line in the directory you want the copy
    – git clone [email protected]:YOURGITNAME/pahfit.git

    Configure your clone version to sync with master PAHFIT version
    – In the github master PAHFIT respository
    – Find the clone button
    – Goto the directory with your clone version
    – git remote add upstream [email protected]:PAHFIT/pahfit.git

    View Slide

  21. Syncing your fork

    https://help.github.com/articles/syncing-a-fork/

    Get updated files from the pahfit master
    – Do this when when appropriate (e.g., starting new branch)

    In directory of clone on your computer
    – git fetch upstream
    – git checkout master
    – git merge upstream/master

    If you only update your master this way, life will be easier

    View Slide

  22. Branch your fork

    https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-bra
    nch-with-git-and-manage-branches

    Branches make it easy to manage work
    – Can have multiple branches and switch between them
    – New branch for a new issue

    In directory of clone on your computer
    – git checkout -b new_branch_name
    – git push origin branch_name → send to github
    – git branch → show branches on computer
    – git checkout branch_name → switch to that branch

    View Slide

  23. Work on your branch

    Make changes, commit, repeat

    Test!
    – >>> tox -e test

    Build the docs
    – >>> tox -e build_docs

    Push to github

    View Slide

  24. Generate a Pull Request

    On github

    View Slide

  25. Pull request

    View Slide

  26. View Slide

  27. View Slide