Add chdb/__init__.py to prevent broken module after upgrade#543
Merged
Conversation
When users upgrade from an older chdb version, pip removes the old package's files (including chdb/__init__.py from chdb-core) before installing the new wrapper package. Since the wrapper was configured as a namespace package without its own __init__.py, the chdb module became empty — causing `AttributeError: module 'chdb' has no attribute 'connect'`. This commit: - Adds chdb/__init__.py that bootstraps chdb-core's engine, working for both regular and editable installs - Excludes .dylib/.so from package-data to prevent the wrapper wheel from shipping broken symlinks that overwrite chdb-core's binaries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AttributeError: module 'chdb' has no attribute 'connect'because the wrapper package was a namespace package without__init__.py. During upgrade, pip removes the oldchdb/__init__.py(from chdb-core) as collateral damage, and the new wrapper doesn't replace it.chdb/__init__.pythat bootstraps chdb-core's engine, working for both regular pip install, editable install, and upgrade paths..dylib/.sofrom package-data so the wrapper wheel no longer ships broken symlinks that overwrite chdb-core's binaries.Root Cause
Two packages (
chdbwrapper andchdb-core) both install files intosite-packages/chdb/. When the wrapper is upgraded:chdb/__init__.pyif it was there)__init__.pyincludedchdb-core's__init__.pymay have been removed in step 1 → module is emptyTest Plan
Verified in isolated venvs:
chdb-4.1.3→ localchdb-3.7.0wheel —chdb.connect(),chdb.query(),from chdb import datastoreall workchdb-3.7.0wheel from scratch — all workpip install -e .in dev environment — all workchdb/__init__.py+chdb/datastore.py(no.dylib/.so)