Skip to content

Conversation

@Fokko
Copy link
Contributor

@Fokko Fokko commented Feb 10, 2025

Sometime I'm seeing this:

ImportError while loading conftest '/home/runner/work/iceberg-python/iceberg-python/tests/conftest.py'.
tests/conftest.py:52: in <module>
    from pyiceberg.catalog import Catalog, load_catalog
pyiceberg/catalog/__init__.py:51: in <module>
    from pyiceberg.serializers import ToOutputFile
pyiceberg/serializers.py:25: in <module>
    from pyiceberg.table.metadata import TableMetadata, TableMetadataUtil
pyiceberg/table/__init__.py:65: in <module>
    from pyiceberg.io.pyarrow import ArrowScan, schema_to_pyarrow
pyiceberg/io/pyarrow.py:141: in <module>
    from pyiceberg.table.locations import load_location_provider
pyiceberg/table/locations.py:25: in <module>
    from pyiceberg.table import TableProperties
E   ImportError: cannot import name 'TableProperties' from partially initialized module 'pyiceberg.table' (most likely due to a circular import) (/home/runner/work/iceberg-python/iceberg-python/pyiceberg/table/__init__.py)

Also observed in: #1388

I prefer the imports at the top, but I think this is a small price to pay to avoid having circular imports.

Sometime I'm seeing this:

```
ImportError while loading conftest '/home/runner/work/iceberg-python/iceberg-python/tests/conftest.py'.
tests/conftest.py:52: in <module>
    from pyiceberg.catalog import Catalog, load_catalog
pyiceberg/catalog/__init__.py:51: in <module>
    from pyiceberg.serializers import ToOutputFile
pyiceberg/serializers.py:25: in <module>
    from pyiceberg.table.metadata import TableMetadata, TableMetadataUtil
pyiceberg/table/__init__.py:65: in <module>
    from pyiceberg.io.pyarrow import ArrowScan, schema_to_pyarrow
pyiceberg/io/pyarrow.py:141: in <module>
    from pyiceberg.table.locations import load_location_provider
pyiceberg/table/locations.py:25: in <module>
    from pyiceberg.table import TableProperties
E   ImportError: cannot import name 'TableProperties' from partially initialized module 'pyiceberg.table' (most likely due to a circular import) (/home/runner/work/iceberg-python/iceberg-python/pyiceberg/table/__init__.py)
```

Also observed in: apache#1388

I prefer the imports at the top, but I think this is a small price
to pay to avoid having circular imports.
@Fokko Fokko requested a review from kevinjqliu February 10, 2025 18:43
@kevinjqliu kevinjqliu merged commit c2529b9 into apache:main Feb 10, 2025
7 checks passed
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.

2 participants