Skip to content

Support PySAM on Python 3.14 via nlr-pysam package - #2872

Open
mokazemi wants to merge 5 commits into
pvlib:mainfrom
mokazemi:upgrade-pysam-python314
Open

mokazemi wants to merge 5 commits into
pvlib:mainfrom
mokazemi:upgrade-pysam-python314

Conversation

@mokazemi

@mokazemi mokazemi commented Sep 28, 2026 •

Copy link
Copy Markdown

Changes

  • Updates optional dependency from nrel-pysam to nlr-pysam
  • Uncomment nlr-pysam in Python 3.14 CI requirements
  • PySAM 8.0.0+ is distributed as nlr-pysam for Python 3.8-3.14

Testing

The existing test test_fit_cec_sam shows minor numerical differences when using nlr-pysam 8.0.0+:

  • Adjust parameter: 2.3 → 1.507 (~34% difference)
  • Other parameters within 5% tolerance

This may indicate algorithmic improvements or changes in nlr-pysam and should be reviewed by maintainers familiar with the PySAM library.

Closes #2871

  • Closes Support PySAM on Python 3.14 via the nlr-pysam package name #2871
  • I am familiar with the contributing guidelines
  • I attest that all AI-generated material has been vetted for accuracy and is in compliance with the pvlib license
  • 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.

@github-actions

Copy link
Copy Markdown

Hey @mokazemi! 🎉

Thanks for opening your first pull request! We appreciate your
contribution. Please ensure you have reviewed and understood the
contributing guidelines.

If AI is used for any portion of this PR, you must vet the content
for technical accuracy.

@mokazemi
mokazemi force-pushed the upgrade-pysam-python314 branch from c1c521f to d6070ff Compare October 4, 2026 07:12

@echedey-ls echedey-ls 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.

There are other changes that must be done to to cec.py:79

Comment thread ci/requirements-py3.11.yml Outdated
@echedey-ls echedey-ls added this to the v0.16.2 milestone Oct 5, 2026
- Update optional dependency from 'nrel-pysam' to 'nlr-pysam'
- Uncomment nlr-pysam in Python 3.14 CI requirements
- PySAM 8.0.0+ is distributed as nlr-pysam for Python 3.8-3.14

Note: test_fit_cec_sam shows minor numerical differences between
nlr-pysam 8.0.0+ and nrel-pysam, particularly in the 'Adjust'
parameter. This may indicate algorithmic changes in the newer
nlr-pysam distribution that needs further investigation.

Fixes pvlib#2871
@mokazemi
mokazemi force-pushed the upgrade-pysam-python314 branch from d6070ff to 3c0187a Compare October 7, 2026 11:14
@kandersolar

Copy link
Copy Markdown
Member

@mokazemi I believe @echedey-ls's comment still needs to be addressed: #2872 (review)

@mokazemi

Copy link
Copy Markdown
Author

There are other changes that must be done to to cec.py:79

Done.

@echedey-ls echedey-ls 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.

@mokazemi I'm interested in knowing which AI toolchain you use. Are you on claude, codex, is the model any gpt, gemma, etc.? And are you using it for all commits or you only used it to kickstart the PR?

We will defer merging this PR until our CI is green once again. Meanwhile, feel free to list yourself in the relevant whatsnew file.

Comment thread pvlib/ivtools/sdm/cec.py Outdated
Comment thread pvlib/ivtools/sdm/cec.py Outdated
change package names to lowercase versions

Co-authored-by: Echedey Luis <80125792+echedey-ls@users.noreply.github.com>
@mokazemi

Copy link
Copy Markdown
Author

@mokazemi I'm interested in knowing which AI toolchain you use. Are you on claude, codex, is the model any gpt, gemma, etc.? And are you using it for all commits or you only used it to kickstart the PR?

We will defer merging this PR until our CI is green once again. Meanwhile, feel free to list yourself in the relevant whatsnew file.

I used GPT to diagnose the issue, Since I initially had issue when I was working on my project actually, when the system's Python upgraded and my venv couldn't resolve deps.
And I used Github Copilot to search in the source code for relevant parts and write the bug description (#2871) and also writing commit messages (AI is a lot better than me in English :) ). But I made the changes and running tests manually (I don't like using agents honestly, since I prefer to apply changes directly myself).

* main:
  Note deprecation of king in get_total_irradiance and get_sky_diffuse docstrings (pvlib#2904)
  scaling.wvm: return unchanged signal for a single site (pvlib#2896)
  Fix the Series name of ModelChain DC ohmic losses (pvlib#2912)
  Fix test case naming for issue pvlib#2077 (pvlib#2909)
  Clarify multiple IV curve requirement for Sandia fitting methods (pvlib#2883)
  Use conda-forge for all conda CI tests (pvlib#2875)
  fix spelling typo in NumFocus alt-text (pvlib#2888)
  Fix `solar_position()` return statement docstring (pvlib#2887)
  Add dataset option to get_era5 (pvlib#2780)
  calc_surface_orientiation returns scalar when input is scalar (pvlib#2882)
@kandersolar

Copy link
Copy Markdown
Member

@mokazemi can you please update this branch from pvlib/main? That should get the CI working again. Thanks!

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.

Support PySAM on Python 3.14 via the nlr-pysam package name

3 participants