Skip to content

Tips for developers

Kipton Barros edited this page Sep 3, 2024 · 41 revisions

Communication

Before you start working on something, please send a message to #developers channel on the Sunny Slack server.

Style

We mostly follow the BlueStyle guidelines: https://github.com/invenia/BlueStyle, but with flexibility in spaces around binary operations (e.g. a*x + b).

Other tips

Previewing docs on a PR

Github actions will build and host docs for each PR in progress. To find the link, navigate to "Checks passed" on a PR, go to "details", and click on the "deployed" action.

Tagging a release

We're using TagBot, so the steps are simple:

  • Review changes and mark the release date in docs/src/versions.md.
  • Open the latest commit on github and add a comment, @JuliaRegistrator register. TagBot will respond with a comment on that same commit.

New version should appear on JuliaHub in 15 minutes.

For this to work, you must be a public member or owner of the SunnySuite org. See Github instructions to change user visibility.

Afterwards, remember to increment the version = "X.X.X" line in the Project.toml file and update versions.md.

Triggering contributed-docs rebuild

Click on the green check on the line with the last commit info. This brings up a dropdown, one line of which is "Documentation." Click the "details" link on that line, which brings up details about the build. There's a button to rerun the job on the upper right.

Temporary environments

It can be convenient to have an environment with different package versions, e.g.

activate @sunny-stable
add Sunny, GLMakie

To create an environment with development Makie:

activate @makie-dev
dev Makie

then go to ~/.julia/dev/Makie and switch to desired branch git checkout <branch>, then back in Julia package manager,

dev MakieCore GLMakie WGLMakie

Adding coauthors to commits

It is possible to add co-authors to a Github PR by adding a trailing line to the squashed commit message. Figuring out the precise line to add is tricky. This blog post provides a script, which you might call gcoauthored:

#!/bin/bash

account=$1
data=$(curl -s https://api.github.com/users/$account)
id=$(echo $data | jq .id)
name=$(echo $data | jq --raw-output '.name // .login')

printf "Co-authored-by: %s <%d+%[email protected]>\n" "$name" $id $account

Or copy-paste from here:

Co-authored-by: David A. Dahlbom <[email protected]>
Co-authored-by: Sam Quinn <[email protected]>
Co-authored-by: Harry Lane <[email protected]>
Co-authored-by: Hao Zhang (张浩) <[email protected]>
Co-authored-by: Xiaojian Bai <[email protected]>
Co-authored-by: AlinNiraula <[email protected]>
Co-authored-by: BhushanThipe <[email protected]>

Planned breaking change

  • Rescale LL damping $\lambda \to \lambda / S$ for consistency with SU(N).
  • minimize_energy! should require a number of iterations.
  • If only a spacegroup number is provided, require symmetry ops from standard spacegroup setting (ITC).

Docs for older versions

For Sunny versions 0.4.3 and later, JuliaHub hosts historical documentation builds: https://docs.juliahub.com/Sunny/atBCQ/

The is a dropdown on the bottom left of the page allowing to select the desired Sunny version.

For Sunny versions prior to 0.4.3, we can give users these instructions:

] add [email protected]

# From Julia
using Sunny
pkgdir(Sunny)        # find location SUNNYPATH

# From terminal
cd SUNNYPATH/docs
julia --project=@.   # load Julia with 'docs' activated
] instantiate        # find packages for old Sunny version
include("make.jl")   # build the docs

# open SUNNYPATH/docs/build/index.html in browser

Modifying git remotes

Add a remote, e.g.,

git remote add lzr https://github.com/Lazersmoke/Sunny.jl.git
git remote add haophys https://github.com/Hao-Phys/Sunny.jl.git

Remove a remote, e.g.,

git remote rm lzr