Skip to content

666 repair model attribute typing and docstrings#692

Merged
davidorme merged 6 commits intodevelopfrom
666-repair-model-attribute-typing-and-docstrings
Jan 24, 2025
Merged

666 repair model attribute typing and docstrings#692
davidorme merged 6 commits intodevelopfrom
666-repair-model-attribute-typing-and-docstrings

Conversation

@sallymatson
Copy link
Copy Markdown
Collaborator

@sallymatson sallymatson commented Jan 21, 2025

Description

Move attribute declarations out of _setup to subclass __init__ functions. The attributes are now defined and documented in the proper place (e.g. see updated hydrology docs as compared to old hydrology docs).

It would be great to get general feedback, as well as everyone looking over the changes to their modules in order to make sure the variables are all typed correctly etc @vgro @davidorme @jacobcook1995 @TaranRallings.

Fixes #666

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist

  • Make sure you've run the pre-commit checks: $ pre-commit run -a
  • All tests pass: $ poetry run pytest

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works
  • Relevant documentation reviewed and updated

@sallymatson sallymatson linked an issue Jan 21, 2025 that may be closed by this pull request
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.66%. Comparing base (7838fa8) to head (1dabb2a).
⚠️ Report is 2762 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #692      +/-   ##
===========================================
+ Coverage    94.60%   94.66%   +0.05%     
===========================================
  Files           73       73              
  Lines         4800     4833      +33     
===========================================
+ Hits          4541     4575      +34     
+ Misses         259      258       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@dalonsoa dalonsoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good, and indeed this is a more canonical approach than using fake class variables.

Probably the docs should be updated to explain what goes in __init__ and what in _setup when creating a new model.

Copy link
Copy Markdown
Collaborator

@davidorme davidorme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good. Can you update the doc API files for the models to include inherited members? I think that's what we want as we currently can't see anything being inherited from the base class.

For example:

## The {mod}`~virtual_ecosystem.models.plants.plants_model` module
```{eval-rst}
.. automodule:: virtual_ecosystem.models.plants.plants_model
:autosummary:
:members:
:exclude-members: model_name
```

should go to (I think):

```{eval-rst}
.. automodule:: virtual_ecosystem.models.plants.plants_model
    :autosummary:
    :members:
    :exclude-members: model_name
    :inherited_members:
```

@sallymatson
Copy link
Copy Markdown
Collaborator Author

This is looking good. Can you update the doc API files for the models to include inherited members? I think that's what we want as we currently can't see anything being inherited from the base class.

For example:

## The {mod}`~virtual_ecosystem.models.plants.plants_model` module
```{eval-rst}
.. automodule:: virtual_ecosystem.models.plants.plants_model
:autosummary:
:members:
:exclude-members: model_name
```

should go to (I think):

```{eval-rst}
.. automodule:: virtual_ecosystem.models.plants.plants_model
    :autosummary:
    :members:
    :exclude-members: model_name
    :inherited_members:

I added this. I'm a bit confused about how the docs work TBH because in the version that I built and linked in the description above, it does seem to be showing? Is that in a different place? Anyways, added :inherited-members: to all of them !

@sallymatson sallymatson marked this pull request as ready for review January 24, 2025 08:38
@davidorme davidorme self-requested a review January 24, 2025 11:37
Copy link
Copy Markdown
Collaborator

@davidorme davidorme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good - we really need to update the model creation docs, but we also need to do that to reflect the static model changes as well, so lets do that separately under #676

@davidorme davidorme enabled auto-merge January 24, 2025 17:51
@davidorme davidorme merged commit bc8c2fa into develop Jan 24, 2025
@davidorme davidorme deleted the 666-repair-model-attribute-typing-and-docstrings branch January 9, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Repair model attribute typing and docstrings

4 participants