add support for Qdrant cloud & fix path to run project from inside folder #2
add support for Qdrant cloud & fix path to run project from inside folder #2Goodnight77 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to add Qdrant Cloud connectivity (via QDRANT_API_KEY + HTTPS URL handling) and adjust the module/import structure so the CLI can be launched from within the project directory.
Changes:
- Add
QDRANT_API_KEYto configuration and plumb it intoQdrant-clientinitialization. - Update
QdrantCleanerconstruction logic to support HTTPS/Qdrant Cloud via theurl+api_keyclient parameters. - Update README and provide a
.env.examplefor local/cloud configuration.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
README.md |
Documents local vs cloud configuration and updates run instructions. |
config.py |
Adds QDRANT_API_KEY env var support. |
cleaner.py |
Updates QdrantCleaner to initialize QdrantClient with url/api_key for cloud. |
cleaner_cli.py |
Wires API key into CLI client creation; adjusts imports and URL parsing. |
.env.example |
Adds example env vars for URL + API key. |
__main__.py |
Changes CLI entry import to a bare-module import. |
__init__.py |
Changes re-exports to bare-module imports. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from config import CANONICAL_TEXT_FIELDS, QDRANT_API_KEY | ||
| from dependencies import ( |
There was a problem hiding this comment.
These top-level imports switched to bare-module imports (from config ..., from dependencies ...). If this directory is used as a package (README advertises qdrant_manager.* and there are still relative imports in this file, e.g. from .dependencies import qdrant_models later), import qdrant_manager / python -m qdrant_manager will fail because config/dependencies won’t resolve as top-level modules. Please standardize the import strategy (e.g., keep explicit relative imports within the package, or use a dual-mode try/except import pattern consistently across the file).
| from cleaner import QdrantCleaner | ||
| from config import QDRANT_DIRECT, QDRANT_API_KEY |
There was a problem hiding this comment.
from cleaner import ... / from config import ... will break when this code is executed as an installed package/module (the README still references qdrant_manager.cleaner_cli and from qdrant_manager import ...). Prefer package-relative imports (or a consistent dual-mode import fallback) so both python -m qdrant_manager and programmatic imports keep working.
| from cleaner import QdrantCleaner | |
| from config import QDRANT_DIRECT, QDRANT_API_KEY | |
| try: | |
| from .cleaner import QdrantCleaner | |
| from .config import QDRANT_DIRECT, QDRANT_API_KEY | |
| except ImportError: | |
| from cleaner import QdrantCleaner | |
| from config import QDRANT_DIRECT, QDRANT_API_KEY |
| host = parsed.hostname or "localhost" | ||
| port = parsed.port or 6333 |
There was a problem hiding this comment.
_set_qdrant_url() parses the URL but then passes only parsed.hostname into QdrantCleaner. For https://...cloud.qdrant.io this strips the scheme, so QdrantCleaner won’t take the HTTPS/cloud path and will instead try host=<domain>, port=6333, which is incorrect for Qdrant Cloud. Pass the full URL (including scheme) through to QdrantCleaner, or preserve the scheme when building the endpoint so HTTPS + API key works.
| host = parsed.hostname or "localhost" | |
| port = parsed.port or 6333 | |
| if parsed.scheme and parsed.hostname: | |
| host = qdrant_url | |
| port = parsed.port or 6333 | |
| else: | |
| host = parsed.hostname or "localhost" | |
| port = parsed.port or 6333 |
| from __future__ import annotations | ||
|
|
||
| from .cleaner_cli import QdrantCleanerCLI | ||
| from cleaner_cli import QdrantCleanerCLI |
There was a problem hiding this comment.
from cleaner_cli import QdrantCleanerCLI will fail when running as a package entry point (e.g. python -m qdrant_manager), because it imports a top-level cleaner_cli module instead of qdrant_manager.cleaner_cli. Use a package-relative import (or a dual-mode fallback) so both module execution and script execution work reliably.
| from cleaner_cli import QdrantCleanerCLI | |
| try: | |
| from .cleaner_cli import QdrantCleanerCLI | |
| except ImportError: | |
| from cleaner_cli import QdrantCleanerCLI |
| from cleaner import QdrantCleaner | ||
| from cleaner_cli import QdrantCleanerCLI |
There was a problem hiding this comment.
These imports changed to from cleaner ... / from cleaner_cli .... If this is a package (as implied by __init__.py and the README’s qdrant_manager.* examples), this will raise ModuleNotFoundError because cleaner/cleaner_cli aren’t top-level modules— they’re package modules. Use relative imports (e.g. from .cleaner import ...) or otherwise ensure package-qualified imports so import qdrant_manager works.
| from cleaner import QdrantCleaner | |
| from cleaner_cli import QdrantCleanerCLI | |
| from .cleaner import QdrantCleaner | |
| from .cleaner_cli import QdrantCleanerCLI |
| The tool reads `QDRANT_URL` and `QDRANT_API_KEY` from the environment. | ||
|
|
||
| **Local Qdrant (Docker/self-hosted):** | ||
| ```bash | ||
| export QDRANT_URL=http://localhost:6333 | ||
| python -m qdrant_manager | ||
| python __main__.py | ||
| ``` | ||
|
|
||
| **Qdrant Cloud:** | ||
| ```bash | ||
| export QDRANT_URL=https://<your-cluster-id>.<region>.cloud.qdrant.io | ||
| export QDRANT_API_KEY=<your-api-key> | ||
| python __main__.py | ||
| ``` |
There was a problem hiding this comment.
The README now instructs running python __main__.py, but the rest of the README still presents this as an importable package (qdrant_manager.* surface and from qdrant_manager import QdrantCleaner). These two modes require different import structures; as written, the docs are internally inconsistent and will likely confuse users. Please align the run instructions with the supported execution mode (e.g. prefer python -m qdrant_manager for package usage, or update the package-surface/programmatic examples if the project is moving to a script-only layout).
description
this PR adds Qdrant Cloud support and fixes the module import structure
changes
QDRANT_API_KEYenvironment variable and HTTPS URL handlingpython __main__.pyusage
Local Qdrant:
export QDRANT_URL=http://localhost:6333 python __main__.pyQdrant cloud:
close issue #1