Skip to content

Add tuvx into the python build for linux and macos#409

Merged
K20shores merged 11 commits intomainfrom
add_tuv_python_build
Jul 9, 2025
Merged

Add tuvx into the python build for linux and macos#409
K20shores merged 11 commits intomainfrom
add_tuv_python_build

Conversation

@K20shores
Copy link
Copy Markdown
Collaborator

@K20shores K20shores commented Jul 8, 2025

This is the second of 3 PRs to address #400

The first PR I tried to make was #393, but that ended up being too large and I split it into 3. The first was #406

This PR adds TUVX into the python build. To do that, I had to use a newer linux image when building the python wheels to get netcdf into the build easily. At this point, we only support macOS and Linux, but it may be possible to support windows; I don't know how to get a fortran compiler on windows with cibibuildhweel and felt like leaving that issue for later.

I created a simple python tuvx class as a place holder and am able to return the tuvx version in python

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 8, 2025

@K20shores K20shores changed the title Add tuv python build Add tuvx into the python build for linux and macos Jul 8, 2025
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 8, 2025

Codecov Report

Attention: Patch coverage is 75.24752% with 25 lines in your changes missing coverage. Please review.

Project coverage is 86.62%. Comparing base (81aa63b) to head (6481738).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/tuvx/interface.F90 81.72% 17 Missing ⚠️
src/tuvx/tuvx.cpp 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #409      +/-   ##
==========================================
- Coverage   87.15%   86.62%   -0.54%     
==========================================
  Files          43       43              
  Lines        3870     3894      +24     
==========================================
  Hits         3373     3373              
- Misses        497      521      +24     

☔ 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.

@K20shores K20shores marked this pull request as ready for review July 8, 2025 16:53

This comment was marked as outdated.

@K20shores K20shores requested a review from Copilot July 8, 2025 17:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR integrates the TUV-x photolysis calculator into the Python build by exposing version information and wiring Fortran/C++/Python bindings, updating build configuration, and adding a basic smoke test for version retrieval.

  • Add GetVersion C++ method and matching Fortran interface for TUV-x version strings
  • Introduce MUSICA_USE_TUVX flag in CMake and enable Python‐only build mode
  • Provide Python bindings (musica/tuvx.py, musica/tuvx.cpp) and a pytest case for version

Reviewed Changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/tuvx/tuvx.cpp Implements TUVX::GetVersion calling Fortran routines
src/tuvx/interface.F90 Adds internal_get/internal_free Fortran routines
include/musica/tuvx/tuvx.hpp Declares GetVersion, InternalGetTuvxVersion, InternalFreeTuvxVersion
src/CMakeLists.txt Skips C/C++ build in Python‐only mode
cmake/setup_musica_target.cmake Defines MUSICA_USE_TUVX compile definition
cmake/dependencies.cmake Pins TUV-x git tag
pyproject.toml Enables Python‐only build, cleans up dependency lists
musica/binding_common.cpp Conditionally binds the TUV-x module
musica/backend.py Adds tuvx_available() check
musica/tuvx.py Python wrapper for TUVX
musica/tuvx.cpp Pybind11 binding of _get_tuvx_version
musica/test/test_tuvx.py Tests presence and type of version
musica/tools/prepare_build_environment_* Updates platform scripts for macOS/Linux
.github/workflows/* Adjusts CI build/test steps for netCDF and wheel targets
Comments suppressed due to low confidence (2)

musica/tuvx.py:11

  • [nitpick] Fetching version at import time may obscure import errors or delay failure. Consider making this a property or a method on TUVX so callers explicitly request it.
version = _backend._tuvx._get_tuvx_version() if backend.tuvx_available() else None

musica/test/test_tuvx.py:8

  • This test only verifies that version is a non-null string. Consider adding assertions for non-empty or expected version format, and testing the TUVX class constructor behavior.
    version = musica.tuvx.version

Copy link
Copy Markdown
Collaborator

@mattldawson mattldawson left a comment

Choose a reason for hiding this comment

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

nice!

Copy link
Copy Markdown
Collaborator

@boulderdaze boulderdaze left a comment

Choose a reason for hiding this comment

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

Looks good!

@K20shores K20shores merged commit cff5346 into main Jul 9, 2025
69 checks passed
@K20shores K20shores deleted the add_tuv_python_build branch July 9, 2025 15:34
This was referenced Jul 10, 2025
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.

5 participants