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

ENH: import datalad.api to bind extensions methods for discovery of dataset methods #5999

Merged
merged 2 commits into from
Sep 24, 2021

Conversation

yarikoptic
Copy link
Member

This might be not the most elegant but the "easiest" in DX approach to resolve
this issue IMHO. It might cause run time penalty though in small scripts which
import only a few dedicated modules, thus do not require import of the entire
API.

An alternative would be to e.g. do 2 rounds of that loop, importing datalad.api
only upon the end of the first loop if no meth is found.

Closes #5990

…ataset methods

This might be not the most elegant but the "easiest" in DX approach to resolve
this issue IMHO.  It might cause run time penalty though in small scripts which
import only a few dedicated modules, thus do not require import of the entire
API.

An alternative would be to e.g. do 2 rounds of that loop, importing datalad.api
only upon the end of the first loop if no meth is found.

Closes datalad#5990
@yarikoptic yarikoptic added the semver-patch Increment the patch version when merged label Sep 22, 2021
@codecov
Copy link

codecov bot commented Sep 22, 2021

Codecov Report

Merging #5999 (c3cbac7) into maint (d703165) will decrease coverage by 2.22%.
The diff coverage is 100.00%.

❗ Current head c3cbac7 differs from pull request most recent head c52bce3. Consider uploading reports for the commit c52bce3 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##            maint    #5999      +/-   ##
==========================================
- Coverage   90.27%   88.04%   -2.23%     
==========================================
  Files         308      305       -3     
  Lines       42116    42085      -31     
==========================================
- Hits        38021    37055     -966     
- Misses       4095     5030     +935     
Impacted Files Coverage Δ
datalad/distribution/dataset.py 96.63% <100.00%> (+2.21%) ⬆️
datalad/plugin/wtf.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/plugin/addurls.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/plugin/no_annex.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/plugin/add_readme.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/plugin/check_dates.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/support/tests/utils.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/plugin/export_archive.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/plugin/export_to_figshare.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/metadata/extractors/tests/test_audio.py 19.35% <0.00%> (-80.65%) ⬇️
... and 73 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 d703165...c52bce3. Read the comment docs.

@yarikoptic
Copy link
Member Author

crawler issue is unrelated. filed datalad/datalad-crawler#104

import of datalad.api already causes all the binds to happen.
That would eliminate the need for duplicate code for binding them
within __getattr__
Copy link
Member

@mih mih left a comment

Choose a reason for hiding this comment

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

OK, let's do this. However, I want to put on record that I believe we might end up revisiting this. More extensions, will ultimately require more careful, less unconditional importing to avoid uncontrolled slowdown. But for now the reduced complexity is attractive!

@mih
Copy link
Member

mih commented Sep 24, 2021

Travis issue seems unrelated.

@mih mih merged commit 611c371 into datalad:maint Sep 24, 2021
@yarikoptic yarikoptic deleted the bf-bind-datasetmethods-for-getattr branch September 29, 2021 15:39
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.

None yet

2 participants