|
| 1 | +# SETUP.md |
| 2 | + |
| 3 | +## Prerequisites |
| 4 | + |
| 5 | +- Python 3.11+ |
| 6 | +- [uv](https://docs.astral.sh/uv/) 0.5+ |
| 7 | + |
| 8 | +### Supported platforms |
| 9 | + |
| 10 | +This checklist controls the Agentic Inner Loop KPI pipeline targets (clean Linux VM). The repo's own GitHub Actions CI additionally tests on `windows-latest`, but that is not measured by this KPI. |
| 11 | + |
| 12 | +- [x] Linux |
| 13 | +- [ ] Windows |
| 14 | +- [ ] macOS |
| 15 | + |
| 16 | +## Environment Variables |
| 17 | + |
| 18 | +### Standard (injected by pipeline) |
| 19 | + |
| 20 | +None of the standard pipeline variables are required for environment setup, build, or unit tests. |
| 21 | + |
| 22 | +### Project-specific |
| 23 | + |
| 24 | +None. The unit-test suite under the `Test` section below runs fully offline and requires no external authentication. The repo's own GitHub Actions CI passes `UIPATH_URL`, `UIPATH_CLIENT_ID`, and `UIPATH_CLIENT_SECRET` to support optional integration paths, but the default `pytest` invocation does not depend on them and the KPI pipeline does not need to provide them. |
| 25 | + |
| 26 | +## Setup |
| 27 | + |
| 28 | +```bash |
| 29 | +# Install uv if not present |
| 30 | +curl -LsSf https://astral.sh/uv/install.sh | sh |
| 31 | +export PATH="$HOME/.local/bin:$PATH" |
| 32 | + |
| 33 | +# Sync the package with dev dependencies and all optional extras |
| 34 | +uv --directory . sync --all-extras |
| 35 | +``` |
| 36 | + |
| 37 | +## Verify Setup |
| 38 | + |
| 39 | +```bash |
| 40 | +python3 --version |
| 41 | +uv --version |
| 42 | +uv --directory . run python -c "import uipath_langchain; print('uipath_langchain ok')" |
| 43 | +``` |
| 44 | + |
| 45 | +## Build |
| 46 | + |
| 47 | +```bash |
| 48 | +uv --directory . build |
| 49 | +``` |
| 50 | + |
| 51 | +## Test |
| 52 | + |
| 53 | +```bash |
| 54 | +uv --directory . run pytest |
| 55 | +``` |
| 56 | + |
| 57 | +## Sample Code Change |
| 58 | + |
| 59 | +### The change |
| 60 | + |
| 61 | +Add a new `get_execution_job_id` helper to `src/uipath_langchain/_utils/_environment.py`, immediately after the existing `get_default_timeout` function. The helper is the symmetric complement of the existing `get_execution_folder_path` — it reads the `UIPATH_JOB_KEY` env var at runtime: |
| 62 | + |
| 63 | +```python |
| 64 | +def get_execution_job_id() -> str | None: |
| 65 | + """Reads the agent's executing job key from the runtime environment.""" |
| 66 | + return os.environ.get("UIPATH_JOB_KEY") |
| 67 | +``` |
| 68 | + |
| 69 | +Then create `tests/utils/test_environment_job_id.py` with two pytest tests: |
| 70 | + |
| 71 | +```python |
| 72 | +import pytest |
| 73 | + |
| 74 | +from uipath_langchain._utils._environment import get_execution_job_id |
| 75 | + |
| 76 | + |
| 77 | +def test_get_execution_job_id_unset(monkeypatch: pytest.MonkeyPatch) -> None: |
| 78 | + monkeypatch.delenv("UIPATH_JOB_KEY", raising=False) |
| 79 | + assert get_execution_job_id() is None |
| 80 | + |
| 81 | + |
| 82 | +def test_get_execution_job_id_set(monkeypatch: pytest.MonkeyPatch) -> None: |
| 83 | + monkeypatch.setenv("UIPATH_JOB_KEY", "job-abc-123") |
| 84 | + assert get_execution_job_id() == "job-abc-123" |
| 85 | +``` |
| 86 | + |
| 87 | +### Verification |
| 88 | + |
| 89 | +```bash |
| 90 | +uv --directory . run pytest tests/utils/test_environment_job_id.py -v |
| 91 | +``` |
0 commit comments