At most two positional arguments in the public API; the rest keyword-only
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- python
- Domain
- backend-api-design
Research direction
Start by reading the public APIs named in the issue: metrics, Comparer and ComparerCollection, SkillTable, Quantity, DummyModelResult, and the plotting entry points. Check their existing signatures and call sites to understand the scope of positional argument changes and whether compatibility warnings are needed. Done means the listed APIs enforce the positional argument policy, with the chosen compatibility approach applied consistently.
Written by the indexing model from the issue text.
Description
Public functions should take at most two positional arguments; everything after is keyword-only. scikit-learn does this for its metrics, e.g. mean_squared_error(y_true, y_pred, *, sample_weight=None, ...). A keyword call says what each value means, and a misplaced positional value then fails at the call instead of being used for the wrong thing.
The constructors, match() and from_matched() already do this. These do not:
| function | positional parameters |
|---|---|
metrics.rmse, mae, urmse, cc, c_rmse, c_mae, c_urmse and their long-name aliases |
obs, model, weights (rmse: also unbiased) |
metrics.hit_ratio, lin_slope, peak_ratio/pr |
obs, model, a / reg_method / inter_event_level, AAP, inter_event_time |
metrics.metric (decorator) |
best, has_units, display_name |
Quantity |
name, unit, is_directional |
DummyModelResult |
name, data, strategy; also the only model result where data is not first |
*.trim |
start_time, end_time, buffer, no_overlap |
Comparer.sel, ComparerCollection.sel |
model, (observation, quantity,) start, end, time, area, z |
Comparer.gridded_skill, ComparerCollection.gridded_skill |
bins, binsize, by, metrics, n_min |
ComparerCollection.skill |
by, metrics, observed |
SkillTable.style |
decimals, metrics, cmap, show_best |
Comparer.from_matched_data |
14 parameters |
cmp.plot.kde, residual_hist; cc.plot.residual_hist, spatial_overview, temporal_coverage; SkillArray.plot.grid |
ax, title, figsize, … |
ms.plotting.spatial_overview, taylor_diagram, TaylorPoint |
5–7 each |
skill() deserves keyword-only from the start, even though it has two parameters: cmp.skill("rmse") passes "rmse" as by and fails with KeyError: 'rmse'. The same goes for sel(), where only model is an obvious first argument.
Positional calls past the second argument will break. Either do it in the next major release, or first emit a FutureWarning for one minor release when a positional argument is passed where the keyword will be required.
- Dominant language
- Python
- Stars
- 58
- Forks
- 10
- Avg merge
- 28m
- Merged PRs (30d)
- 1
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DHI/modelskill
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
DHI/modelskill#732 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
DHI/modelskill#731 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
DHI/modelskill#728 ·
Maintainers usually reply within 1 day
-
NSE and R2 return 1.0 when model values are NaNMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
DHI/modelskill#720 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
DHI/modelskill#628 ·
Maintainers usually reply within 1 day
Similar issues
-
The changelog workflow excludes otelbot but not dependabot, so every Dependabot pull request fails the changelog checkPossibly taken @ocelotl claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 82/100
open-telemetry/opentelemetry-python#5825 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cuga-project/cuga-agent#1020 ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
microsoft/playwright#43640 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
stac-utils/stac-fastapi-elasticsearch-opensearch#965 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day