depfinder icon indicating copy to clipboard operation
depfinder copied to clipboard

add ModuleNotFoundError to catch all possible errors

Open ocefpaf opened this issue 2 years ago • 7 comments

~~This is required for py311 I guess.~~

ocefpaf avatar Aug 28 '23 19:08 ocefpaf

Oof. Did the api change or something?

ericdill avatar Aug 28 '23 19:08 ericdill

Also, feel free to drop older python versions as you see fit

ericdill avatar Aug 28 '23 19:08 ericdill

Codecov Report

Patch coverage has no change and project coverage change: -0.11% :warning:

Comparison is base (561d5fe) 90.90% compared to head (ef07a0a) 90.80%. Report is 1 commits behind head on main.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #96      +/-   ##
==========================================
- Coverage   90.90%   90.80%   -0.11%     
==========================================
  Files           7        7              
  Lines         451      446       -5     
==========================================
- Hits          410      405       -5     
  Misses         41       41              
Files Changed Coverage Δ
depfinder/cli.py 95.09% <ø> (-0.05%) :arrow_down:
depfinder/inspection.py 88.63% <ø> (-0.09%) :arrow_down:
depfinder/main.py 95.34% <ø> (-0.06%) :arrow_down:
depfinder/reports.py 95.08% <ø> (-0.08%) :arrow_down:
depfinder/utils.py 79.06% <0.00%> (-0.48%) :arrow_down:

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Aug 28 '23 19:08 codecov-commenter

Oof. Did the api change or something?

I'm not even sure why this failed in my tests. According to this it should be OK without it.

Also, feel free to drop older python versions as you see fit

I think that making depfinder >=3.8 is pretty safe at this point. I'll add that change.

ocefpaf avatar Aug 28 '23 20:08 ocefpaf

I'll fix the CIs tomorrow...

ocefpaf avatar Aug 28 '23 21:08 ocefpaf

@ericdill this should be ready for a review. I kind of need a new release after it. We are putting together a very hackish way for a jupyter notebook to inspect itself and install the necessary dependencies to run using depfinder.

!pip install ipynbname depfinder --quiet

import subprocess
import sys

def _install(package):
    subprocess.check_call([sys.executable, "-m", "pip", "install", "--quiet", package])

def _colab_install_missing_deps():
    import ipynbname
    import depfinder
    import importlib
    nb_path = ipynbname.path()
    deps = depfinder.notebook_path_to_dependencies(nb_path)

    for dep in deps["required"]:
        if importlib.find_loader(dep) is None:
            _install(dep)

_colab_install_missing_deps()

The annoying thing is that ipyname is useless on GoogleColab, the main aim of such a hack :-/

ocefpaf avatar Aug 29 '23 15:08 ocefpaf

I can review later. Merge and release as you see fit.

We are still tweaking the GoogleColab situation, so we can wait. No rush!

ocefpaf avatar Aug 29 '23 16:08 ocefpaf