bug: AttributeError: module 'vortex' has no attribute 'io'
The version of python package vertex_array is 0.25.2.
repro steps:
- pip3 install vortex-array
- python code:
vortex.io
error message:
>>> vortex.io
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'vortex' has no attribute 'io'
Apologies, I didn't realise folks were making use of the Python bindings! I will bring back this behaviour.
Note also there have been other breaking changes to the Python API, mostly moving some pieces around.
To be a little more helpful, vortex.io is now a Python package, and therefore you need to import it as from vortex import io or import vortex.io; vortex.io.blah(...)
import vortex; vortex.io only works when io is an attribute of the vortex module
To be a little more helpful,
vortex.iois now a Python package, and therefore you need to import it asfrom vortex import ioorimport vortex.io; vortex.io.blah(...)
import vortex; vortex.ioonly works wheniois an attribute of thevortexmodule
Thanks~
I actually want to fix this so that import vortex; vortex.io works. I think I prefer it vs the current Python package model where you must separately import the io package!
since @gatesn mentioned he wanted to fix, assigning to him
but @claude, maybe you want to give it a go?
Claude finished @blaginin's task —— View job • claude/issue-2668-20250728-2044 • Create PR ➔
✅ Fixed the vortex.io AttributeError issue
Todo List
- [x] Explore the Python binding structure in
/vortex-python - [x] Understand the current
vortexmodule implementation - [x] Identify why
vortex.iois not accessible as an attribute - [x] Implement the fix to make
import vortex; vortex.iowork - [x] Test the changes
- [x] Run linting and checks
- [x] Commit and push changes
Solution Implemented
The issue was that the io module wasn't imported in the main __init__.py file. I added:
from . import ioto the imports"io"to the__all__list
This allows both import styles to work correctly:
- ✅
import vortex; vortex.io.read_url(...) - ✅
from vortex import io; io.read_url(...)
Testing
- ✅ Verified the fix works with a test script
- ✅ All existing Python tests pass (38 passed, 1 skipped, 7 xfailed)
- ✅ Clippy linting passes without warnings
Changes Made
- File:
/vortex-python/python/vortex/__init__.py - Change: Added import and export of the
iomodule