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
15 changes: 15 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM mcr.microsoft.com/devcontainers/python:1-3.12-bookworm

ARG POETRY_VERSION=2.0.1

ENV TZ=Etc/UTC \
POETRY_HOME=/opt/poetry \
VIRTUAL_ENV=/home/vscode/.venv \
POETRY_VIRTUALENVS_CREATE=false
ENV PATH="${VIRTUAL_ENV}/bin:${POETRY_HOME}/bin:${PATH}"

RUN python -m venv "${POETRY_HOME}" \
&& "${POETRY_HOME}/bin/python" -m pip install --no-cache-dir \
"poetry==${POETRY_VERSION}" \
&& python -m venv "${VIRTUAL_ENV}" \
&& chown -R vscode:vscode "${VIRTUAL_ENV}"
27 changes: 27 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "cwms-cli",
"build": {
"dockerfile": "Dockerfile",
"args": {
"POETRY_VERSION": "2.0.1"
}
},
"remoteUser": "vscode",
"containerEnv": {
"TZ": "Etc/UTC",
"POETRY_HOME": "/opt/poetry",
"VIRTUAL_ENV": "/home/vscode/.venv",
"POETRY_VIRTUALENVS_CREATE": "false"
},
"postCreateCommand": "git config --global --add safe.directory \"$(pwd)\" && poetry install --with dev --no-interaction",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python"
],
"settings": {
"python.defaultInterpreterPath": "/home/vscode/.venv/bin/python"
}
}
}
}
14 changes: 14 additions & 0 deletions .github/workflows/cli-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,17 @@ jobs:

- name: Run full test suite
run: poetry run pytest -q

test-devcontainer:
name: Test dev container on 3.12
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v7

- name: Build dev container and run tests
uses: devcontainers/ci@v0.3
with:
push: never
runCmd: poetry run pytest -q
16 changes: 15 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
# AGENTS.md
# Repository instructions

Guidance for coding agents working in `HydrologicEngineeringCenter/cwms-cli`.

- Never push to `origin` unless the user explicitly says they are ready for
that push.
- Use JDK 21 or newer for new work that is not intended to run on T7 systems.
On Windows, use JDK 21 at `C:\Program Files\Java\jdk-21`. On Linux or other
Unix-like systems, select an installed JDK 21 or newer through `JAVA_HOME`.
Use another Java version only when the target or task requires it.
- Use the `.devcontainer` Linux/Python 3.12 environment for changes involving
time zones, paths, native libraries, HEC-DSS, or other operating-system-
dependent behavior.
- Run the full dev-container test suite with
`devcontainer exec --workspace-folder . poetry run pytest -q` when the dev
container is available. The standard CI matrix separately covers Python 3.9
and Python 3.12 package compatibility.

## Terminal colors

- Use the shared helpers in `cwmscli.utils.colors` for user-facing terminal
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,21 @@ from cwmscli.usgs.getusgs_cda import getusgs_cda
from cwmscli.usgs.getusgs_measurements_cda import getusgs_measurements_cda
from cwmscli.usgs.getUSGS_ratings_cda import getusgs_rating_cda
```

## Development environment

The repository includes a Linux/Python 3.12 development container exercised by
a dedicated CI job. Open the repository with the VS Code Dev Containers
extension, or use the Dev Container CLI:

```sh
devcontainer up --workspace-folder .
devcontainer exec --workspace-folder . poetry run pytest -q
```

The container installs project dependencies with Poetry and uses
`/home/vscode/.venv`, so it does not reuse a host operating system's `.venv`.
Poetry itself is kept in a separate `/opt/poetry` environment. Use the container
for changes involving time zones, paths, native libraries, or other
operating-system-dependent behavior. Standard Python 3.9 and Python 3.12
installations remain covered by the existing CI matrix.