question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove the warnings upfront when importing the light-weight versions

See original GitHub issue

Is your feature request related to a current problem? Please describe. Yes. Currently using the “u8darts[torch]” version (for all the chaos for installing prophet but that’s another story), every time I run my program with darts imported, I would received the warnings from darts.models.init.py.

It would not be a problem if the logger is instantiated directly from logging module, but with levels, format and addHandler hardcoded in darts.logging.get_logger() there’s basically nothing I can do.

Describe proposed solution The best solution would be completely replace the darts.logging.get_logger() function with standard logging.getLogger() (unless there’re any very special reasons).

Describe potential alternatives

  • Do not add handlers other than NullHandler as mentioned here
  • Raise the warnings in a lazy manner, if that is plausible.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
aaronsl-hkucommented, Jun 16, 2022

Hello @brunnedu . Nice to receive your reply.

We might have some misunderstanding here: I am not looking into disable all warnings as a whole. What I am proposing is not to hardcode the handler and formatter into the get_logger function.

Long story short, if my project has a logging config and the formatting is not the same darts, my log would be easily screwed by the hardcoded formatter.

May I know if there is any particular reason not to use the standard logging.get_logger as-is?

Hi @aaronsl-hku, we would really like to help you resolve this issue. At the same time, we think that it is important to inform our users about missing modules.

Therefore we would suggest giving you the option to opt-out of those warnings. Would it be possible for you to set an environment variable such as DISABLE_DARTS_WARNINGS in your terminal? We could then use this environment variable to adjust the logging behavior of darts.

1reaction
brunneducommented, Jun 16, 2022

Hi @aaronsl-hku, we would really like to help you resolve this issue. At the same time, we think that it is important to inform our users about missing modules.

Therefore we would suggest giving you the option to opt-out of those warnings. Would it be possible for you to set an environment variable such as DISABLE_DARTS_LOGGING in your terminal? We could then use this environment variable to adjust the logging behavior of darts.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow importing librosa on Python 2 without a warning #990
Description I'd like to use librosa in Python 2 without an annoying warning on every import. The common pattern in Python is: Steps/Code...
Read more >
Suppress PowerShell Module Import Warning Messages
Summary: Learn how to use the warning redirection operator to suppress Windows PowerShell warning messages when importing a module.
Read more >
Manage warnings in a python package - import - Stack Overflow
I am looking for a place where I can turn off all warnings in the library, because I don't want to manage this...
Read more >
What's New in Python 2.6 — Python 3.11.0 documentation
A new command-line switch, -3 , enables warnings about features that will be removed in Python 3.0. You can run code with this...
Read more >
Solidity Documentation - Read the Docs
Solidity is an object-oriented, high-level language for implementing smart contracts. Smart contracts are programs which govern the behaviour of accounts ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found