Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit imports #100

Merged

Conversation

GunnarFarneback
Copy link
Collaborator

@GunnarFarneback GunnarFarneback commented Jun 9, 2024

  • Stop doing implicit imports and be explicit about all imports. Thanks to @ericphanson for ExplicitImports.jl.
  • Make regression tests of compat files ignore whitespace around hyphens. Fixes Bad test now errors #99.
  • Remove dependency on AutoHashEquals. This was only used for a roundtrip test of the RegistryData struct and had no reasonable utility externally. Closes [compat] Update compat for AutoHashEquals #95.
  • (Added) Check in the tests that imports remain explicit.

@DilumAluthge
Copy link
Member

Could we also run ExplicitImports.jl as part of the test suite here, to make sure this doesn't regress?

@GunnarFarneback
Copy link
Collaborator Author

Maybe? ExplicitImports gives a note about Pkg.Types.semver_spec actually being owned by Pkg.Versions.semver_spec, but that is only true for sufficiently new Julia versions.

@DilumAluthge
Copy link
Member

Would ExplicitImports be satisfied by:

@static if VERSION >= v"1.9-" # or whatever the correct version is
    const semver_spec = Pkg.Versions.semver_spec
else
    const semver_spec = Pkg.Types.semver_spec
end

@GunnarFarneback
Copy link
Collaborator Author

It's not really worth being that pedantic in the code. But when I checked the ExplicitImports README, the regression checking functions are quite specific about what things they look for.

@DilumAluthge
Copy link
Member

@ericphanson What are your thoughts here? Could we run ExplicitImports in the test suite, but just tell ExplicitImports to skip semver_spec?

I would also be fine with doing the @static if..., even though it is a little annoying.

@GunnarFarneback
Copy link
Collaborator Author

GunnarFarneback commented Jun 9, 2024

A bigger problem is that ExplicitImports doesn't work with as old Julia versions as RegistryTools does.

@DilumAluthge
Copy link
Member

We could omit ExplicitImports from the list of test-deps, and then in the test suite, if the Julia version is new enough, we could do Pkg.add(name = "ExplicitImports", uuid = "...", preserve=Pkg.PRESERVE_ALL).

@GunnarFarneback
Copy link
Collaborator Author

It ain't pretty, but yes, it works.

@ericphanson
Copy link
Member

The regression testing functions have an ignore kwarg to skip stuff like this btw! Also skip for whole modules.

Comment on lines +10 to +14
# ExplicitImports does not support as old Julia versions as RegistryTools does.
# Change this to a regular test dependency when it becomes possible, i.e.
# when pre-1.7 support is dropped.
if VERSION >= v"1.7"
Pkg.add(name = "ExplicitImports", uuid = "7d51a73a-1435-4ff3-83d9-f097790105c7", preserve=Pkg.PRESERVE_ALL)
Copy link
Member

Choose a reason for hiding this comment

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

it would be nice to drop this... also to get ExplicitImports into Aqua.. at some point I will see about expanding compat

@GunnarFarneback GunnarFarneback merged commit b5ff4d5 into JuliaRegistries:master Jun 11, 2024
13 checks passed
@GunnarFarneback GunnarFarneback deleted the explicit_imports branch June 11, 2024 20:16
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.

Bad test now errors
3 participants