-
Notifications
You must be signed in to change notification settings - Fork 256
fix: psycopg2 Import Handling in PostgresIndex #576
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
Conversation
Move import from class definition to module level with proper type checking. Class-level import was executing at class definition time, not instantiation.
@m0n0x41d I don't think we can move the import from the class definition to the top-level file as it means we will see this error https://github.com/aurelio-labs/semantic-router/actions/runs/14444373527/job/40501518537?pr=576#step:6:32 will occur whenever someone tries to use the lib without postgres installed Other changes to contributing guidelines are good |
@jamescalam Hello, thank you for taking a look here. I am incredibly sorry for being blind to it; you are right that we can't break an import of a base library when the optional dependency is not installed. However, as I wrote in the related issue, the import in the instance constructor is simply not working because of Python's namespace nature. I've pushed a small fix, moving an exception raise into init, based on a simple flag we are setting in the try/except import. Please take a look and run tests when you have spare time. |
@jamescalam hello? |
hey @m0n0x41d apologies for the delay - running tests now, thanks for the fix for the original issue |
6b1dd0c
into
aurelio-labs:james/pg-import-fix
@m0n0x41d it's merged - thanks for the PR! |
Summary of Changes
uv sync --extra all
instead ofuv pip install -e .[dev]
for development environment setup, ensuring all dependencies (including postgres) are properly installedNotes