Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .devcontainer/antigravity/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"version": "0.9.5"
},
"ghcr.io/devcontainers-extra/features/actions-runner:1": {
"version": "latest",
"dotnetVersion": "latest"
"version": "2.319.1",
"dotnetVersion": "8.0"
},
"ghcr.io/devcontainers-extra/features/age:1": {
"version": "1.2.1"
Expand Down
6 changes: 3 additions & 3 deletions .devcontainer/vscode/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"version": "0.9.5"
},
"ghcr.io/devcontainers-extra/features/actions-runner:1": {
"version": "latest",
"dotnetVersion": "latest"
"version": "2.319.1",
"dotnetVersion": "8.0"
},
"ghcr.io/devcontainers-extra/features/age:1": {
"version": "1.2.1"
Expand Down Expand Up @@ -115,7 +115,7 @@

// Load encrypted environment variables automatically (with error tolerance)
"postCreateCommand": {
"setup bashrc": "grep -qF 'source \\${containerWorkspaceFolder}/scripts/load-env.siner h' ~/.bashrc || echo 'source \\${containerWorkspaceFolder}/scripts/load-env.sh' >> ~/.bashrc"
"setup bashrc": "grep -qF 'source \\${containerWorkspaceFolder}/scripts/load-env.sh' ~/.bashrc || echo 'source \\${containerWorkspaceFolder}/scripts/load-env.sh' >> ~/.bashrc"
},
"postStartCommand": {
"install ggshield": "sudo /usr/local/py-utils/bin/pipx install --global ggshield"
Expand Down
9 changes: 9 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ uv run pytest --cov=middleware/sql_to_arc middleware/sql_to_arc/tests/
- DB passwords and API secrets should be managed via environment variables or `.env`.
- `client.key` is dynamically handled in container secrets (`tmpfs`).

## ✨ Code Quality Standards

Agents are expected to maintain high code quality by addressing issues reported by the project's configured tools: **Ruff, Pylance, MyPy, Pylint, and Bandit**.

- **Automatic Fixes**: Actively check for and fix code smells, warnings, and notices.
- **Real Fixes vs. Suppression**: Issues must be resolved with actual code changes. Using comments to suppress warnings (e.g., `# noqa`, `# type: ignore`, `# pylint: disable`) is an **option of last resort**.
- **When to Suppress**: Only suppress if a fix is technically impossible or would result in unnecessarily complex or unreadable code.
- **Comprehensive Coverage**: Fix all reported issues, including low-severity notices and warnings, not just critical errors.

## 📚 File Modifications Pattern

When editing files:
Expand Down
29 changes: 20 additions & 9 deletions docker/Dockerfile.sql_to_arc
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,33 @@ COPY middleware ./middleware
# as pre-built wheels on PyPI.
# 3. Thus, we use 'uv sync' to create a virtual environment (.venv) and resolve all
# complex dependencies exactly as specified in the uv.lock.
RUN HATCH_VCS_PRETEND_VERSION=${APP_VERSION#v} \
SETUPTOOLS_SCM_PRETEND_VERSION=${APP_VERSION#v} \
RUN SETUPTOOLS_SCM_PRETEND_VERSION=${APP_VERSION#v} \
uv sync --no-dev

# 4. Finally, for packages like sql_to_arc that exist both as a workspace dependency
# and as a pre-built wheel, we explicitly 'uv pip install' the wheel. This ensures
# we use our optimized, pre-built package instead of the 'editable' source install.
RUN HATCH_VCS_PRETEND_VERSION=${APP_VERSION#v} \
SETUPTOOLS_SCM_PRETEND_VERSION=${APP_VERSION#v} \
# 4. Install the application wheel.
# This replaces the editable install from 'uv sync' with the optimized wheel.
RUN SETUPTOOLS_SCM_PRETEND_VERSION=${APP_VERSION#v} \
uv pip install /tmp/wheels/*.whl pyinstaller

# 5. FIX: Manually reinstall git dependencies using their INTERNAL names (underscore)
# to ensure proper namespace installation. We do this AFTER installing the wheel
# to ensure the namespace merging happens correctly.
RUN . .venv/bin/activate && \
uv pip install --force-reinstall \
"api_client @ git+https://github.com/fairagro/m4.2_advanced_middleware_api.git@main#subdirectory=middleware/api_client" \
"shared @ git+https://github.com/fairagro/m4.2_advanced_middleware_api.git@main#subdirectory=middleware/shared"
Comment thread
Zalfsten marked this conversation as resolved.

# Build standalone binary using the .venv's context.
# We point PyInstaller to the 'main.py' INSTALLED in site-packages.
# Since we merged everything into site-packages/middleware, we can largely rely on auto-discovery.
# --copy-metadata is still needed because the code checks its own version at runtime.
RUN . .venv/bin/activate && \
python -m PyInstaller --onedir \
.venv/bin/python -m PyInstaller --onedir \
--name sql_to_arc \
/build/middleware/sql_to_arc/src/middleware/sql_to_arc/main.py
--copy-metadata sql_to_arc \
--copy-metadata api_client \
--copy-metadata shared \
.venv/lib/python3.12/site-packages/middleware/sql_to_arc/main.py


# ---- Runtime Stage ----
Expand Down
4 changes: 0 additions & 4 deletions middleware/sql_to_arc/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ dependencies = [
"opentelemetry-api>=1.39.1",
]

[tool.uv.sources]
api_client = { git = "https://github.com/fairagro/m4.2_advanced_middleware_api.git", branch = "main", subdirectory = "middleware/api_client" }
shared = { git = "https://github.com/fairagro/m4.2_advanced_middleware_api.git", branch = "main", subdirectory = "middleware/shared" }

[tool.hatch.version]
source = "vcs"
raw-options = { root = "../.." }
Expand Down
4 changes: 2 additions & 2 deletions middleware/sql_to_arc/src/middleware/sql_to_arc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ async def process_single_dataset(
)
# Use status from response if available (e.g., 'created', 'updated')
status_text = "processed"
if response.arcs:
status_text = response.arcs[0].status.value
if response.arc:
status_text = response.arc.status.value

logger.info(
"%s ARC %s successfully (RDI: %s).",
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ dev = [

[tool.uv.sources]
sql_to_arc = { workspace = true }
api_client = { git = "https://github.com/fairagro/m4.2_advanced_middleware_api.git", branch = "main", subdirectory = "middleware/api_client" }
shared = { git = "https://github.com/fairagro/m4.2_advanced_middleware_api.git", branch = "main", subdirectory = "middleware/shared" }

[tool.uv.workspace]
members = [
Expand Down
Loading