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

bpgl_algo importlib #120

Closed
wants to merge 1 commit into from
Closed

bpgl_algo importlib #120

wants to merge 1 commit into from

Conversation

NoahRJohnson
Copy link
Contributor

Add importlib imports for vgl, vil, vpgl as these libraries are used in the arguments of functions within bpgl_algo. This resolves Issue #119, removing the need to first import vxl.vgl before importing vxl.contrib.bpgl.algo.

…Error when not importing vxl.vgl before importing vxl.contrib.bpgl.algo
@NoahRJohnson NoahRJohnson added the bug Something isn't working label Aug 17, 2021
@NoahRJohnson
Copy link
Contributor Author

This is related to the broader Issue #107

@drewgilliam
Copy link
Member

Would it be cleaner to add to the import list in the __init__.py file?

from ._bpgl_algo import *
from vxl import vgl, vil, vpgl

Also, I'm guessing we don't see this error in CI because there are no tests for bpgl.algo?

@NoahRJohnson
Copy link
Contributor Author

NoahRJohnson commented Aug 17, 2021

Would it be cleaner to add to the import list in the __init__.py file?

from ._bpgl_algo import *
from vxl import vgl, vil, vpgl

Also, I'm guessing we don't see this error in CI because there are no tests for bpgl.algo?

Yes, but even if we added bpgl_algo tests, we wouldn't see this error unless we explicitly imported vxl.contrib.bpgl.algo before vxl.vgl. test_pyacal doesn't import acal first, so maybe that's a design pattern we should enforce in each test file.

Adding to the import list in the init.py works, but only if we import vgl first:

from vxl import vgl, vil, vpgl
from ._bpgl_algo import *

otherwise the _bpgl_algo import still fails with an ImportError as below
user@7d694eb4189b:/$ python -c "import vxl.contrib.bpgl.algo" Traceback (most recent call last): File "<string>", line 1, in <module> File "/install/lib/python3/site-packages/vxl/contrib/bpgl/algo/__init__.py", line 1, in <module> from ._bpgl_algo import * ImportError: arg(): could not convert default argument 'target_window: vgl_box_2d<int>' in method '<class 'vxl.contrib.bpgl.algo._bpgl_algo.rectify_image_pair_affine'>.process' into a Python object (type not registered yet?)

I don't remember if there's any reason not to do it this way.

@drewgilliam drewgilliam mentioned this pull request Aug 17, 2021
@drewgilliam
Copy link
Member

superceded by PR #122

@drewgilliam drewgilliam deleted the bpgl_algo_imports branch August 26, 2021 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants