Skip to content

Commit a456bba

Browse files
committed
Hide plotting behind @requires
1 parent 2a2ba37 commit a456bba

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ version = "0.1.0"
77
CrystalInfoFramework = "6007d9b0-c6b2-11e8-0510-1d10e825f3f1"
88
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
99
FilePaths = "8fc22ac5-c921-52a6-82fd-178b2807b824"
10-
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
1110
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1211
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
1312
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
1413
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
1514
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
1615
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
16+
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1717
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
1818
Spglib = "f761d5c5-86db-4880-b97f-9680a7cccfb5"
1919
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

src/Sunny.jl

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module Sunny
44

5+
using Requires
56
using LinearAlgebra
67
using StaticArrays
78
using OffsetArrays
@@ -17,15 +18,6 @@ using FilePaths: Path
1718
using CrystalInfoFramework
1819
import Spglib
1920

20-
# Make best effort to determine if this is a headless machine -- A non-Apple
21-
# Unix (e.g. Linux) without the DISPLAY environment variable set.
22-
const _headless = Sys.isunix() && !Sys.isapple() && !haskey(ENV, "DISPLAY")
23-
@static _headless ? (
24-
check_graphics_available() = error("Graphics functions are unavailable on a headless machine.")
25-
) : (
26-
using GLMakie; check_graphics_available() = nothing
27-
)
28-
2921
# TODO: Remove in Julia 1.7
3022
using Parameters: @unpack
3123

@@ -73,15 +65,20 @@ include("StructureFactors.jl")
7365
export StructureFactor, update!, apply_dipole_factor, zero!
7466
export dynamic_structure_factor, static_structure_factor
7567

76-
include("Plotting.jl")
77-
export plan_spintraj_fft!
78-
export plot_lattice, plot_spins, plot_bonds, plot_all_bonds
79-
export anim_integration, live_integration, live_langevin_integration
8068

8169
include("WangLandau/BinnedArray.jl")
8270
export BinnedArray, filter_visited, reset!
8371

8472
include("WangLandau/WangLandau.jl")
8573
export WangLandau, spherical_cap_update, init_bounded!, run!
8674

75+
function __init__()
76+
@require GLMakie="e9467ef8-e4e7-5192-8a1a-b1aee30e663a" begin
77+
include("Plotting.jl")
78+
export plan_spintraj_fft!
79+
export plot_lattice, plot_spins, plot_bonds, plot_all_bonds
80+
export anim_integration, live_integration, live_langevin_integration
81+
end
82+
end
83+
8784
end

0 commit comments

Comments
 (0)