Skip to content

Commit

Permalink
Add parent Record class to _MonthlyRecord to fix autodoc error (#458)
Browse files Browse the repository at this point in the history
<!-- Please ensure the PR fulfills the following requirements! -->
<!-- If this is your first PR, make sure to add your details to the
AUTHORS.rst! -->
### Pull Request Checklist:
- [ ] This PR addresses an already opened issue (for bug fixes /
features)
  - This PR fixes #xyz
- [ ] (If applicable) Documentation has been added / updated (for bug
fixes / features).
- [ ] (If applicable) Tests have been added.
- [ ] CHANGELOG.rst has been updated (with summary of main changes).
- [ ] Link to issue (:issue:`number`) and pull request (:pull:`number`)
has been added.

### What kind of change does this PR introduce?

* Bug fix

### Does this PR introduce a breaking change?

Should not

### Other information:
  • Loading branch information
huard authored Feb 11, 2025
2 parents 7e2ed40 + ee0b8a6 commit 27f8c3a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ v0.18.0 (unreleased)
* New `pre-commit` hooks for `vulture` (find dead code) and `codespell` (spelling errors).
* Removed several `type: ignore` statements.
* Spelling errors in documentation have been addressed.
* Fix bug in _MonthlyRecord class definition crashing the pydantic-autodoc serialization. (PR #458)

v0.17.0 (2025-01-27)
--------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def rebuild_readme():
"sphinx_codeautolink",
"sphinx_copybutton",
"sphinxcontrib.cairosvgconverter",
# "sphinxcontrib.autodoc_pydantic", # FIXME: Does not seem to be compatible with RavenPy codebase.
"sphinxcontrib.autodoc_pydantic",
]

linkcheck_ignore = [
Expand Down
2 changes: 1 addition & 1 deletion environment-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
dependencies:
- python >=3.12,<3.13
- raven-hydro >=0.3.1,<1.0
# - autodoc-pydantic # disabled
- autodoc-pydantic
- birdy
- cairosvg >=2.6.0
- cartopy >=0.23.0
Expand Down
6 changes: 2 additions & 4 deletions src/ravenpy/config/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,11 +1077,9 @@ class TerrainClasses(ListCommand):
_Units: Sequence[str] = PrivateAttr(["m", "km/km2"])


class _MonthlyRecord:
class _MonthlyRecord(Record):
name: str = "[DEFAULT]"
values: Sequence[float] = 12 * [
1.0,
]
values: Sequence[float] = 12 * [1.0]

def __str__(self):
return f"{self.name:<16} " + ", ".join(map(str, self.values))
Expand Down

0 comments on commit 27f8c3a

Please sign in to comment.