diff --git a/SETUP.MD b/SETUP.MD new file mode 100644 index 000000000..20f5094ab --- /dev/null +++ b/SETUP.MD @@ -0,0 +1,90 @@ +# SETUP.MD + +## Prerequisites + +- Python 3.11+ +- [uv](https://docs.astral.sh/uv/) 0.5+ + +### Supported platforms + +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. + +- [x] Linux +- [ ] Windows +- [ ] macOS + +## Environment Variables + +### Standard (injected by pipeline) + +None of the standard pipeline variables are required for environment setup, build, or unit tests. + +### Project-specific + +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. + +## Setup + +```bash +# Install uv if not already on PATH (no-op when pre-installed by the pipeline) +python3 -m pip install --upgrade uv + +# Sync the package with dev dependencies and all optional extras +uv sync --all-extras +``` + +## Verify Setup + +```bash +python3 --version +uv --version +uv run python -c "import uipath_langchain; print('uipath_langchain ok')" +``` + +## Build + +```bash +uv build +``` + +## Test + +```bash +uv run pytest +``` + +## Sample Code Change + +### The change + +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: + +```python +def get_execution_job_id() -> str | None: + """Reads the agent's executing job key from the runtime environment.""" + return os.environ.get("UIPATH_JOB_KEY") +``` + +Then create `tests/utils/test_environment_job_id.py` with two pytest tests: + +```python +import pytest + +from uipath_langchain._utils._environment import get_execution_job_id + + +def test_get_execution_job_id_unset(monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.delenv("UIPATH_JOB_KEY", raising=False) + assert get_execution_job_id() is None + + +def test_get_execution_job_id_set(monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setenv("UIPATH_JOB_KEY", "job-abc-123") + assert get_execution_job_id() == "job-abc-123" +``` + +### Verification + +```bash +uv run pytest tests/utils/test_environment_job_id.py -v +```