Skip to content

Conversation

@ChrisRackauckas-Claude
Copy link
Contributor

Summary

This PR improves the package's explicit imports hygiene by:

  • Making Random imports explicit (Random, AbstractRNG, randexp) instead of relying on using Random which imports all exports
  • Adding ExplicitImports.jl to test dependencies
  • Adding ExplicitImports tests to the qa.jl test suite

Changes Made

src/PoissonRandom.jl:3

Changed from:

using Random

to:

using Random: Random, AbstractRNG, randexp

This explicitly lists what is imported from Random, preventing reliance on implicit/transitive imports.

Project.toml

  • Added ExplicitImports to [extras] section
  • Added ExplicitImports to test targets
  • Added compat entry for ExplicitImports = "1.14.0"

test/qa.jl

  • Added using ExplicitImports
  • Added new @testset "ExplicitImports" with tests:
    • check_no_implicit_imports(PoissonRandom) - ensures no implicit imports
    • check_no_stale_explicit_imports(PoissonRandom) - ensures no unused imports

Test Results

All tests pass, including the new ExplicitImports tests:

  • ✓ Aqua (10 tests)
  • ✓ JET static analysis (6 tests)
  • ✓ ExplicitImports (2 tests)
  • ✓ All Poisson sampling tests

Benefits

  1. Clear dependencies: Makes it explicit what is imported from each module
  2. Prevents transitive dependency issues: Won't accidentally rely on exports that come transitively through dependencies
  3. Better maintainability: Clear what the code actually uses
  4. Enforced in CI: ExplicitImports tests prevent regression

cc: @ChrisRackauckas

🤖 Generated with Claude Code

- Made Random imports explicit: Random, AbstractRNG, randexp
- Added ExplicitImports.jl to test dependencies
- Added ExplicitImports tests to qa.jl test suite
- All tests pass including new ExplicitImports checks

This ensures the package follows best practices for explicit imports,
preventing reliance on transitive dependencies and maintaining
clear dependency relationships.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@ChrisRackauckas ChrisRackauckas merged commit 807e8a9 into SciML:master Dec 30, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants