Skip to content

changed default types to float in solarposition.py#2280

Merged
kandersolar merged 6 commits into
pvlib:mainfrom
kurt-rhee:main
Dec 3, 2024
Merged

changed default types to float in solarposition.py#2280
kandersolar merged 6 commits into
pvlib:mainfrom
kurt-rhee:main

Conversation

@kurt-rhee

@kurt-rhee kurt-rhee commented Oct 29, 2024

Copy link
Copy Markdown
Contributor
  • Closes (NONE)
  • I am familiar with the contributing guidelines
  • Tests added
  • Updates entries in docs/sphinx/source/reference for API changes.
  • Adds description and name entries in the appropriate "what's new" file in docs/sphinx/source/whatsnew for all changes. Includes link to the GitHub Issue with :issue:`num` or this Pull Request with :pull:`num`. Includes contributor name and/or GitHub username (link with :ghuser:`user`).
  • New code is fully documented. Includes numpydoc compliant docstrings, examples, and comments where necessary.
  • Pull request is nearly complete and ready for detailed review.
  • Maintainer: Appropriate GitHub Labels (including remote-data) and Milestone are assigned to the Pull Request and linked Issue.

I have added type hints to get_solarposition() and I have also changed the default values of the function inputs to float instead of int to make my linter stop yelling at me.

@kurt-rhee

Copy link
Copy Markdown
Contributor Author

This pull request will fail on flake8 due to line lengths on some of the documentation. I am not sure how to fix it.

@cwhanse

cwhanse commented Oct 29, 2024

Copy link
Copy Markdown
Member

I have added type hints to get_solarposition()

There have been debates on adding type hints, and I don't think we're agreed that pvlib benefits by adding them.

Specifying float for those defaults is not controversial; thanks for doing that.

@kurt-rhee

Copy link
Copy Markdown
Contributor Author

Got it, happy to remove type hinting if that helps push this PR through.

@kandersolar kandersolar added this to the v0.11.2 milestone Oct 30, 2024
@kandersolar

Copy link
Copy Markdown
Member

Agreed, there is no consensus about adopting type hints in pvlib. Until then, no hints!

Nitpick: if the default values are changing from int to float (e.g. 12 to 12.0), then the docstrings should change as well (temperature : float, default 12. instead of temperature : float, default 12).

@kurt-rhee

Copy link
Copy Markdown
Contributor Author

@kandersolar good point! I'll give that a quick edit today

Comment thread pvlib/solarposition.py Outdated
Co-authored-by: Kevin Anderson <kevin.anderso@gmail.com>

@kandersolar kandersolar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM after the linter complaint is resolved

Comment thread pvlib/solarposition.py Outdated
kurt-rhee and others added 2 commits November 18, 2024 14:10
Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com>
I hope that this fixes the flake8 errors.  I attempted to mimic the
multi-line links seen in other parts of this .py file

@kandersolar kandersolar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reverting a couple linter-related changes, as they seem to render poorly in the sphinx output and are not required for this PR

Comment thread pvlib/solarposition.py Outdated
Comment thread pvlib/solarposition.py Outdated
@kandersolar kandersolar merged commit 6d886dc into pvlib:main Dec 3, 2024
@kandersolar

Copy link
Copy Markdown
Member

Thanks @kurt-rhee!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants