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

Deprecation warnings do not appear in notebook but in the terminal #1148

Open
DougBurke opened this issue Mar 3, 2020 · 11 comments
Open

Deprecation warnings do not appear in notebook but in the terminal #1148

DougBurke opened this issue Mar 3, 2020 · 11 comments

Comments

@DougBurke
Copy link

I have a notebook that uses a deprecated Haskell constructor (i.e. one marked with the DEPRECATED pragma). If I use this then I get the following message in the terminal which is running jupyter notebook, but nothing in the notebook.

[W 09:27:35.835 LabApp] 404 GET /files/data/seattle-temps.csv?_xsrf=2%7Cd8176c26%7C89bae5dfddca298f025c2374f4cbb60a%7C1582326595 (127.0.0.1) 1.57ms referer=http://localhost:8888/lab

<interactive>:73:35: warning: [-Wdeprecations]
    In the use of data constructor ‘NamedStyles’ (imported from Graphics.Vega.VegaLite, but defined in hvega-0.6.0.0:Graphics.Vega.VegaLite.Configuration):
    Deprecated: "Please change Legend to MarkNamedStyles"
[I 09:28:42.623 LabApp] Saving file at /VegaLiteGallery-SingleViewPlots.ipynb

I was expecting to see it in the actual notebook (e.g. in the same way that you see hlint suggestions).

Is this possible?

@vaibhavsagar
Copy link
Member

Hmm, something is clearly wrong with the way we are handling warnings. I made a change some time ago that allowed the output of e.g. Debug.Trace to properly show up in the notebook instead of the terminal, but I haven't figured out how to get warning output to also display correctly.

@vaibhavsagar
Copy link
Member

Here's the relevant function as of this writing. The change I made was to handle stderr in the same way as stdout (which you can probably tell from the duplicated lines). If you have any suggestions for handling warning output I'd be happy to investigate further.

@DougBurke
Copy link
Author

I'll see if I can find some time to look at

@DougBurke
Copy link
Author

I guess this is related to #612 ?

@DougBurke
Copy link
Author

I should have added in my original report that I am using whatever https://github.com/tweag/jupyterWith points to, and I don't know if this has your latest changes to handle stderr in.

@jamesdbrock
Copy link
Member

It looks like tweag/jupyterWith is currently pinned to the last commit which bumped the cabalfile version.

e15dd63

https://github.com/tweag/jupyterWith/blob/7a6716f0c0a5538691a2f71a9f12b066bce7d55c/nix/haskell-overlay.nix#L7

Maybe time for another version bump and a hackage release? I also have my own selfish reasons for wanting jupyterWith to upgrade.

@vaibhavsagar
Copy link
Member

vaibhavsagar commented Mar 19, 2020

I could make another release, but it looks like the version jupyterWith uses already includes my changes to handle stderr, so that won't fix this issue.

@vaibhavsagar
Copy link
Member

I've released ihaskell-0.10.1.0 on Hackage.

@DougBurke
Copy link
Author

So I'm using ihaskell-0.10.1.1 and I see this behavior (this is with

import qualified Graphics.Vega.VegaLite as VL

)

expected

let xs = VL.NamedStyles []

which reports (in the web browser containing IHaskell notebook)

<interactive>:1:10: warning: [-Wdeprecations]
    In the use of data constructor ‘NamedStyles’ (imported from Graphics.Vega.VegaLite, but defined in hvega-0.10.0.0:Graphics.Vega.VegaLite.Configuration):
    Deprecated: "Please change Legend to MarkNamedStyles"

unexpected

If I drop the let then I don't see the warning in the IHaskell web page, instead it only displayed in the console window - that is using

ys = VL.NamedStyles []

@DougBurke
Copy link
Author

This is the behavior I get with ihaskell-0.10.2.0 - ideally all the uses of NamedStyles would create the same warning. The two that don't in the notebook do create this error in the shell runnng ihaskell-lab.

warn

I haven't looked at the code much, but I can't imagine how it can grab the warning in some cases and not in others, as I'd imagine they are going through the same code path,,,

@vaibhavsagar
Copy link
Member

vaibhavsagar commented Jun 23, 2021

There's some pretty convoluted logic around capturing stdout and stderr each time we run Haskell code, so it's possible that it's doing the right thing sometimes and not other times. For another example of this, you can use getLine sometimes in a notebook but if you use it inside a monad transformer it gets swallowed.

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

No branches or pull requests

3 participants