Skip to content

Commit

Permalink
Switch to explicit imports of names from packages (#748)
Browse files Browse the repository at this point in the history
* Use [ExplicitImports.jl](https://github.com/ericphanson/ExplicitImports.jl] to collect and explicitly list imported symbols.

* Add "ExplicitImports" tests

Closes #748

Co-authored-by: Phillip Alday <[email protected]>
  • Loading branch information
dmbates and palday authored Mar 4, 2024
1 parent 529c710 commit ee5f2cf
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 31 deletions.
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
MixedModels v4.22.4 Release Notes
==============================
* Switch to explicit imports from all included packages (i.e. replace `using Foo` by `using Foo: Foo, bar, baz`) [#748]
* Reset parameter values before a `deepcopy` in a test (doesn't change test result) [#744]

MixedModels v4.22.3 Release Notes
==============================
* Comment out calls to `@debug` [#733]
Expand Down Expand Up @@ -490,3 +495,5 @@ Package dependencies
[#715]: https://github.com/JuliaStats/MixedModels.jl/issues/715
[#717]: https://github.com/JuliaStats/MixedModels.jl/issues/717
[#733]: https://github.com/JuliaStats/MixedModels.jl/issues/733
[#744]: https://github.com/JuliaStats/MixedModels.jl/issues/744
[#748]: https://github.com/JuliaStats/MixedModels.jl/issues/748
6 changes: 4 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MixedModels"
uuid = "ff71e718-51f3-5ec2-a782-8ffcbfa3c316"
author = ["Phillip Alday <[email protected]>", "Douglas Bates <[email protected]>", "Jose Bayoan Santiago Calderon <[email protected]>"]
version = "4.22.3"
version = "4.22.4"

[deps]
Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45"
Expand Down Expand Up @@ -36,6 +36,7 @@ BSplineKit = "0.14, 0.15, 0.16, 0.17"
DataAPI = "1"
DataFrames = "1"
Distributions = "0.21, 0.22, 0.23, 0.24, 0.25"
ExplicitImports = "1.3"
GLM = "1.8.2"
InteractiveUtils = "1"
JSON3 = "1"
Expand Down Expand Up @@ -65,10 +66,11 @@ julia = "1.8"
[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "DataFrames", "InteractiveUtils", "StableRNGs", "Suppressor", "Test"]
test = ["Aqua", "DataFrames", "ExplicitImports", "InteractiveUtils", "StableRNGs", "Suppressor", "Test"]
70 changes: 41 additions & 29 deletions src/MixedModels.jl
Original file line number Diff line number Diff line change
@@ -1,35 +1,47 @@
module MixedModels

using Arrow
using BSplineKit
using DataAPI
using Distributions
using GLM
using JSON3
using LinearAlgebra
using Markdown
using NLopt
using Random
using PooledArrays
using ProgressMeter
using SparseArrays
using StaticArrays
using Statistics
using StatsAPI
using StatsBase
using StatsModels
using StructTypes
using Tables
using TypedTables

using LinearAlgebra: BlasFloat, BlasReal, HermOrSym, PosDefException, copytri!
using Arrow: Arrow
using Base: Ryu, require_one_based_indexing
using DataAPI: levels, refpool, refarray, refvalue
using GLM: Link, canonicallink, linkfun, linkinv, dispersion, dispersion_parameter
using BSplineKit: BSplineKit, BSplineOrder, Natural, Derivative, SplineInterpolation
using BSplineKit: interpolate
using DataAPI: DataAPI, levels, refpool, refarray, refvalue
using Distributions: Distributions, Bernoulli, Binomial, Chisq, Distribution, Gamma
using Distributions: InverseGaussian, Normal, Poisson, ccdf, estimate
using GLM: GLM, GeneralizedLinearModel, IdentityLink, InverseLink, LinearModel
using GLM: Link, LogLink, LogitLink, ProbitLink, SqrtLink
using GLM: canonicallink, glm, linkinv, dispersion, dispersion_parameter
using JSON3: JSON3
using LinearAlgebra: LinearAlgebra, Adjoint, BLAS, BlasFloat, ColumnNorm
using LinearAlgebra: Diagonal, Hermitian, HermOrSym, I, LAPACK, LowerTriangular
using LinearAlgebra: PosDefException, SVD, SymTridiagonal, Symmetric
using LinearAlgebra: UpperTriangular, cond, diag, diagind, dot, eigen, isdiag
using LinearAlgebra: ldiv!, lmul!, logdet, mul!, norm, normalize, normalize!, qr
using LinearAlgebra: rank, rdiv!, rmul!, svd, tr, tril!
using Markdown: Markdown
using MixedModelsDatasets: dataset, datasets
using NLopt: Opt
using StatsModels: TableRegressionModel
using NLopt: NLopt, Opt, ftol_abs, ftol_rel, initial_step, maxtime, xtol_abs, xtol_rel
using PooledArrays: PooledArrays, PooledArray
using PrecompileTools: PrecompileTools, @setup_workload, @compile_workload
using ProgressMeter: ProgressMeter, Progress, ProgressUnknown, finish!, next!
using Random: Random, AbstractRNG, randn!
using SparseArrays: SparseArrays, SparseMatrixCSC, SparseVector, dropzeros!, nnz
using SparseArrays: nonzeros, nzrange, rowvals, sparse
using StaticArrays: StaticArrays, SVector
using Statistics: Statistics, mean, quantile, std
using StatsAPI: StatsAPI, aic, aicc, bic, coef, coefnames, coeftable, confint, deviance
using StatsAPI: dof, dof_residual, fit, fit!, fitted, isfitted, islinear, leverage
using StatsAPI: loglikelihood, meanresponse, modelmatrix, nobs, predict, r2, residuals
using StatsAPI: response, responsename, stderror, vcov, weights
using StatsBase: StatsBase, CoefTable, model_response, summarystats
using StatsFuns: log2π, normccdf
using StatsModels: StatsModels, AbstractContrasts, AbstractTerm, CategoricalTerm
using StatsModels: ConstantTerm, DummyCoding, EffectsCoding, FormulaTerm, FunctionTerm
using StatsModels: HelmertCoding, HypothesisCoding, InteractionTerm, InterceptTerm
using StatsModels: MatrixTerm, SeqDiffCoding, TableRegressionModel, Term
using StatsModels: apply_schema, drop_term, formula, modelcols, term, @formula
using StructTypes: StructTypes
using Tables: Tables, columntable, rows
using TypedTables: TypedTables, DictTable, FlexTable, Table

export @formula,
AbstractReMat,
Expand Down Expand Up @@ -77,6 +89,8 @@ export @formula,
condVar,
condVartables,
confint,
dataset,
datasets,
deviance,
dispersion,
dispersion_parameter,
Expand Down Expand Up @@ -190,8 +204,6 @@ include("mimeshow.jl")
include("serialization.jl")
include("profile/profile.jl")

using PrecompileTools

@setup_workload begin
# Putting some things in `setup` can reduce the size of the
# precompile file and potentially make loading faster.
Expand Down
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Aqua
using ExplicitImports
using GLM
using MixedModels
using Test
Expand All @@ -18,6 +19,11 @@ import LinearAlgebra: BLAS
piracies=(;treat_as_own=[GLM.wrkresp!, Base.:|]))
end

@testset "ExplicitImports" begin
@test check_no_implicit_imports(MixedModels) === nothing
@test check_no_stale_explicit_imports(MixedModels) === nothing
end

include("utilities.jl")
include("misc.jl")
include("pivot.jl")
Expand Down

2 comments on commit ee5f2cf

@dmbates
Copy link
Collaborator Author

@dmbates dmbates commented on ee5f2cf Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/102228

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v4.22.4 -m "<description of version>" ee5f2cf048412f0de627e62b508036a6a0894745
git push origin v4.22.4

Please sign in to comment.