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

UnicodePlots.jl is failing on the daily PkgEval runs #134

Closed
DilumAluthge opened this issue Apr 13, 2021 · 16 comments · Fixed by #136 or #185
Closed

UnicodePlots.jl is failing on the daily PkgEval runs #134

DilumAluthge opened this issue Apr 13, 2021 · 16 comments · Fixed by #136 or #185
Assignees
Labels

Comments

@DilumAluthge
Copy link

UnicodePlots.jl is failing on the daily PkgEval runs. See for example: https://juliaci.github.io/NanosoldierReports/pkgeval_badges/U/UnicodePlots.html

PkgEval

@Evizero
Copy link
Member

Evizero commented Apr 14, 2021

looks like the cause is here

ERROR: LoadError: ArgumentError: Package Random not found in current path:
- Run `import Pkg; Pkg.add("Random")` to install the Random package.

@waldyrious
Copy link
Contributor

@johnnychen94 shouldn't this issue be reopened, considering that the PkgEval runs are still failing?

@johnnychen94
Copy link
Collaborator

johnnychen94 commented Sep 12, 2021

Interesting... I thought #136 fixes this already.

@johnnychen94 johnnychen94 reopened this Sep 12, 2021
@t-bltg
Copy link
Member

t-bltg commented Sep 14, 2021

Seems like we lost some ansi color codes with 1.8.0.

@t-bltg t-bltg self-assigned this Sep 16, 2021
@t-bltg t-bltg added the bug label Sep 16, 2021
@t-bltg
Copy link
Member

t-bltg commented Sep 25, 2021

Test pass on 1.7.0 rc1.
Test pass on nightly 1.8.0 (Version 1.8.0-DEV.593 (2021-09-24) - Commit 53aa65ad3c (1 day old master)).

@DilumAluthge, this looks like a CI specific issue, not sure how I can fix this without more info.

@DilumAluthge
Copy link
Author

Here's the log: https://s3.amazonaws.com/julialang-reports/nanosoldier/pkgeval/by_date/2021-09/25/UnicodePlots.1.8.0-DEV-53aa65ad3c9.log

I think it has to do with color. Color is disabled in PkgEval.

cc: @maleadt

@johnnychen94
Copy link
Collaborator

Do we have a way to detect if color is enabled inside Julia? If so we can optionally disable some color tests.

@maleadt
Copy link

maleadt commented Sep 26, 2021

julia> Base.get_have_color()
true

Not sure how officially sanctioned that is though.

@DilumAluthge
Copy link
Author

julia> Base.get_have_color()
true

Not sure how officially sanctioned that is though.

On older Julia versions, I don't think that will work. This is what @KristofferC does in Crayons.jl to support both older and newer Julia versions:

function _have_color()
    if isdefined(Base, :get_have_color)
        return Base.get_have_color()
    else
        Base.have_color
    end
end

Source: https://github.com/KristofferC/Crayons.jl/blob/2619561156a02fdf739c8146e09a96ceb176f43c/src/crayon.jl#L102

@KristofferC
Copy link

KristofferC commented Sep 26, 2021

This is what @KristofferC does in Crayons.jl to support both older and newer Julia versions:

I am not sure this is a good way at all though.

I think the correct way is to always print to an IO with color enabled:

base ❯ julia -q --color=no

julia> printstyled(IOContext(stdout, :color => true), "foo"; color=:green)
foo # printed in green anyway

Edit: But that is what the tests are already doing now I see.

@DilumAluthge
Copy link
Author

This is what @KristofferC does in Crayons.jl to support both older and newer Julia versions:

I am not sure this is a good way at all though.

I think the correct way is to always print to an IO with color enabled:

base ❯ julia -q --color=no

julia> printstyled(IOContext(stdout, :color => true), "foo"; color=:green)
foo # printed in green anyway

If I recall, we tried that approach, but it still ended up failing on PkgEval.

@KristofferC
Copy link

It is maybe Crayons.jl fault then. KristofferC/Crayons.jl#47 maybe.

@DilumAluthge
Copy link
Author

Ahhhh yeah it might be KristofferC/Crayons.jl#47.

@t-bltg
Copy link
Member

t-bltg commented Sep 26, 2021

Thanks for the hints. We don't use show on Crayons objects, we only use Crayons.val(...) to get the ansicolor index:

function crayon_256_color(color::UserColorType)::ColorType

I'm gonna test with julia --color=no and see if I can reproduce this locally.

EDIT: yes it does, fixing this asap, I forgot about this bit in HeatmapCanvas:

print(io, Crayon(foreground=fgcol, background=bgcol), HALF_BLOCK)

@t-bltg
Copy link
Member

t-bltg commented Sep 27, 2021

Confirmed fix, UnicodePlots is absent from today's nanosoldier report.

@waldyrious
Copy link
Contributor

Confirmed fix, UnicodePlots is absent from today's nanosoldier report.

Nice! Btw, perhaps the PkgEval badge (as shown in the opening commit) could be added to the README, next to the other CI ones?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
7 participants