Skip to content
This repository was archived by the owner on Dec 30, 2025. It is now read-only.

Commit f2e87c4

Browse files
Improve explicit imports hygiene
- Remove unused runtime dependencies (ModelingToolkit, NonlinearSolve, QuasiMonteCarlo, SparseArrays, Symbolics) - Make LinearAlgebra imports explicit (norm, I) - Remove broken/incomplete code from utils.jl - Clean up test dependencies, remove unused packages - Make test imports more explicit where possible - Add ExplicitImports.jl tests to verify import hygiene Files modified: - Project.toml: Reduced to only LinearAlgebra dependency - src/FastSolvers.jl: Explicit imports from LinearAlgebra - src/utils.jl: Removed broken sample_collocation_points function - test/Project.toml: Added ExplicitImports, removed unused deps - test/runtests.jl: Made imports more explicit - test/explicit_imports.jl: New file for CI import checks 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 53f0d81 commit f2e87c4

File tree

6 files changed

+18
-70
lines changed

6 files changed

+18
-70
lines changed

Project.toml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
name = "FastSolvers"
22
uuid = "afc03370-3a10-4444-b401-158123c3c69f"
3-
authors = ["Anant Thazhemadam <anant.thazhemadam@gmail.com>"]
43
version = "0.1.0"
4+
authors = ["Anant Thazhemadam <anant.thazhemadam@gmail.com>"]
55

66
[deps]
77
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
8-
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
9-
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
10-
QuasiMonteCarlo = "8a4e6c94-4038-4cdc-81c3-7e6ffdb2a71b"
11-
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
12-
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
138

149
[compat]
1510
LinearAlgebra = "1.10"
16-
ModelingToolkit = "9.20.0"
17-
NonlinearSolve = "3.13.1"
18-
QuasiMonteCarlo = "0.3.3"
19-
SparseArrays = "1.10"
20-
Symbolics = "5.32.0"
2111
julia = "1.10"

src/FastSolvers.jl

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
module FastSolvers
2-
using SparseArrays
3-
using NonlinearSolve
4-
using LinearAlgebra
5-
using QuasiMonteCarlo
6-
7-
import QuasiMonteCarlo.SamplingAlgorithm
8-
import QuasiMonteCarlo.sample
9-
10-
import ModelingToolkit.PDESystem
11-
import ModelingToolkit.Equation
2+
using LinearAlgebra: norm, I
123

134
include("utils.jl")
145

src/utils.jl

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1 @@
1-
function sample_collocation_points(
2-
domain::T, num_points::Tuple{Int, Int}, sampler::SamplingAlgorithm) where {T}
3-
d = length(domain)
4-
ni, nb = num_points
5-
6-
# Sample interior points
7-
lb = []
8-
ub = []
9-
for i in 1:d
10-
push!(lb, domain[i].left)
11-
push!(ub, domain[i].right)
12-
end
13-
interior_points = sample(ni, lb, ub, sampler)
14-
15-
# Sample boundary points
16-
nbcs = length(bcs)
17-
nb_local = floor(Int, nb / nbcs)
18-
boundary_points = []
19-
for j in 1:nbcs
20-
mask = []
21-
bcs_local = bcs[j]
22-
for i in 1:d
23-
if typeof(bcs_local.lhs.arguments[i]) != SymbolicUtils.BasicSymbolic
24-
push!(mask, i)
25-
end
26-
end
27-
lb_local = lb[mask]
28-
ub_local = ub[mask]
29-
push!(
30-
boundary_points, QuasiMonteCarlo.sample(nb_local, lb_local, ub_local, sampler))
31-
end
32-
return interior_points, reduce(vcat, boundary_points)
33-
end
34-
35-
function LinearAlgebra.UpperTriangular(a::Float64)
36-
return a
37-
end
1+
# Utility functions for FastSolvers

test/Project.toml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
[deps]
2-
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
3-
DomainSets = "5b8099bc-c8ec-5219-889f-1d9e522a28bf"
2+
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
43
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
5-
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
6-
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
74
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
8-
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
95
QuasiMonteCarlo = "8a4e6c94-4038-4cdc-81c3-7e6ffdb2a71b"
106
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
117
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
128

139
[compat]
14-
DomainSets = "0.7.14"
15-
ModelingToolkit = "9.20.0"
16-
OrdinaryDiffEq = "6.84.0"
1710
julia = "1.10"

test/explicit_imports.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using ExplicitImports
2+
using FastSolvers
3+
using Test
4+
5+
@testset "ExplicitImports" begin
6+
@test check_no_implicit_imports(FastSolvers) === nothing
7+
@test check_no_stale_explicit_imports(FastSolvers) === nothing
8+
end

test/runtests.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ using FastSolvers
22
using Test
33
using ForwardDiff
44
using QuasiMonteCarlo
5-
using SparseArrays
6-
using LinearAlgebra
7-
using NonlinearSolve
8-
using BenchmarkTools
5+
using SparseArrays: spzeros
6+
using NonlinearSolve: NonlinearLeastSquaresProblem, solve
97

108
@testset "RKHS kernels" begin
119
include("kernels/interface.jl")
@@ -24,3 +22,7 @@ end
2422
include("rfnn/derivatives.jl")
2523
include("rfnn/function_approx.jl")
2624
end
25+
26+
@testset "Explicit Imports" begin
27+
include("explicit_imports.jl")
28+
end

0 commit comments

Comments
 (0)