Fix CI Ruff failures and install MkDocs dependencies in Vercel builds#48
Conversation
Agent-Logs-Url: https://github.com/quantumdynamics927-dotcom/QPyth/sessions/ed476ffc-1ea5-43ae-9624-0d3544d77b41 Co-authored-by: quantumdynamics927-dotcom <247722560+quantumdynamics927-dotcom@users.noreply.github.com>
Agent-Logs-Url: https://github.com/quantumdynamics927-dotcom/QPyth/sessions/ed476ffc-1ea5-43ae-9624-0d3544d77b41 Co-authored-by: quantumdynamics927-dotcom <247722560+quantumdynamics927-dotcom@users.noreply.github.com>
Agent-Logs-Url: https://github.com/quantumdynamics927-dotcom/QPyth/sessions/ed476ffc-1ea5-43ae-9624-0d3544d77b41 Co-authored-by: quantumdynamics927-dotcom <247722560+quantumdynamics927-dotcom@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR unblocks CI and Vercel deployments by addressing Ruff lint failures in the Neon database scripts and ensuring the MkDocs toolchain is installed in the Vercel build environment.
Changes:
- Add a
docsoptional dependency group (MkDocs + theme/extensions) and include it in theallextra. - Update
vercel.jsonto install.[web,database,docs]somkdocs buildcan run during Vercel builds. - Apply Ruff-driven cleanup/formatting to Neon integration scripts and database-related modules.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
vercel.json |
Installs the new docs extra in Vercel so MkDocs is available at build time. |
pyproject.toml |
Introduces docs optional dependencies and adds them to the all extra. |
quantumpytho/modules/database.py |
Typing/import cleanup and formatting changes related to Ruff. |
migrate.py |
Ruff formatting cleanups (lists, trailing commas, whitespace). |
server.py |
Minor formatting changes around optional DB wiring/messages. |
test_neon_integration.py |
Removes unused imports/duplicate imports and fixes Ruff formatting issues. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Create a disabled instance | ||
| _db_instance = NeonDatabase.__new__(NeonDatabase) | ||
| _db_instance.config = DatabaseConfig() |
There was a problem hiding this comment.
get_database() returns a “disabled” _db_instance when psycopg2 isn’t available, but it still sets config = DatabaseConfig() (which may read a non-empty DATABASE_URL). That can make db.config.is_configured true even though the instance cannot execute queries (no pool), causing runtime errors in callers that only gate on is_configured.
Adjust the disabled-instance branch to ensure is_configured is false (e.g., override database_url to "" / use a dedicated disabled config) or raise ImportError from get_database() when PSYCOPG2_AVAILABLE is false so callers can reliably disable DB features.
| # Create a disabled instance | |
| _db_instance = NeonDatabase.__new__(NeonDatabase) | |
| _db_instance.config = DatabaseConfig() | |
| # Create a disabled instance with an explicitly disabled config so | |
| # callers can reliably use `config.is_configured` to gate DB usage. | |
| _db_instance = NeonDatabase.__new__(NeonDatabase) | |
| _db_instance.config = DatabaseConfig(database_url="") |
| # Database integration (optional) | ||
| try: | ||
| from quantumpytho.modules.database import ( | ||
| get_database, | ||
| init_schema, | ||
| log_api_request, | ||
| log_quantum_job, | ||
| save_vqe_result, | ||
| ) | ||
|
|
||
| DATABASE_AVAILABLE = True |
There was a problem hiding this comment.
DATABASE_AVAILABLE is set based on whether quantumpytho.modules.database imports, but that module intentionally swallows ImportError for psycopg2 and still imports successfully. As a result, DATABASE_AVAILABLE can be True even when the database dependency isn’t installed, leading to repeated runtime failures in get_database()/log_api_request paths.
Consider importing and checking PSYCOPG2_AVAILABLE (or similar) to set DATABASE_AVAILABLE accurately, or make the database module raise ImportError when psycopg2 is missing so this guard behaves as intended.
The CI test matrix was failing before tests ran because Ruff rejected newly added Neon database scripts. Separately, the Vercel deployment attempted to run
mkdocs buildwithout installing the documentation toolchain.CI lint failures
Packaging / deploy config
docsoptional dependency group inpyproject.tomlfor the MkDocs toolchain.vercel.jsonto install.[web,database,docs]so the deploy environment includes the docs builder it invokes.Targeted cleanup
Example of the deploy-side change:
{ "installCommand": "python3 -m venv .vercel-venv && ./.vercel-venv/bin/python -m pip install --upgrade pip setuptools wheel && ./.vercel-venv/bin/python -m pip install -e .[web,database,docs]" }