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

Protect again failing to load a command interface from an extension #6879

Merged
merged 1 commit into from
Jul 24, 2022

Conversation

mih
Copy link
Member

@mih mih commented Jul 24, 2022

Previously DataLad could crash if an extension entrypoint was
importable, but a declared command suit item would not.

This change now skips each individual command interface with an
error message like this:

% python -c 'import datalad.api as dl'
[ERROR  ] Internal error, cannot import interface 'datalad_dataverse.create_sibling_dataverse': ModuleNotFoundError(No module named 'datalad_next')
[ERROR  ] Skipping unusable command interface 'datalad_dataverse.create_sibling_dataverse.CreateSiblingDataverse' from extension 'dataverse'

(I have an extension installed, where one command depends on an
unavailable package).

Closes #6874

Previously DataLad could crash if an extension entrypoint was
importable, but a declared command suit item would not.

This change now skips each individual command interface with an
error message like this:

```
% python -c 'import datalad.api as dl'
[ERROR  ] Internal error, cannot import interface 'datalad_dataverse.create_sibling_dataverse': ModuleNotFoundError(No module named 'datalad_next')
[ERROR  ] Skipping unusable command interface 'datalad_dataverse.create_sibling_dataverse.CreateSiblingDataverse' from extension 'dataverse'
```

(I have an extension installed, where one command depends on an
unavailable package).

Fixes datalad#6874
@mih mih added the semver-patch Increment the patch version when merged label Jul 24, 2022
@codecov
Copy link

codecov bot commented Jul 24, 2022

Codecov Report

Merging #6879 (3a40934) into maint (cefecae) will increase coverage by 0.97%.
The diff coverage is 33.33%.

@@            Coverage Diff             @@
##            maint    #6879      +/-   ##
==========================================
+ Coverage   90.25%   91.22%   +0.97%     
==========================================
  Files         354      354              
  Lines       46113    46130      +17     
==========================================
+ Hits        41621    42084     +463     
+ Misses       4492     4046     -446     
Impacted Files Coverage Δ
datalad/api.py 90.24% <33.33%> (-4.50%) ⬇️
datalad/customremotes/tests/test_datalad.py 95.34% <0.00%> (-2.28%) ⬇️
datalad/distribution/create_sibling.py 69.80% <0.00%> (-0.20%) ⬇️
datalad/cli/common_args.py 100.00% <0.00%> (ø)
datalad/tests/test_dochelpers.py 100.00% <0.00%> (ø)
datalad/support/tests/test_network.py 100.00% <0.00%> (ø)
datalad/tests/utils_pytest.py 89.73% <0.00%> (+0.01%) ⬆️
datalad/utils.py 88.17% <0.00%> (+0.01%) ⬆️
datalad/__init__.py 98.00% <0.00%> (+0.04%) ⬆️
datalad/support/tests/test_locking.py 95.87% <0.00%> (+0.04%) ⬆️
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cefecae...3a40934. Read the comment docs.

@yarikoptic
Copy link
Member

docs fail unrelated: #6882

@yarikoptic
Copy link
Member

Should be ok. Some brave soul might come up with a test some time in the bright future to ensure we do not error while handling an error ;)

@yarikoptic yarikoptic merged commit 5d879dd into datalad:maint Jul 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-patch Increment the patch version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants