jkrumbiegel / DataFrameMacros.jl

Macros that simplify working with DataFrames.jl
MIT License
61 stars 4 forks source link

@reexport DataFrames so `using DataFrames` is not required. #32

Open nathanrboyer opened 2 months ago

nathanrboyer commented 2 months ago

Closes #31.

I just deleted the now failing HygieneModule tests. Not sure if there is something different you would want to test there?

jkrumbiegel commented 2 months ago

that test should stay, but you can explicitly import the used macros from DataFrameMacros. It tests whether the macro-generated symbols resolve correctly even if DataFrames symbols are not imported.

nathanrboyer commented 2 months ago

I'm having trouble getting it to work.

module HygieneModule
    using DataFrameMacros: @passmissing, @transform
    using DataFrames: DataFrames
    using Test

    @testset "macro hygiene" begin
        df = DataFrames.DataFrame(x = [1, 2, 3])
        @test !(@isdefined ByRow)
        @test !(@isdefined passmissing)
        @test !(@isdefined transform)
        @test @transform(df, :y = @passmissing :x + 1) ==
            DataFrames.transform(df, :x => DataFrames.ByRow(DataFrames.passmissing(x -> x + 1)) => :y)
    end
end
Test Summary:           | Pass  Total  Time
table shortcut @astable |    3      3  0.5s
ERROR: LoadError: UndefVarError: `@passmissing` not defined
Stacktrace:
 [1] include(fname::String)
   @ Base.MainInclude .\client.jl:489
 [2] top-level scope
   @ none:6
in expression starting at C:\Users\nboyer.AIP\Documents\Julia\Forks\DataFrameMacros\test\runtests.jl:221
ERROR: Package DataFrameMacros errored during testing
jkrumbiegel commented 2 months ago

I think @passmissing exists only inside the other macros, it's not an exported macro

nathanrboyer commented 2 months ago

I see. It works now.