Skip to content

Commit 3b646f7

Browse files
authored
Improve messages around dependency spec management (#17969)
* Improve messages around dependency spec management 1. Validation says which commands can fix the failure. 2. Freeze/sync have docs that make it clear what they do and how they differ. 3. Freeze says what it's doing to the "static file" * add changelog * adjust test
1 parent 6ba6a69 commit 3b646f7

File tree

6 files changed

+22
-8
lines changed

6 files changed

+22
-8
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improve messages around dependency spec management

datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/dep.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,11 @@ def dep(check, require_base_check_version, min_base_check_version):
241241
message = (
242242
f'Mismatch for dependency `{name}`:\n'
243243
f' Agent: {" | ".join(sorted(agent_dependency_definitions))}\n'
244-
f' Checks: {" | ".join(sorted(check_dependency_definitions))}'
244+
f' Checks: {" | ".join(sorted(check_dependency_definitions))}\n'
245+
'If you think the Agent requirements are correct, run:\n'
246+
'ddev dep sync\n'
247+
'If you think the Checks requirements are correct, run:\n'
248+
'ddev dep freeze'
245249
)
246250
echo_failure(message)
247251
annotate_error(agent_dependencies_file, message)

ddev/changelog.d/17969.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improve messages around dependency spec management

ddev/src/ddev/cli/dep/freeze.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@
1010
)
1111

1212

13-
@click.command(short_help="Combine all dependencies for the Agent's static environment")
13+
@click.command()
1414
@click.pass_obj
1515
def freeze(app):
16-
"""Combine all dependencies for the Agent's static environment."""
16+
"""
17+
Combine all dependencies for the Agent's static environment.
18+
19+
This reads and merges the dependency specs from individual integrations and writes them to agent_requirements.in
20+
"""
1721
dependencies, errors = read_check_dependencies(app.repo)
1822

1923
if errors:
@@ -22,5 +26,5 @@ def freeze(app):
2226

2327
app.abort()
2428

25-
app.display_info(f'Static file: {app.repo.agent_requirements}')
29+
app.display_info(f'Writing combined requirements to: {app.repo.agent_requirements}')
2630
update_agent_dependencies(app.repo, dependencies)

ddev/src/ddev/cli/dep/sync.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@ def get_dependency_set(python_versions):
1919
}
2020

2121

22-
@click.command(
23-
short_help="Update integrations' dependencies so that they match the Agent's static environment",
24-
)
22+
@click.command()
2523
@click.pass_obj
2624
def sync(app):
25+
"""
26+
Synchronize integration dependency spec with that of the agent as a whole.
27+
28+
Reads dependency spec from agent_requirements.in and propagates it to all integrations.
29+
For each integration we propagate only the relevant parts (i.e. its direct dependencies).
30+
"""
2731
agent_dependencies, errors = read_agent_dependencies(app.repo)
2832

2933
if errors:

ddev/tests/cli/test_dep.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_freeze(ddev, fake_repo):
4646
agent_requirements_path = fake_repo / 'agent_requirements.in'
4747

4848
assert result.exit_code == 0
49-
assert result.output == f'Static file: {agent_requirements_path}\n'
49+
assert result.output == f'Writing combined requirements to: {agent_requirements_path}\n'
5050

5151
requirements = agent_requirements_path.read_text()
5252

0 commit comments

Comments
 (0)