Skip to content

Commit 015dac9

Browse files
authored
Merge branch 'main' into ownership-metadata-refresh
2 parents 7e5d76b + 24db6d6 commit 015dac9

29 files changed

Lines changed: 2144 additions & 43 deletions

.devcontainer/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM mcr.microsoft.com/devcontainers/python:1-3.12-bookworm
2+
3+
ARG POETRY_VERSION=2.0.1
4+
5+
ENV TZ=Etc/UTC \
6+
POETRY_HOME=/opt/poetry \
7+
VIRTUAL_ENV=/home/vscode/.venv \
8+
POETRY_VIRTUALENVS_CREATE=false
9+
ENV PATH="${VIRTUAL_ENV}/bin:${POETRY_HOME}/bin:${PATH}"
10+
11+
RUN python -m venv "${POETRY_HOME}" \
12+
&& "${POETRY_HOME}/bin/python" -m pip install --no-cache-dir \
13+
"poetry==${POETRY_VERSION}" \
14+
&& python -m venv "${VIRTUAL_ENV}" \
15+
&& chown -R vscode:vscode "${VIRTUAL_ENV}"

.devcontainer/devcontainer.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "cwms-cli",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"args": {
6+
"POETRY_VERSION": "2.0.1"
7+
}
8+
},
9+
"remoteUser": "vscode",
10+
"containerEnv": {
11+
"TZ": "Etc/UTC",
12+
"POETRY_HOME": "/opt/poetry",
13+
"VIRTUAL_ENV": "/home/vscode/.venv",
14+
"POETRY_VIRTUALENVS_CREATE": "false"
15+
},
16+
"postCreateCommand": "git config --global --add safe.directory \"$(pwd)\" && poetry install --with dev --no-interaction",
17+
"customizations": {
18+
"vscode": {
19+
"extensions": [
20+
"ms-python.python"
21+
],
22+
"settings": {
23+
"python.defaultInterpreterPath": "/home/vscode/.venv/bin/python"
24+
}
25+
}
26+
}
27+
}

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ body:
88
label: CLI Script
99
description: Select the script this pertains to
1010
options:
11-
- blob
12-
- cwms-cli
13-
- csv2cwms
14-
- getusgs-measurements
11+
- blob
12+
- cwms-cli
13+
- csv2cwms
14+
- dss
15+
- getusgs-measurements
1516
- getusgs-ratings
1617
- getusgs-timeseries
1718
- shefcritimport

.github/ISSUE_TEMPLATE/feature-request.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ body:
88
label: CLI Script
99
description: Select the script this pertains to
1010
options:
11-
- blob
12-
- cwms-cli
13-
- csv2cwms
14-
- getusgs-measurements
11+
- blob
12+
- cwms-cli
13+
- csv2cwms
14+
- dss
15+
- getusgs-measurements
1516
- getusgs-ratings
1617
- getusgs-timeseries
1718
- shefcritimport

.github/workflows/cli-tests.yml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,27 @@ on:
66

77
jobs:
88
test:
9-
name: Test CLI on ${{ matrix.python-version }}
10-
runs-on: ubuntu-latest
9+
name: Test CLI on ${{ matrix.name }} with Python ${{ matrix.python-version }}
10+
runs-on: ${{ matrix.os }}
1111

1212
strategy:
13+
fail-fast: false
1314
matrix:
14-
# Test 3.9 for T7, 3.12 for general/cloud use
15-
python-version: ["3.9", "3.12"]
15+
include:
16+
# Test the supported Python range on Linux and exercise the primary
17+
# Python version on each supported desktop operating system.
18+
- name: Linux
19+
os: ubuntu-latest
20+
python-version: "3.9"
21+
- name: Linux
22+
os: ubuntu-latest
23+
python-version: "3.12"
24+
- name: Windows
25+
os: windows-latest
26+
python-version: "3.12"
27+
- name: macOS
28+
os: macos-latest
29+
python-version: "3.12"
1630

1731
steps:
1832
- name: Checkout repository
@@ -38,3 +52,17 @@ jobs:
3852

3953
- name: Run full test suite
4054
run: poetry run pytest -q
55+
56+
test-devcontainer:
57+
name: Test dev container on 3.12
58+
runs-on: ubuntu-latest
59+
60+
steps:
61+
- name: Checkout repository
62+
uses: actions/checkout@v7
63+
64+
- name: Build dev container and run tests
65+
uses: devcontainers/ci@v0.3
66+
with:
67+
push: never
68+
runCmd: poetry run pytest -q

AGENTS.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1-
# AGENTS.md
1+
# Repository instructions
22

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

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

721
- Use the shared helpers in `cwmscli.utils.colors` for user-facing terminal

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,21 @@ from cwmscli.usgs.getusgs_cda import getusgs_cda
4040
from cwmscli.usgs.getusgs_measurements_cda import getusgs_measurements_cda
4141
from cwmscli.usgs.getUSGS_ratings_cda import getusgs_rating_cda
4242
```
43+
44+
## Development environment
45+
46+
The repository includes a Linux/Python 3.12 development container exercised by
47+
a dedicated CI job. Open the repository with the VS Code Dev Containers
48+
extension, or use the Dev Container CLI:
49+
50+
```sh
51+
devcontainer up --workspace-folder .
52+
devcontainer exec --workspace-folder . poetry run pytest -q
53+
```
54+
55+
The container installs project dependencies with Poetry and uses
56+
`/home/vscode/.venv`, so it does not reuse a host operating system's `.venv`.
57+
Poetry itself is kept in a separate `/opt/poetry` environment. Use the container
58+
for changes involving time zones, paths, native libraries, or other
59+
operating-system-dependent behavior. Standard Python 3.9 and Python 3.12
60+
installations remain covered by the existing CI matrix.

cwmscli/__main__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from click.core import ParameterSource
88

99
from cwmscli.commands import commands_cwms
10+
from cwmscli.dss import dss_group
1011
from cwmscli.load import __main__ as load
1112
from cwmscli.usgs import usgs_group
1213
from cwmscli.utils.click_help import add_version_to_help_tree
@@ -15,6 +16,7 @@
1516
format_cda_stack_trace,
1617
to_user_facing_error,
1718
)
19+
from cwmscli.utils.links import BUG_REPORT_URL
1820
from cwmscli.utils.logging import (
1921
LoggingConfig,
2022
apply_logging_policies,
@@ -93,6 +95,7 @@ def cli(
9395
cli.add_command(commands_cwms.clob_group)
9496
cli.add_command(commands_cwms.users_group)
9597
cli.add_command(load.load_group)
98+
cli.add_command(dss_group)
9699
add_version_to_help_tree(cli)
97100

98101

@@ -148,8 +151,9 @@ def main() -> None:
148151
friendly_error.show()
149152
raise SystemExit(friendly_error.exit_code)
150153

151-
# Preserve raw exception behavior when debug is enabled but CDA did not
152-
# provide a server stack trace.
154+
click.echo(f"Unexpected error. Report it at {BUG_REPORT_URL}", err=True)
155+
# Preserve raw exception behavior when CDA did not provide a server stack
156+
# trace so an issue report includes useful diagnostic details.
153157
raise
154158

155159

cwmscli/dss/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""Batch transfers between HEC-DSS files and CWMS Data API instances."""
2+
3+
from cwmscli.dss.cli import dss_group
4+
5+
__all__ = ["dss_group"]

0 commit comments

Comments
 (0)