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

add ModuleNotFoundError to catch all possible errors #96

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ocefpaf
Copy link
Collaborator

@ocefpaf ocefpaf commented Aug 28, 2023

This is required for py311 I guess.

@ericdill
Copy link
Owner

Oof. Did the api change or something?

@ericdill
Copy link
Owner

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

@codecov-commenter
Copy link

codecov-commenter commented Aug 28, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.11% ⚠️

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

❗ 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%) ⬇️
depfinder/inspection.py 88.63% <ø> (-0.09%) ⬇️
depfinder/main.py 95.34% <ø> (-0.06%) ⬇️
depfinder/reports.py 95.08% <ø> (-0.08%) ⬇️
depfinder/utils.py 79.06% <0.00%> (-0.48%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ocefpaf
Copy link
Collaborator Author

ocefpaf commented Aug 28, 2023

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
Copy link
Collaborator Author

ocefpaf commented Aug 28, 2023

I'll fix the CIs tomorrow...

@ocefpaf ocefpaf force-pushed the add_ModuleNotFoundError branch 3 times, most recently from 74ef570 to aa667c4 Compare August 29, 2023 14:55
@ocefpaf ocefpaf force-pushed the add_ModuleNotFoundError branch from 99fc944 to 5700250 Compare August 29, 2023 15:10
@ocefpaf
Copy link
Collaborator Author

ocefpaf commented Aug 29, 2023

@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 :-/

Copy link
Owner

@ericdill ericdill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@ocefpaf
Copy link
Collaborator Author

ocefpaf commented Aug 29, 2023

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 ocefpaf requested a review from ericdill October 11, 2023 18:52
Copy link
Owner

@ericdill ericdill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, sorry for the super delayed review

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

Successfully merging this pull request may close these issues.

3 participants