banesullivan / scooby

🐶 🕵️ Great Dane turned Python environment detective
MIT License
47 stars 12 forks source link

Should warnings be thrown or...? #4

Closed banesullivan closed 5 years ago

banesullivan commented 5 years ago

https://github.com/banesullivan/scooby/blob/06df68161e14ea0b9fae4cc37a35d408391fd6d2/scooby/versions.py#L90-L99

>>> import scooby
>>> scooby.investigate(additional=['foo',])
WARNING:root:RUH-ROH! Could not import module `foo`. This will be skipped.

------------------------------------------------------
  Date: Tue Jun 25 17:53:55 2019 MDT
  Platform: Darwin-18.5.0-x86_64-i386-64bit

             12 : CPU(s)
         x86_64 : Machine
          64bit : Architecture
        32.0 GB : RAM

  3.7.3 | packaged by conda-forge | (default, Mar 27
  2019, 15:43:19)  [Clang 4.0.1
  (tags/RELEASE_401/final)]

         1.16.3 : numpy
          1.3.0 : scipy
          7.5.0 : IPython
          3.1.0 : matplotlib

  Intel(R) Math Kernel Library Version 2018.0.3
  Product Build 20180406 for Intel(R) 64
  architecture applications
------------------------------------------------------

Should a warning be thrown like this and then skipped when reporting, or should we include the missing package in the report with a "not installed" flag of some sort? Maybe something like this:

------------------------------------------------------
  Date: Tue Jun 25 17:53:55 2019 MDT
  Platform: Darwin-18.5.0-x86_64-i386-64bit

             12 : CPU(s)
         x86_64 : Machine
          64bit : Architecture
        32.0 GB : RAM

  3.7.3 | packaged by conda-forge | (default, Mar 27
  2019, 15:43:19)  [Clang 4.0.1
  (tags/RELEASE_401/final)]

         1.16.3 : numpy
          1.3.0 : scipy
          7.5.0 : IPython
          3.1.0 : matplotlib
    unavailable : foo

  Intel(R) Math Kernel Library Version 2018.0.3
  Product Build 20180406 for Intel(R) 64
  architecture applications
------------------------------------------------------

And for:

https://github.com/banesullivan/scooby/blob/06df68161e14ea0b9fae4cc37a35d408391fd6d2/scooby/versions.py#L159-L167

Should a warning be thrown at all since it reports unknown version? Even though the package is available..

leouieda commented 5 years ago

Should a warning be thrown like this and then skipped when reporting, or should we include the missing package in the report with a "not installed" flag of some sort?

The problem with warnings is that they only appear once. So running scooby.investigate twice will only warn once. I would expect to get the same result.

Having unavailable : foo in the same category might make it a bit hard to parse. Maybe having a separate category for unavailable?

banesullivan commented 5 years ago

Thanks for the tip @leouieda! Perhaps a separate category for failed packages:

------------------------------------------------------
  Date: Tue Jun 25 17:53:55 2019 MDT
  Platform: Darwin-18.5.0-x86_64-i386-64bit

             12 : CPU(s)
         x86_64 : Machine
          64bit : Architecture
        32.0 GB : RAM

  3.7.3 | packaged by conda-forge | (default, Mar 27
  2019, 15:43:19)  [Clang 4.0.1
  (tags/RELEASE_401/final)]

         1.16.3 : numpy
          1.3.0 : scipy
          7.5.0 : IPython
          3.1.0 : matplotlib

  RUH-ROH! These modules we either unavailable 
  or the version attribute is unknown:

    unavailable : foo
        unknown : my_package

  Intel(R) Math Kernel Library Version 2018.0.3
  Product Build 20180406 for Intel(R) 64
  architecture applications
------------------------------------------------------