Skip to content

Commit

Permalink
dependencies in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
orso82 committed Oct 2, 2024
1 parent 943642d commit 608095b
Show file tree
Hide file tree
Showing 7 changed files with 602 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ docs/src/act.md
docs/src/act_details.md
docs/src/dd_details.md
docs/src/tutorial.md
docs/src/deps.md
docs/src/deps.dot

# Ignore all juptyer notebooks (you can still force them in with git add -f)
*.ipynb
Expand Down
58 changes: 58 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,64 @@ dev_deps_tree:
AbstractTrees.print_tree(Pkg.project().dependencies["FUSE"]) ;\
'

# @devs
dev_deps_dag:
# Generate a DOT file representing the dependency DAG of the FUSE package
@julia -e' ;\
using Pkg ;\
Pkg.add("AbstractTrees") ;\
using Random ;\
using AbstractTrees ;\
using Printf ;\
edges = Set{Tuple{String, String}}() ;\
function random_color() ;\
r = rand(0:255) ;\
g = rand(0:255) ;\
b = rand(0:255) ;\
return @sprintf("#%02x%02x%02x", r, g, b) ;\
end ;\
function AbstractTrees.printnode(io::IO, uuid::Base.UUID) ;\
dep = get(Pkg.dependencies(), uuid, nothing) ;\
print(io, dep.name) ;\
end ;\
function AbstractTrees.children(uuid::Base.UUID) ;\
dep = get(Pkg.dependencies(), uuid, nothing) ;\
dev_deps = Dict([(key, value) for (key, value) in dep.dependencies if value !== nothing && isdir("../$$(get(Pkg.dependencies(), value, nothing).name)")]) ;\
return sort!(collect(values(dev_deps)), by=x->get(Pkg.dependencies(), x, (name="",)).name) ;\
end ;\
function collect_edges(uuid::Base.UUID, edges::Set{Tuple{String, String}}) ;\
dep = get(Pkg.dependencies(), uuid, nothing) ;\
if dep !== nothing ;\
for subdep in AbstractTrees.children(uuid) ;\
subdep_info = get(Pkg.dependencies(), subdep, nothing) ;\
if subdep_info !== nothing ;\
push!(edges, (dep.name, subdep_info.name)) ;\
collect_edges(subdep, edges) ;\
end ;\
end ;\
end ;\
end ;\
project_dep = Pkg.project().dependencies["FUSE"] ;\
if project_dep !== nothing ;\
collect_edges(project_dep, edges) ;\
end ;\
open("docs/src/deps.dot", "w") do io ;\
write(io, "digraph G {\n") ;\
write(io, "rankdir=LR;\n");\
write(io, "ranksep=0.4;\n");\
write(io, "nodesep=0.1;\n");\
write(io, "splines=true;\n");\
write(io, "node [shape=ellipse, fontname=\"Helvetica\", fontsize=12, penwidth=3];\n");\
write(io, "edge [penwidth=2];\n");\
for (src, dst) in edges ;\
color = random_color() ;\
@printf(io, "\"%s\" -> \"%s\" [color=\"%s\"];\n", src, dst, color) ;\
end ;\
write(io, "}\n") ;\
end ;\
'
dot -Tsvg docs/src/deps.dot -o docs/src/assets/deps.svg

# @devs
develop:
# Develop FUSE and related ProjectTorreyPines packages
Expand Down
7 changes: 6 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ include("$(@__DIR__)/src/act_docs.jl")
# =================== #
include("$(@__DIR__)/src/cases_docs.jl")

# ========================== #
# generate dependencies page #
# ========================== #
include("$(@__DIR__)/src/deps.jl")

# # ====================== #
# # generate examples page #
# # ====================== #
Expand Down Expand Up @@ -193,7 +198,7 @@ makedocs(;
"Actors" => ["List of actors" => "actors.md", "act parameters" => "act.md"],
"Initialization" => ["Init routines" => "inits.md", "ini parameters" => "ini.md"],
"Data Structure" => "dd.md",
"Development" => "develop.md",
"Ecosystem" => ["deps.md", "develop.md"],
"Install" => ["Install FUSE" => "install.md", "on SAGA" => "install_saga.md", "on OMEGA" => "install_omega.md"],
"License" => ["License" => "license.md", "Notice" => "notice.md"]
]
Expand Down
511 changes: 511 additions & 0 deletions docs/src/assets/deps.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions docs/src/deps.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
deps = "ADAS BalanceOfPlantSurrogate BoundaryPlasmaModels CHEASE CoordinateConventions EPEDNN FiniteElementHermite Fortran90Namelists FuseUtils FusionMaterials FuseExchangeProtocol IMAS IMASdd MXHEquilibrium MeshTools MillerExtendedHarmonic NEO NNeutronics QED RABBIT SimulationParameters TEQUILA TGLFNN TJLF VacuumFields XSteam ThermalSystemModels"

txt = String["""
# Dependencies
The FUSE project is built upon multiple Julia packages, many of which reside in the [https://github.com/ProjectTorreyPines](https://github.com/ProjectTorreyPines) organization on GitHub.
![FUSE dependencies](./assets/deps.svg)
"""]
for dep in sort!(split(deps))
if dep in ("Fortran90Namelists", )
continue
end
push!(txt, "* [$dep](https://projecttorreypines.github.io/$dep.jl/dev/) [[repo](https://github.com/ProjectTorreyPines/$dep.jl)]")
end

open("$(@__DIR__)/deps.md", "w") do io
return write(io, join(txt, "\n"))
end
12 changes: 3 additions & 9 deletions docs/src/develop.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
# Development

The FUSE project is built upon multiple Julia packages, many of which reside in the [https://github.com/ProjectTorreyPines](https://github.com/ProjectTorreyPines) organization on GitHub.

## Managing Pull Requests on GitHub: A Collaborative Approach

### Use branches and pull requests
FUSE is a collaborative project that welcomes contributions.

The `master` branch of ProjectTorreyPines repositories is write-protected. This means that even with write permissions to the repository, you'll not be able to push to `master` directly. Instead, we handle updates – be it new features or bug fixes – through branches and Pull Requests (PRs).

A crucial part of our PR process is code review. It is where your peers get to weigh in and ensure everything is up to standard before merging. When you create a PR, think about who on the team has the right expertise for the code you're working on, and assign them as reviewers. Their insights will not only help in maintaining code quality but also in catching any potential issues early. It is all about teamwork and making sure our code is the best it can be!

!!! note
When working on a new feature that involves changes to FUSE and other ProjectTorreyPines repositories, you'll want to use the same branch name across these repositories. For example, if you're working on a branch named `my_new_feature` in both FUSE and IMAS, regression testing will be performed using the `my_new_feature` branches for FUSE and IMAS, along with the `master` branch of the other `ProjectTorreyPines` repositories.

### Code review

A crucial part of our PR process is code review. It is where your peers get to weigh in and ensure everything is up to standard before merging. When you create a PR, think about who on the team has the right expertise for the code you're working on, and assign them as reviewers. Their insights will not only help in maintaining code quality but also in catching any potential issues early. It is all about teamwork and making sure our code is the best it can be!

## How to add/modify entries in `dd`

The `dd` data structure is defined under the [IMASdd.jl](https://github.com/ProjectTorreyPines/IMASdd.jl) package. See the documentation there to how add/modify entries in `dd`.
Expand Down
2 changes: 2 additions & 0 deletions docs/src/tutorial.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# # FUSE Introductory Tutorial

# Download this tutorial from the [FuseExamples repository](https://github.com/ProjectTorreyPines/FuseExamples/blob/master/tutorial.ipynb)

# Import the necessary packages

using Plots # for plotting
Expand Down

0 comments on commit 608095b

Please sign in to comment.