From d323dc0984a5cc9c0e962a634b5bf7c396b7e248 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 23 May 2024 16:10:08 -0400 Subject: [PATCH 01/40] BLD: Initial try at pyproject.toml I think I got every key from setup.py. The main difference is if the READTHEDOCS environment variable is set: I don't know how to change the dependencies based on that. On the other hand, given 3.8 is close to or past EOL, I suspect 3.3 is relatively uncommon, and the RTD install, without the unneeded bits, could be accomplished with pip install --no-deps. --- pyproject.toml | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b5e8154 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,53 @@ +[build-system] +requires = ["setuptools", "numpy"] +build-backend = "setuptools.build_meta" + +[project] +name = "wrf-python" +authors = ["Bill Ladwig"] +maintainers = [ + { name = "GeoCAT", email = "geocat@ucar.edu" }, +] +description = "Diagnostic and interpolation routines for WRF-ARW data." +readme = "README.md" +requires-python = ">=3.7, <3.12" +keywords = [ + "python", "wrf-python", "wrf", "forecast", "model", + "weather research and forecasting", "interpolation", + "plotting", "plots", "meteorology", "nwp", + "numerical weather prediction", "diagnostic", + "science", "numpy" +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Fortran", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Scientific/Engineering :: Atmospheric Science", + "Topic :: Software Development", + "Operating System :: POSIX", + "Operating System :: Unix", + "Operating System :: MacOS", + "Operating System :: Microsoft :: Windows" +] +license = { text = "Apache-2.0", file = "LICENSE" } +dynamic = [ "version", "dependencies" ] + +[project.urls] +Repository = "https://github.com/NCAR/wrf-python" +Documentation = "https://wrf-python.rtfd.org" + +[tool.setuptools] +package-data = { "wrf" = ["data/psadilookup.dat"]} +platforms = ["any"] + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools.dynamic] +version = { attr = "wrf.version.__version__" } +dependencies = { file = "requirements.txt" } From 8322c424885faad29ec16ad432284ca6aa72e280 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Thu, 23 May 2024 22:58:33 -0400 Subject: [PATCH 02/40] BLD,BUG: Fix pyproject.toml configuration and remove setup.py duplicates. numpy.distutils recommends setuptools<60, but that breaks pyproject.toml configuration. I like this way better. Still needs setup.py for the fortran module and for the Cheyenne configuration. --- pyproject.toml | 6 +++-- setup.py | 62 +------------------------------------------------- 2 files changed, 5 insertions(+), 63 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b5e8154..cebbf73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,9 @@ build-backend = "setuptools.build_meta" [project] name = "wrf-python" -authors = ["Bill Ladwig"] +authors = [ + { name = "Bill Ladwig" } +] maintainers = [ { name = "GeoCAT", email = "geocat@ucar.edu" }, ] @@ -34,7 +36,7 @@ classifiers = [ "Operating System :: MacOS", "Operating System :: Microsoft :: Windows" ] -license = { text = "Apache-2.0", file = "LICENSE" } +license = { text = "Apache-2.0" } dynamic = [ "version", "dependencies" ] [project.urls] diff --git a/setup.py b/setup.py index 9c38c9a..8fd210c 100755 --- a/setup.py +++ b/setup.py @@ -1,18 +1,7 @@ import os -import sys import setuptools import socket -# Bootstrap a numpy installation before trying to import it. -import importlib -try: - numpy_module = importlib.util.find_spec('numpy') - if numpy_module is None: - raise ModuleNotFoundError -except (ImportError, ModuleNotFoundError): - import subprocess - subprocess.call([sys.executable, '-m', 'pip', 'install', 'numpy']) - if not socket.gethostname().startswith("cheyenne"): import numpy.distutils.core else: @@ -53,18 +42,10 @@ "fortran/omp.f90"] ) -#Note: __version__ will be set in the version.py script loaded below -__version__ = None -with open("src/wrf/version.py") as f: - exec(f.read()) - on_rtd = os.environ.get("READTHEDOCS", None) == "True" # on_rtd=True if on_rtd: - if sys.version_info < (3, 3): - requirements = ["mock"] # for python2 and python < 3.3 - else: - requirements = [] # for >= python3.3 + requirements = ["mock; python_version < 3.3"] ext_modules = [] else: @@ -72,51 +53,10 @@ with open("requirements.txt") as f2: requirements = f2.read().strip().splitlines() - # if sys.version_info < (3,3): - # requirements.append("mock") ext_modules = [ext1] numpy.distutils.core.setup( - name='wrf-python', - author="Bill Ladwig", - maintainer="GeoCAT", - maintainer_email="geocat@ucar.edu", - description="Diagnostic and interpolation routines for WRF-ARW data.", - long_description=("A collection of diagnostic and interpolation " - "routines to be used with WRF-ARW data.\n\n" - "GitHub Repository:\n\n" - "https://github.com/NCAR/wrf-python\n\n" - "Documentation:\n\n" - "https://wrf-python.rtfd.org\n"), - url="https://github.com/NCAR/wrf-python", - version=__version__, - package_dir={"": "src"}, - keywords=["python", "wrf-python", "wrf", "forecast", "model", - "weather research and forecasting", "interpolation", - "plotting", "plots", "meteorology", "nwp", - "numerical weather prediction", "diagnostic", - "science", "numpy"], - python_requires='>=3.7', install_requires=requirements, - classifiers=["Development Status :: 5 - Production/Stable", - "Intended Audience :: Science/Research", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: Fortran", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Topic :: Scientific/Engineering :: Atmospheric Science", - "Topic :: Software Development", - "Operating System :: POSIX", - "Operating System :: Unix", - "Operating System :: MacOS", - "Operating System :: Microsoft :: Windows"], - platforms=["any"], - license="Apache License 2.0", - packages=setuptools.find_packages("src"), ext_modules=ext_modules, - download_url="https://python.org/pypi/wrf-python", - package_data={"wrf": ["data/psadilookup.dat"]}, scripts=[] ) From 5c169ebf1a2fe8a5440f1712cd31f9e234c8af11 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 24 May 2024 06:53:01 -0400 Subject: [PATCH 03/40] FIX: Require a setuptools version that understands the configuration. setuptools<60 just gets confused, and has no idea what the project name is. I just inverted that requirement: not sure if setuptools needs to be more recent still. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index cebbf73..b5f078c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools", "numpy"] +requires = ["setuptools>=60", "numpy"] build-backend = "setuptools.build_meta" [project] From ca51e704690200aaf3e79544e1cc4975bff6a663 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 24 May 2024 11:08:53 -0400 Subject: [PATCH 04/40] BLD: Start working on a CMake build. Works decently as a standalone builder/installer. Need to work on packaging for python. Scikit-build-core says it's a good option. --- CMakeLists.txt | 162 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e8aae2d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,162 @@ +### setup project ### +cmake_minimum_required(VERSION 3.18) + +project(wrf-python + VERSION 1.3.4.1 + DESCRIPTION "Utilities for reading WRF output" + LANGUAGES C Fortran + ) + +# Safety net +if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) + message( + FATAL_ERROR + "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there.\n" + ) +endif() + +# set(FindPython_DIR "/usr/share/cmake-${CMAKE_VERSION}/Modules") +# Ensure scikit-build modules +if (NOT SKBUILD) + find_package(Python 3.8 REQUIRED COMPONENTS Development.Module NumPy) + # Kanged --> https://github.com/Kitware/torch_liberator/blob/master/CMakeLists.txt + # If skbuild is not the driver; include its utilities in CMAKE_MODULE_PATH + execute_process( + COMMAND "${PYTHON_EXECUTABLE}" + -c "import os, skbuild; print(os.path.dirname(skbuild.__file__))" + OUTPUT_VARIABLE SKBLD_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND CMAKE_MODULE_PATH "${SKBLD_DIR}/resources/cmake") + message(STATUS "Looking in ${SKBLD_DIR}/resources/cmake for CMake modules") +endif() + +# scikit-build style includes +# find_package(PythonExtensions REQUIRED) # for ${PYTHON_EXTENSION_MODULE_SUFFIX} +# Python_SOABI + +# Grab the variables from a local Python installation +# NumPy headers +# F2PY headers +execute_process( + COMMAND "${PYTHON_EXECUTABLE}" + -c "import numpy.f2py; print(numpy.f2py.get_include())" + OUTPUT_VARIABLE F2PY_INCLUDE_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +# Prepping the module +set(f2py_module_name "_wrffortran") +set(fortran_src_files + "${CMAKE_SOURCE_DIR}/fortran/wrf_constants.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_testfunc.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_user.f90" + "${CMAKE_SOURCE_DIR}/fortran/rip_cape.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_cloud_fracf.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_fctt.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_user_dbz.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_relhl.f90" + "${CMAKE_SOURCE_DIR}/fortran/calc_uh.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_user_latlon_routines.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_pvo.f90" + "${CMAKE_SOURCE_DIR}/fortran/eqthecalc.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_rip_phys_routines.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_pw.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_vinterp.f90" + "${CMAKE_SOURCE_DIR}/fortran/wrf_wind.f90" + "${CMAKE_SOURCE_DIR}/fortran/omp.f90") +set(python_src_files + "${CMAKE_SOURCE_DIR}/src/wrf/__init__.py" + "${CMAKE_SOURCE_DIR}/src/wrf/api.py" + "${CMAKE_SOURCE_DIR}/src/wrf/cache.py" + "${CMAKE_SOURCE_DIR}/src/wrf/computation.py" + "${CMAKE_SOURCE_DIR}/src/wrf/config.py" + "${CMAKE_SOURCE_DIR}/src/wrf/constants.py" + "${CMAKE_SOURCE_DIR}/src/wrf/contrib.py" + "${CMAKE_SOURCE_DIR}/src/wrf/coordpair.py" + "${CMAKE_SOURCE_DIR}/src/wrf/decorators.py" + "${CMAKE_SOURCE_DIR}/src/wrf/destag.py" + "${CMAKE_SOURCE_DIR}/src/wrf/extension.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_cape.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_cloudfrac.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_ctt.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_dbz.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_dewpoint.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_geoht.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_helicity.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_latlon.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_omega.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_precip.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_pressure.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_pw.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_rh.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_slp.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_temp.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_terrain.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_times.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_uvmet.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_vorticity.py" + "${CMAKE_SOURCE_DIR}/src/wrf/g_wind.py" + "${CMAKE_SOURCE_DIR}/src/wrf/geobnds.py" + "${CMAKE_SOURCE_DIR}/src/wrf/interp.py" + "${CMAKE_SOURCE_DIR}/src/wrf/interputils.py" + "${CMAKE_SOURCE_DIR}/src/wrf/latlonutils.py" + "${CMAKE_SOURCE_DIR}/src/wrf/metadecorators.py" + "${CMAKE_SOURCE_DIR}/src/wrf/projection.py" + "${CMAKE_SOURCE_DIR}/src/wrf/projutils.py" + "${CMAKE_SOURCE_DIR}/src/wrf/py3compat.py" + "${CMAKE_SOURCE_DIR}/src/wrf/routines.py" + "${CMAKE_SOURCE_DIR}/src/wrf/specialdec.py" + "${CMAKE_SOURCE_DIR}/src/wrf/units.py" + "${CMAKE_SOURCE_DIR}/src/wrf/util.py" + "${CMAKE_SOURCE_DIR}/src/wrf/version.py" +) +set(f2py_module_c "${f2py_module_name}module.c") + +# Target for enforcing dependencies +add_custom_target(genpyf + DEPENDS "${fortran_src_files}" +) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_c}" + COMMAND ${PYTHON_EXECUTABLE} -m "numpy.f2py" + -m "${f2py_module_name}" + --lower # Important + ${fortran_src_files} + DEPENDS "${fortran_src_files}" # Fortran source +) + +Python_add_library(${f2py_module_name} MODULE + "${f2py_module_c}" + "${f2py_module_name}-f2pywrappers.f" + "${f2py_module_name}-f2pywrappers2.f90" + "${F2PY_INCLUDE_DIR}/fortranobject.c" + "${fortran_src_files}") + +target_include_directories(${f2py_module_name} PUBLIC + ${F2PY_INCLUDE_DIR} + ${Python_NumPy_INCLUDE_DIRS} + ${Python_INCLUDE_DIRS}) +set_target_properties(${f2py_module_name} PROPERTIES SUFFIX ".${Python_SOABI}${CMAKE_SHARED_LIBRARY_SUFFIX}") +set_target_properties(${f2py_module_name} PROPERTIES PREFIX "") + +# Linker fixes +if (UNIX) + if (APPLE) + set_target_properties(${f2py_module_name} PROPERTIES + LINK_FLAGS '-Wl,-dylib,-undefined,dynamic_lookup') + else() + set_target_properties(${f2py_module_name} PROPERTIES + LINK_FLAGS '-Wl,--allow-shlib-undefined') + endif() +endif() + +add_dependencies(${f2py_module_name} genpyf) + +string(REGEX REPLACE "^/(usr/(local/)?)?" "" Python_SITEARCH_INSTALL ${Python_SITEARCH}) +string(REGEX REPLACE "^/(usr/(local/)?)?" "" Python_SITELIB_INSTALL ${Python_SITELIB}) +# string(SUBSTRING ${Python_SITEARCH} 1 -1 Python_SITEARCH_INSTALL) +# string(SUBSTRING ${Python_SITELIB} 1 -1 Python_SITELIB_INSTALL) + +install(TARGETS ${f2py_module_name} DESTINATION "${Python_SITEARCH_INSTALL}/wrf/") +install(FILES ${python_src_files} DESTINATION "${Python_SITELIB_INSTALL}/wrf/") From e88a5bd3f78a726bbc3dd7fcf9a8d33cd6704980 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 24 May 2024 17:57:21 -0400 Subject: [PATCH 05/40] BLD: Initial Scikit-build attempt. I should delete setup.py before too much longer, shouldn't I. --- CMakeLists.txt | 19 +++++++++++-------- pyproject.toml | 21 +++++++++++++++++++-- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e8aae2d..4763d59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,9 @@ ### setup project ### +# https://numpy.org/doc/stable/f2py/buildtools/skbuild.html cmake_minimum_required(VERSION 3.18) -project(wrf-python - VERSION 1.3.4.1 +project(${SKBUILD_PROJECT_NAME} + VERSION ${SKBUILD_PROJECT_VERSION} DESCRIPTION "Utilities for reading WRF output" LANGUAGES C Fortran ) @@ -15,10 +16,11 @@ if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) ) endif() -# set(FindPython_DIR "/usr/share/cmake-${CMAKE_VERSION}/Modules") +find_package(Python 3.8 REQUIRED COMPONENTS Development.Module NumPy) +find_package(OpenMP COMPONENTS Fortran) + # Ensure scikit-build modules if (NOT SKBUILD) - find_package(Python 3.8 REQUIRED COMPONENTS Development.Module NumPy) # Kanged --> https://github.com/Kitware/torch_liberator/blob/master/CMakeLists.txt # If skbuild is not the driver; include its utilities in CMAKE_MODULE_PATH execute_process( @@ -31,10 +33,6 @@ if (NOT SKBUILD) message(STATUS "Looking in ${SKBLD_DIR}/resources/cmake for CMake modules") endif() -# scikit-build style includes -# find_package(PythonExtensions REQUIRED) # for ${PYTHON_EXTENSION_MODULE_SUFFIX} -# Python_SOABI - # Grab the variables from a local Python installation # NumPy headers # F2PY headers @@ -119,6 +117,8 @@ add_custom_target(genpyf ) add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_c}" + "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers.f" + "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers2.f90" COMMAND ${PYTHON_EXECUTABLE} -m "numpy.f2py" -m "${f2py_module_name}" --lower # Important @@ -140,6 +140,9 @@ target_include_directories(${f2py_module_name} PUBLIC set_target_properties(${f2py_module_name} PROPERTIES SUFFIX ".${Python_SOABI}${CMAKE_SHARED_LIBRARY_SUFFIX}") set_target_properties(${f2py_module_name} PROPERTIES PREFIX "") +# https://scikit-build-core.readthedocs.io/en/latest/getting_started.html +target_link_libraries(${f2py_module_name} PRIVATE Python::NumPy) + # Linker fixes if (UNIX) if (APPLE) diff --git a/pyproject.toml b/pyproject.toml index b5f078c..28b8eed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] -requires = ["setuptools>=60", "numpy"] -build-backend = "setuptools.build_meta" +requires = ["scikit-build-core", "numpy"] +build-backend = "scikit_build_core.build" [project] name = "wrf-python" @@ -53,3 +53,20 @@ where = ["src"] [tool.setuptools.dynamic] version = { attr = "wrf.version.__version__" } dependencies = { file = "requirements.txt" } + +[tool.scikit-build] +cmake.verbose = true +logging.level = "INFO" +minimum-version = "0.8" +cmake.version = ">=3.18" +wheel.packages = ["src/wrf"] +sdist.include = ["fortran/omp.f90"] + +# To avoid stripping installed libraries +# Packages often want to do their own stripping +# SKBUILD_INSTALL_STRIP: "false" +# install.strip = false + +[tool.scikit-build.metadata.version] +provider = "scikit_build_core.metadata.regex" +input = "src/wrf/version.py" From d18ecf5e80f1917c9623365e5d8ab84534e6410b Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 24 May 2024 17:59:09 -0400 Subject: [PATCH 06/40] STY: Remove execute permissions from python modules. Pretty sure none of them are designed to be used that way. Also it kept CMake from trying to execute them with sh. --- src/wrf/__init__.py | 0 src/wrf/constants.py | 0 src/wrf/destag.py | 0 src/wrf/extension.py | 0 src/wrf/g_cape.py | 0 src/wrf/g_dbz.py | 0 src/wrf/g_dewpoint.py | 0 src/wrf/g_geoht.py | 0 src/wrf/g_helicity.py | 0 src/wrf/g_latlon.py | 0 src/wrf/g_omega.py | 0 src/wrf/g_precip.py | 0 src/wrf/g_pressure.py | 0 src/wrf/g_pw.py | 0 src/wrf/g_rh.py | 0 src/wrf/g_slp.py | 0 src/wrf/g_temp.py | 0 src/wrf/g_terrain.py | 0 src/wrf/g_times.py | 0 src/wrf/g_uvmet.py | 0 src/wrf/g_vorticity.py | 0 src/wrf/g_wind.py | 0 src/wrf/interp.py | 0 src/wrf/units.py | 0 24 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 src/wrf/__init__.py mode change 100755 => 100644 src/wrf/constants.py mode change 100755 => 100644 src/wrf/destag.py mode change 100755 => 100644 src/wrf/extension.py mode change 100755 => 100644 src/wrf/g_cape.py mode change 100755 => 100644 src/wrf/g_dbz.py mode change 100755 => 100644 src/wrf/g_dewpoint.py mode change 100755 => 100644 src/wrf/g_geoht.py mode change 100755 => 100644 src/wrf/g_helicity.py mode change 100755 => 100644 src/wrf/g_latlon.py mode change 100755 => 100644 src/wrf/g_omega.py mode change 100755 => 100644 src/wrf/g_precip.py mode change 100755 => 100644 src/wrf/g_pressure.py mode change 100755 => 100644 src/wrf/g_pw.py mode change 100755 => 100644 src/wrf/g_rh.py mode change 100755 => 100644 src/wrf/g_slp.py mode change 100755 => 100644 src/wrf/g_temp.py mode change 100755 => 100644 src/wrf/g_terrain.py mode change 100755 => 100644 src/wrf/g_times.py mode change 100755 => 100644 src/wrf/g_uvmet.py mode change 100755 => 100644 src/wrf/g_vorticity.py mode change 100755 => 100644 src/wrf/g_wind.py mode change 100755 => 100644 src/wrf/interp.py mode change 100755 => 100644 src/wrf/units.py diff --git a/src/wrf/__init__.py b/src/wrf/__init__.py old mode 100755 new mode 100644 diff --git a/src/wrf/constants.py b/src/wrf/constants.py old mode 100755 new mode 100644 diff --git a/src/wrf/destag.py b/src/wrf/destag.py old mode 100755 new mode 100644 diff --git a/src/wrf/extension.py b/src/wrf/extension.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_cape.py b/src/wrf/g_cape.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_dbz.py b/src/wrf/g_dbz.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_dewpoint.py b/src/wrf/g_dewpoint.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_geoht.py b/src/wrf/g_geoht.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_helicity.py b/src/wrf/g_helicity.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_latlon.py b/src/wrf/g_latlon.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_omega.py b/src/wrf/g_omega.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_precip.py b/src/wrf/g_precip.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_pressure.py b/src/wrf/g_pressure.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_pw.py b/src/wrf/g_pw.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_rh.py b/src/wrf/g_rh.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_slp.py b/src/wrf/g_slp.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_temp.py b/src/wrf/g_temp.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_terrain.py b/src/wrf/g_terrain.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_times.py b/src/wrf/g_times.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_uvmet.py b/src/wrf/g_uvmet.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_vorticity.py b/src/wrf/g_vorticity.py old mode 100755 new mode 100644 diff --git a/src/wrf/g_wind.py b/src/wrf/g_wind.py old mode 100755 new mode 100644 diff --git a/src/wrf/interp.py b/src/wrf/interp.py old mode 100755 new mode 100644 diff --git a/src/wrf/units.py b/src/wrf/units.py old mode 100755 new mode 100644 From 4686af492a19f28307667f6b32a42e44cabd52c0 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 24 May 2024 19:27:57 -0400 Subject: [PATCH 07/40] BLD: First attempt at OpenMP. Can't test locally. Debating testing in my repo or draft PR. --- CMakeLists.txt | 42 +++++++++++++++++++++++++++++++-- fortran/build_help/sub_sizes.py | 3 +++ pyproject.toml | 1 - 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4763d59..16eceb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,6 @@ if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) endif() find_package(Python 3.8 REQUIRED COMPONENTS Development.Module NumPy) -find_package(OpenMP COMPONENTS Fortran) # Ensure scikit-build modules if (NOT SKBUILD) @@ -43,6 +42,42 @@ execute_process( OUTPUT_STRIP_TRAILING_WHITESPACE ) +find_package(OpenMP COMPONENTS Fortran) +set_source_files_properties(fortran/ompgen.F90 PROPERTIES Fortran_PREPROCESS ON) +# TODO: Figure out the conditionals for running the C Preprocessor on Fortran files +# I think the main thing to be changed is -E -cpp +# Intel is -fpp -save-temps or /fpp on Windows +# or call fpp instead of the fortran compiler to get it to stop after preprocessing +if (${OpenMP_Fortran_FOUND}) + # This would probably be cleaner if I shoved it in the subdirectory + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/fortran") + add_executable(sizes "${CMAKE_SOURCE_DIR}/fortran/build_help/omp_sizes.f90") + target_link_libraries(sizes PRIVATE OpenMP::OpenMP_Fortran) + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/fortran/ompgen.F90" + DEPENDS "${CMAKE_SOURCE_DIR}/fortran/ompgen.F90.template" + ${CMAKE_SOURCE_DIR}/fortran/build_help/sub_sizes.py + sizes + COMMAND + ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/fortran/build_help/sub_sizes.py + ${CMAKE_SOURCE_DIR}/fortran/ompgen.F90.template + ${CMAKE_CURRENT_BINARY_DIR}/fortran/ompgen.F90 + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + ) + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/fortran/omp.f90" + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/fortran/ompgen.F90" + COMMAND ${CMAKE_Fortran_COMPILER} -E "${CMAKE_CURRENT_BINARY_DIR}/fortran/ompgen.F90" + -o "${CMAKE_CURRENT_BINARY_DIR}/fortran/omp.f90" ${OpenMP_Fortran_FLAGS} -cpp + ) +else() + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/fortran/omp.f90" + DEPENDS "${CMAKE_SOURCE_DIR}/fortran/ompgen.F90" + COMMAND ${CMAKE_Fortran_COMPILER} -E fortran/ompgen.F90 -o fortran/omp.f90 -cpp + ) +endif() + # Prepping the module set(f2py_module_name "_wrffortran") set(fortran_src_files @@ -62,7 +97,7 @@ set(fortran_src_files "${CMAKE_SOURCE_DIR}/fortran/wrf_pw.f90" "${CMAKE_SOURCE_DIR}/fortran/wrf_vinterp.f90" "${CMAKE_SOURCE_DIR}/fortran/wrf_wind.f90" - "${CMAKE_SOURCE_DIR}/fortran/omp.f90") + "${CMAKE_CURRENT_BINARY_DIR}/fortran/omp.f90") set(python_src_files "${CMAKE_SOURCE_DIR}/src/wrf/__init__.py" "${CMAKE_SOURCE_DIR}/src/wrf/api.py" @@ -142,6 +177,9 @@ set_target_properties(${f2py_module_name} PROPERTIES PREFIX "") # https://scikit-build-core.readthedocs.io/en/latest/getting_started.html target_link_libraries(${f2py_module_name} PRIVATE Python::NumPy) +if (${OpenMP_Fortran_FOUND}) + target_link_libraries(${f2py_module_name} PRIVATE OpenMP::OpenMP_Fortran) +endif() # Linker fixes if (UNIX) diff --git a/fortran/build_help/sub_sizes.py b/fortran/build_help/sub_sizes.py index d69b6e8..bb91eb6 100644 --- a/fortran/build_help/sub_sizes.py +++ b/fortran/build_help/sub_sizes.py @@ -41,6 +41,9 @@ def main(): ompgen_temp_path = os.path.join("..", "ompgen.F90.template") ompgen_out_path = os.path.join("..", "ompgen.F90") + if len(sys.argv) == 3: + ompgen_temp_path = sys.argv[1] + ompgen_out_path = sys.argv[2] with open(ompgen_temp_path, "r") as ompgen_in: ompgen_template = Template(ompgen_in.read()) diff --git a/pyproject.toml b/pyproject.toml index 28b8eed..b07900f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,7 +60,6 @@ logging.level = "INFO" minimum-version = "0.8" cmake.version = ">=3.18" wheel.packages = ["src/wrf"] -sdist.include = ["fortran/omp.f90"] # To avoid stripping installed libraries # Packages often want to do their own stripping From ad35d875db34d82d654628d2700659eb045d9a61 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 11:54:18 -0400 Subject: [PATCH 08/40] CI: Update CI for CMake build, and add 3.12 --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f40dfd..0d66986 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: fail-fast: false matrix: os: [ "ubuntu-latest", "macos-latest", "macos-14" ] - python-version: [ "3.9", "3.10", "3.11" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] steps: - name: Cancel previous runs @@ -49,9 +49,9 @@ jobs: environment-file: build_envs/environment.yml - name: Build WRF-Python run: | - cd build_scripts - ./gnu_omp.sh - cd .. + python -m pip install build + python -m build . + python -m pip install dist/wrf*.whl - name: Run tests run: | cd test/ci_tests From 937e16411636178c94b3e473f98e2e429e0243eb Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 12:07:24 -0400 Subject: [PATCH 09/40] CI: Check the installed package. It's not working, and I'd like to know why. --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d66986..7f7b3d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,15 @@ jobs: python -m pip install build python -m build . python -m pip install dist/wrf*.whl + - name: Check import + run: | + python -m pip show wrf-python + python -m pip show --files wrf-python + installed_files="$(python -m pip show --files wrf-python | grep -v :)" + ls -l ${installed_files} + file ${installed_files} + ldd ${installed_files} + python -vvv -d -c "import wrf" - name: Run tests run: | cd test/ci_tests From ddcf9eb5266dd3f13eb3ef5392837bcdae552d57 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 12:25:56 -0400 Subject: [PATCH 10/40] CI: Fix Python 3.12 install and package install check --- .github/workflows/ci.yml | 3 ++- build_envs/environment.yml | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f7b3d9..85f2881 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,8 @@ jobs: run: | python -m pip show wrf-python python -m pip show --files wrf-python - installed_files="$(python -m pip show --files wrf-python | grep -v :)" + prefix="$(python -m pip show --files six | grep Location: | cut -f2 -d' ')" + installed_files="$(python -m pip show --files wrf-python | sed -E -e "/\\w+:/ d" -e "/^\s+/ s|^ |${prefix}/|g")" ls -l ${installed_files} file ${installed_files} ldd ${installed_files} diff --git a/build_envs/environment.yml b/build_envs/environment.yml index 8b46c24..853e9fb 100644 --- a/build_envs/environment.yml +++ b/build_envs/environment.yml @@ -3,7 +3,7 @@ name: wrf_python_build channels: - conda-forge dependencies: - - python>=3.9, <3.12 + - python>=3.9, <3.13 - compilers - basemap - cartopy @@ -17,4 +17,5 @@ dependencies: - sphinx_rtd_theme - wrapt - xarray - + - build + - pip From 05657f8dfb79619209317602336aee40907a6af8 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 13:11:16 -0400 Subject: [PATCH 11/40] FIX: Try to get checks working. --- .github/workflows/ci.yml | 4 ++-- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85f2881..cb2e57d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,8 +56,8 @@ jobs: run: | python -m pip show wrf-python python -m pip show --files wrf-python - prefix="$(python -m pip show --files six | grep Location: | cut -f2 -d' ')" - installed_files="$(python -m pip show --files wrf-python | sed -E -e "/\\w+:/ d" -e "/^\s+/ s|^ |${prefix}/|g")" + prefix="$(python -m pip show --files wrf-python | grep Location: | cut -f2 -d" ")" + installed_files="$(python -m pip show --files wrf-python | sed -E -e "/\\w+:/ d" -e "/^\s+/ s|^\s+|${prefix}/|g")" ls -l ${installed_files} file ${installed_files} ldd ${installed_files} diff --git a/pyproject.toml b/pyproject.toml index b07900f..4e653d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ maintainers = [ ] description = "Diagnostic and interpolation routines for WRF-ARW data." readme = "README.md" -requires-python = ">=3.7, <3.12" +requires-python = ">=3.7, <3.13" keywords = [ "python", "wrf-python", "wrf", "forecast", "model", "weather research and forecasting", "interpolation", From 0df03d8dce5e7b106655de6f522f24aed3121660 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 14:18:50 -0400 Subject: [PATCH 12/40] BLD: Let skbuild handle install dirs when available. Only use my versions when skbuild isn't around. --- CMakeLists.txt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16eceb8..52c37e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,10 +194,15 @@ endif() add_dependencies(${f2py_module_name} genpyf) -string(REGEX REPLACE "^/(usr/(local/)?)?" "" Python_SITEARCH_INSTALL ${Python_SITEARCH}) -string(REGEX REPLACE "^/(usr/(local/)?)?" "" Python_SITELIB_INSTALL ${Python_SITELIB}) -# string(SUBSTRING ${Python_SITEARCH} 1 -1 Python_SITEARCH_INSTALL) -# string(SUBSTRING ${Python_SITELIB} 1 -1 Python_SITELIB_INSTALL) +if (NOT SKBUILD) + string(REGEX REPLACE "^/(usr/(local/)?)?" "" Python_SITEARCH_INSTALL ${Python_SITEARCH}) + string(REGEX REPLACE "^/(usr/(local/)?)?" "" Python_SITELIB_INSTALL ${Python_SITELIB}) + # string(SUBSTRING ${Python_SITEARCH} 1 -1 Python_SITEARCH_INSTALL) + # string(SUBSTRING ${Python_SITELIB} 1 -1 Python_SITELIB_INSTALL) -install(TARGETS ${f2py_module_name} DESTINATION "${Python_SITEARCH_INSTALL}/wrf/") -install(FILES ${python_src_files} DESTINATION "${Python_SITELIB_INSTALL}/wrf/") + install(TARGETS ${f2py_module_name} DESTINATION "${Python_SITEARCH_INSTALL}/wrf/") + install(FILES ${python_src_files} DESTINATION "${Python_SITELIB_INSTALL}/wrf/") + install(FILES src/wrf/data/psadilookup.dat DESTINATION "${Python_SITELIB_INSTALL}/wrf") +else() + install(TARGETS ${f2py_module_name] DESTINATION "${SKBUILD_PLATLIB_DIR}") +endif() From 0d38af9005fc592ff2173b24421167bdab7b48fd Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 14:25:27 -0400 Subject: [PATCH 13/40] FIX: Fix syntax in CMake variable reference. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 52c37e9..22b72d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -204,5 +204,6 @@ if (NOT SKBUILD) install(FILES ${python_src_files} DESTINATION "${Python_SITELIB_INSTALL}/wrf/") install(FILES src/wrf/data/psadilookup.dat DESTINATION "${Python_SITELIB_INSTALL}/wrf") else() - install(TARGETS ${f2py_module_name] DESTINATION "${SKBUILD_PLATLIB_DIR}") + # https://scikit-build-core.readthedocs.io/en/latest/cmakelists.html#install-directories + install(TARGETS ${f2py_module_name} DESTINATION "${SKBUILD_PLATLIB_DIR}") endif() From a962d9f2dc3b8d436090ae4b9d3c4576713661a4 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 14:32:49 -0400 Subject: [PATCH 14/40] CI,DBG: Only run ldd on so files. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb2e57d..0a8f92c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: installed_files="$(python -m pip show --files wrf-python | sed -E -e "/\\w+:/ d" -e "/^\s+/ s|^\s+|${prefix}/|g")" ls -l ${installed_files} file ${installed_files} - ldd ${installed_files} + ldd $(echo ${installed_files} | grep -v -e ".py" -e ".dist-info") python -vvv -d -c "import wrf" - name: Run tests run: | From 028ec66f65c15cd4e932567c03cbb232748b164f Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 23:50:19 -0400 Subject: [PATCH 15/40] FIX: Ensure grep knows the patterns are fixed strings. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a8f92c..e1a8118 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: installed_files="$(python -m pip show --files wrf-python | sed -E -e "/\\w+:/ d" -e "/^\s+/ s|^\s+|${prefix}/|g")" ls -l ${installed_files} file ${installed_files} - ldd $(echo ${installed_files} | grep -v -e ".py" -e ".dist-info") + ldd $(echo ${installed_files} | grep -F -v -e ".py" -e ".dist-info") python -vvv -d -c "import wrf" - name: Run tests run: | From 3b9abc9bc01599826a4bc121c2ae85b9c4779a72 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sat, 25 May 2024 23:55:51 -0400 Subject: [PATCH 16/40] CI,DBG: Remove debug section. It's not working, and it doesn't look easy to get working on Mac. Everything should be working now, so let's check. --- .github/workflows/ci.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1a8118..0d66986 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,16 +52,6 @@ jobs: python -m pip install build python -m build . python -m pip install dist/wrf*.whl - - name: Check import - run: | - python -m pip show wrf-python - python -m pip show --files wrf-python - prefix="$(python -m pip show --files wrf-python | grep Location: | cut -f2 -d" ")" - installed_files="$(python -m pip show --files wrf-python | sed -E -e "/\\w+:/ d" -e "/^\s+/ s|^\s+|${prefix}/|g")" - ls -l ${installed_files} - file ${installed_files} - ldd $(echo ${installed_files} | grep -F -v -e ".py" -e ".dist-info") - python -vvv -d -c "import wrf" - name: Run tests run: | cd test/ci_tests From 894451422c642a33a93963a8e90c74fc54752735 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sun, 26 May 2024 00:03:07 -0400 Subject: [PATCH 17/40] FIX: Fix install directory for fortran extension module. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22b72d4..bf6db63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -205,5 +205,5 @@ if (NOT SKBUILD) install(FILES src/wrf/data/psadilookup.dat DESTINATION "${Python_SITELIB_INSTALL}/wrf") else() # https://scikit-build-core.readthedocs.io/en/latest/cmakelists.html#install-directories - install(TARGETS ${f2py_module_name} DESTINATION "${SKBUILD_PLATLIB_DIR}") + install(TARGETS ${f2py_module_name} DESTINATION "${SKBUILD_PLATLIB_DIR}/wrf/") endif() From dd8ead26d8b959a022ee3fd397905a089f2d4d76 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sun, 26 May 2024 22:39:36 -0400 Subject: [PATCH 18/40] BLD: Move requirements.txt to pyproject.toml Requirements list on RTD is much shorter than elsewhere, so do not install the extra packages on RTD. The last part of setup.py left is the Cheyenne configuration. --- .readthedocs.yml | 2 +- pyproject.toml | 10 ++++++-- requirements.txt | 5 ---- setup.py | 62 ------------------------------------------------ 4 files changed, 9 insertions(+), 70 deletions(-) delete mode 100644 requirements.txt delete mode 100755 setup.py diff --git a/.readthedocs.yml b/.readthedocs.yml index d059c2c..8cb6480 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -11,7 +11,7 @@ build: python: "mambaforge-4.10" jobs: post_create_environment: - - python -m pip install --no-cache-dir . + - python -m pip install --no-cache-dir --no-deps . # Build documentation in the docs/ directory with Sphinx sphinx: diff --git a/pyproject.toml b/pyproject.toml index 4e653d3..556fa88 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,14 @@ classifiers = [ "Operating System :: Microsoft :: Windows" ] license = { text = "Apache-2.0" } -dynamic = [ "version", "dependencies" ] +dynamic = [ "version" ] +dependencies = [ + "basemap", + "numpy >=1.11, !=1.24.3", + "setuptools", + "wrapt", + "xarray" +] [project.urls] Repository = "https://github.com/NCAR/wrf-python" @@ -52,7 +59,6 @@ where = ["src"] [tool.setuptools.dynamic] version = { attr = "wrf.version.__version__" } -dependencies = { file = "requirements.txt" } [tool.scikit-build] cmake.verbose = true diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index e9cbcfa..0000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -basemap -numpy >=1.11, !=1.24.3 -setuptools -wrapt -xarray diff --git a/setup.py b/setup.py deleted file mode 100755 index 8fd210c..0000000 --- a/setup.py +++ /dev/null @@ -1,62 +0,0 @@ -import os -import setuptools -import socket - -if not socket.gethostname().startswith("cheyenne"): - import numpy.distutils.core -else: - import chey_intel - import numpy.distutils.core - import numpy.distutils.fcompiler.intel - - numpy.distutils.fcompiler.intel.IntelFCompiler = chey_intel.IntelFCompiler - numpy.distutils.fcompiler.intel.IntelVisualFCompiler = ( - chey_intel.IntelVisualFCompiler) - numpy.distutils.fcompiler.intel.IntelItaniumFCompiler = ( - chey_intel.IntelItaniumFCompiler) - numpy.distutils.fcompiler.intel.IntelItaniumVisualFCompiler = ( - chey_intel.IntelItaniumVisualFCompiler) - numpy.distutils.fcompiler.intel.IntelEM64VisualFCompiler = ( - chey_intel.IntelEM64VisualFCompiler) - numpy.distutils.fcompiler.intel.IntelEM64TFCompiler = ( - chey_intel.IntelEM64TFCompiler) - -ext1 = numpy.distutils.core.Extension( - name="wrf._wrffortran", - sources=["fortran/wrf_constants.f90", - "fortran/wrf_testfunc.f90", - "fortran/wrf_user.f90", - "fortran/rip_cape.f90", - "fortran/wrf_cloud_fracf.f90", - "fortran/wrf_fctt.f90", - "fortran/wrf_user_dbz.f90", - "fortran/wrf_relhl.f90", - "fortran/calc_uh.f90", - "fortran/wrf_user_latlon_routines.f90", - "fortran/wrf_pvo.f90", - "fortran/eqthecalc.f90", - "fortran/wrf_rip_phys_routines.f90", - "fortran/wrf_pw.f90", - "fortran/wrf_vinterp.f90", - "fortran/wrf_wind.f90", - "fortran/omp.f90"] - ) - -on_rtd = os.environ.get("READTHEDOCS", None) == "True" -# on_rtd=True -if on_rtd: - requirements = ["mock; python_version < 3.3"] - ext_modules = [] - -else: - # Place install_requires into the text file "requirements.txt" - with open("requirements.txt") as f2: - requirements = f2.read().strip().splitlines() - - ext_modules = [ext1] - -numpy.distutils.core.setup( - install_requires=requirements, - ext_modules=ext_modules, - scripts=[] -) From b3557c32e1850f82e16a5d362944e50c6ef5f5c5 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Tue, 20 Aug 2024 13:20:46 -0400 Subject: [PATCH 19/40] BLD: Do not expect f2py to produce ${modname}-f2pywrappers2.f90 For some reason this isn't getting written despite every file being .f90 and no file being .f77, so put that in the code. --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf6db63..d85cf43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,7 +153,6 @@ add_custom_target(genpyf add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_c}" "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers.f" - "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers2.f90" COMMAND ${PYTHON_EXECUTABLE} -m "numpy.f2py" -m "${f2py_module_name}" --lower # Important @@ -164,7 +163,6 @@ add_custom_command( Python_add_library(${f2py_module_name} MODULE "${f2py_module_c}" "${f2py_module_name}-f2pywrappers.f" - "${f2py_module_name}-f2pywrappers2.f90" "${F2PY_INCLUDE_DIR}/fortranobject.c" "${fortran_src_files}") From 0038273918803531d52505c83b03742e4fc931bc Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 30 Aug 2024 06:35:27 -0400 Subject: [PATCH 20/40] DOC: Note that this should work on Python 3.12 Update package metadata. --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 556fa88..7a50196 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,6 +29,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: Atmospheric Science", "Topic :: Software Development", "Operating System :: POSIX", From 9654adaee0621a6cd913cbf0af53db1a7a79adbb Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 11 Sep 2024 10:20:51 -0400 Subject: [PATCH 21/40] BLD: Pin NumPy<2 Let's see if this allows this to build. I haven't had problems locally with 3.9/1.26 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7a50196..b54882e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build-core", "numpy"] +requires = ["scikit-build-core", "numpy<2.0"] build-backend = "scikit_build_core.build" [project] @@ -41,7 +41,7 @@ license = { text = "Apache-2.0" } dynamic = [ "version" ] dependencies = [ "basemap", - "numpy >=1.11, !=1.24.3", + "numpy >=1.11, !=1.24.3, <2.0", "setuptools", "wrapt", "xarray" From 7944265c1239192b53ab01c978a2e3f7b031e399 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 13 Sep 2024 08:31:05 -0400 Subject: [PATCH 22/40] BLD: Make CMake OpenMP linkage public. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d85cf43..bb3bdbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,7 @@ if (${OpenMP_Fortran_FOUND}) # This would probably be cleaner if I shoved it in the subdirectory file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/fortran") add_executable(sizes "${CMAKE_SOURCE_DIR}/fortran/build_help/omp_sizes.f90") - target_link_libraries(sizes PRIVATE OpenMP::OpenMP_Fortran) + target_link_libraries(sizes PUBLIC OpenMP::OpenMP_Fortran) add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/fortran/ompgen.F90" DEPENDS "${CMAKE_SOURCE_DIR}/fortran/ompgen.F90.template" @@ -176,7 +176,7 @@ set_target_properties(${f2py_module_name} PROPERTIES PREFIX "") # https://scikit-build-core.readthedocs.io/en/latest/getting_started.html target_link_libraries(${f2py_module_name} PRIVATE Python::NumPy) if (${OpenMP_Fortran_FOUND}) - target_link_libraries(${f2py_module_name} PRIVATE OpenMP::OpenMP_Fortran) + target_link_libraries(${f2py_module_name} PUBLIC OpenMP::OpenMP_Fortran) endif() # Linker fixes From 9f8408877a562b9e103573b858cf8b5877cbca08 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Fri, 13 Sep 2024 08:38:22 -0400 Subject: [PATCH 23/40] BLD: Pin build-time NumPy >=2, unpin run-time numpy --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b54882e..c4f2085 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build-core", "numpy<2.0"] +requires = ["scikit-build-core", "numpy>=2.0"] build-backend = "scikit_build_core.build" [project] @@ -41,8 +41,8 @@ license = { text = "Apache-2.0" } dynamic = [ "version" ] dependencies = [ "basemap", - "numpy >=1.11, !=1.24.3, <2.0", - "setuptools", + "numpy >=1.11, !=1.24.3", + "setuptools>=61", "wrapt", "xarray" ] From e41f75e570e514c692fcf1611fdf7d4f80cf4e94 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sun, 15 Sep 2024 15:57:04 -0400 Subject: [PATCH 24/40] BUG: Fix spelling of Python_EXECUTABLE in CMakeLists.txt --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bb3bdbd..abd39fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ if (NOT SKBUILD) # Kanged --> https://github.com/Kitware/torch_liberator/blob/master/CMakeLists.txt # If skbuild is not the driver; include its utilities in CMAKE_MODULE_PATH execute_process( - COMMAND "${PYTHON_EXECUTABLE}" + COMMAND "${Python_EXECUTABLE}" -c "import os, skbuild; print(os.path.dirname(skbuild.__file__))" OUTPUT_VARIABLE SKBLD_DIR OUTPUT_STRIP_TRAILING_WHITESPACE @@ -36,7 +36,7 @@ endif() # NumPy headers # F2PY headers execute_process( - COMMAND "${PYTHON_EXECUTABLE}" + COMMAND "${Python_EXECUTABLE}" -c "import numpy.f2py; print(numpy.f2py.get_include())" OUTPUT_VARIABLE F2PY_INCLUDE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE @@ -59,7 +59,7 @@ if (${OpenMP_Fortran_FOUND}) ${CMAKE_SOURCE_DIR}/fortran/build_help/sub_sizes.py sizes COMMAND - ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/fortran/build_help/sub_sizes.py + ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/fortran/build_help/sub_sizes.py ${CMAKE_SOURCE_DIR}/fortran/ompgen.F90.template ${CMAKE_CURRENT_BINARY_DIR}/fortran/ompgen.F90 WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" @@ -153,7 +153,7 @@ add_custom_target(genpyf add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_c}" "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers.f" - COMMAND ${PYTHON_EXECUTABLE} -m "numpy.f2py" + COMMAND ${Python_EXECUTABLE} -m "numpy.f2py" -m "${f2py_module_name}" --lower # Important ${fortran_src_files} From 379691dc038064e63498ff162968d1f703284323 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sun, 15 Sep 2024 19:20:46 -0400 Subject: [PATCH 25/40] BUG: Include the f90 wrapper file in the compilation. I think I had it earlier, but deleted it from the link line because I thought the library was fixed-form only, rather than making sure it was available for the link line. --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abd39fd..c2554ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,6 +153,7 @@ add_custom_target(genpyf add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_c}" "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers.f" + "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers2.f90" COMMAND ${Python_EXECUTABLE} -m "numpy.f2py" -m "${f2py_module_name}" --lower # Important @@ -161,8 +162,9 @@ add_custom_command( ) Python_add_library(${f2py_module_name} MODULE - "${f2py_module_c}" - "${f2py_module_name}-f2pywrappers.f" + "${CMAKE_CURRENT_BINARY_DIR}/${${f2py_module_c}" + "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers.f" + "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers2.f90" "${F2PY_INCLUDE_DIR}/fortranobject.c" "${fortran_src_files}") From b5fdd5f7f2adcfa4e076566e4056b44ab6c6b206 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sun, 15 Sep 2024 20:09:54 -0400 Subject: [PATCH 26/40] FIX: Fix syntax in CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2554ce..b977aa8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,7 +162,7 @@ add_custom_command( ) Python_add_library(${f2py_module_name} MODULE - "${CMAKE_CURRENT_BINARY_DIR}/${${f2py_module_c}" + "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_c}" "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers.f" "${CMAKE_CURRENT_BINARY_DIR}/${f2py_module_name}-f2pywrappers2.f90" "${F2PY_INCLUDE_DIR}/fortranobject.c" From 4bde3cfab32b2bbcfba5a65183ef8b85716db0fd Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:47:48 -0400 Subject: [PATCH 27/40] BLD: Pin numpy<1.26.3 Let's see if that's the fix that broke the build --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c4f2085..05ab39d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build-core", "numpy>=2.0"] +requires = ["scikit-build-core", "numpy<1.26.3"] build-backend = "scikit_build_core.build" [project] @@ -41,7 +41,7 @@ license = { text = "Apache-2.0" } dynamic = [ "version" ] dependencies = [ "basemap", - "numpy >=1.11, !=1.24.3", + "numpy >=1.11, !=1.24.3, <2.0", "setuptools>=61", "wrapt", "xarray" From 0eed892fe536d12747e632159021313ad84777e0 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:03:13 -0400 Subject: [PATCH 28/40] ENH: Add a function to module wrf_constants so f2py includes it --- fortran/wrf_constants.f90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fortran/wrf_constants.f90 b/fortran/wrf_constants.f90 index 0864502..df5bd8d 100644 --- a/fortran/wrf_constants.f90 +++ b/fortran/wrf_constants.f90 @@ -69,6 +69,8 @@ MODULE wrf_constants REAL(KIND=8), PARAMETER :: EXPON = RD*USSALR/G REAL(KIND=8), PARAMETER :: EXPONI = 1./EXPON - + logical function have_wrf_constants() + have_wrf_constants = .true. + end function have_wrf_constants END MODULE wrf_constants From 607cf3039b13cc2f1bc965d166ea5884b05a05b1 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:04:31 -0400 Subject: [PATCH 29/40] ENH: Add a function to module omp_constants so f2py includes it --- fortran/ompgen.F90.template | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fortran/ompgen.F90.template b/fortran/ompgen.F90.template index 00a50d5..4cb1f83 100644 --- a/fortran/ompgen.F90.template +++ b/fortran/ompgen.F90.template @@ -20,6 +20,9 @@ MODULE omp_constants INTEGER(KIND=4), PARAMETER :: fomp_sched_auto = 4 #endif + logical function have_omp_constants() + have_omp_constants = .true. + end function have_omp_constants END MODULE omp_constants From 1c20f4a5bf140e9c20801bd01e45ce66ae601de4 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:10:05 -0400 Subject: [PATCH 30/40] FIX: Fix where in module functions go --- fortran/ompgen.F90.template | 1 + 1 file changed, 1 insertion(+) diff --git a/fortran/ompgen.F90.template b/fortran/ompgen.F90.template index 4cb1f83..9457836 100644 --- a/fortran/ompgen.F90.template +++ b/fortran/ompgen.F90.template @@ -20,6 +20,7 @@ MODULE omp_constants INTEGER(KIND=4), PARAMETER :: fomp_sched_auto = 4 #endif + contains logical function have_omp_constants() have_omp_constants = .true. end function have_omp_constants From ef93ca661575309385d485ccb9784fce42a78c3b Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:10:34 -0400 Subject: [PATCH 31/40] BUG: Fix where in module functions go --- fortran/wrf_constants.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/fortran/wrf_constants.f90 b/fortran/wrf_constants.f90 index df5bd8d..c1096a6 100644 --- a/fortran/wrf_constants.f90 +++ b/fortran/wrf_constants.f90 @@ -69,6 +69,7 @@ MODULE wrf_constants REAL(KIND=8), PARAMETER :: EXPON = RD*USSALR/G REAL(KIND=8), PARAMETER :: EXPONI = 1./EXPON + contains logical function have_wrf_constants() have_wrf_constants = .true. end function have_wrf_constants From f914a855e63cd9400e915cd1fc4fb2cd99fd4732 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:50:37 -0400 Subject: [PATCH 32/40] ENH: Make have_wrf_constants a subroutine f2py seems to do better with those. --- fortran/wrf_constants.f90 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fortran/wrf_constants.f90 b/fortran/wrf_constants.f90 index c1096a6..d15cca4 100644 --- a/fortran/wrf_constants.f90 +++ b/fortran/wrf_constants.f90 @@ -70,8 +70,9 @@ MODULE wrf_constants REAL(KIND=8), PARAMETER :: EXPONI = 1./EXPON contains - logical function have_wrf_constants() - have_wrf_constants = .true. - end function have_wrf_constants + subroutine have_wrf_constants(a) + logical, intent(out) :: a + a = .true. + end subroutine have_wrf_constants END MODULE wrf_constants From 46cf6b39ba3c95e1397864bf5a1e5f6e5a07911b Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:17:27 -0400 Subject: [PATCH 33/40] BLD: Remove pin on NumPy version --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 05ab39d..4e4e081 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build-core", "numpy<1.26.3"] +requires = ["scikit-build-core", "numpy"] build-backend = "scikit_build_core.build" [project] @@ -41,7 +41,7 @@ license = { text = "Apache-2.0" } dynamic = [ "version" ] dependencies = [ "basemap", - "numpy >=1.11, !=1.24.3, <2.0", + "numpy >=1.11, !=1.24.3", "setuptools>=61", "wrapt", "xarray" From 9b712c8e24b6d3f7dd8a505b517e46170e6226e8 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:27:07 -0400 Subject: [PATCH 34/40] CI,DBG: Re-add debug section to CI --- .github/workflows/ci.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d66986..5022ebe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,3 +56,14 @@ jobs: run: | cd test/ci_tests python utests.py + - name: Check import + if: failure() + run: | + python -m pip show wrf-python + python -m pip show --files wrf-python + prefix="$(python -m pip show --files wrf-python | grep Location: | cut -f2 -d" ")" + installed_files="$(python -m pip show --files wrf-python | sed -E -e "/\\w+:/ d" -e "/^\s+/ s|^\s+|${prefix}/|g")" + ls -l ${installed_files} + file ${installed_files} + ldd $(echo ${installed_files} | grep -F -v -e ".py" -e ".dist-info") + python -vvv -dd -c "import wrf" From faeda9d3b3bfa966b21e29ff9a2345037d22fe14 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:39:11 -0400 Subject: [PATCH 35/40] CI,BUG: Try to fix debug section. --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5022ebe..b0306c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,7 +62,8 @@ jobs: python -m pip show wrf-python python -m pip show --files wrf-python prefix="$(python -m pip show --files wrf-python | grep Location: | cut -f2 -d" ")" - installed_files="$(python -m pip show --files wrf-python | sed -E -e "/\\w+:/ d" -e "/^\s+/ s|^\s+|${prefix}/|g")" + echo "Site-packages directory is ${prefix}" + installed_files="$(python -m pip show --files wrf-python | grep -v -E -e '^[-a-zA-Z]+:'| sed -E -e "/^\s+/ s|^\s+|${prefix}/|g")" ls -l ${installed_files} file ${installed_files} ldd $(echo ${installed_files} | grep -F -v -e ".py" -e ".dist-info") From bb4ff8e8b8d9d2f1ae5fb0859342ffff86312b55 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:43:14 -0400 Subject: [PATCH 36/40] CI,BUG: Try to get ls ${installed_files} working. --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0306c4..eb00a83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,8 @@ jobs: python -m pip show --files wrf-python prefix="$(python -m pip show --files wrf-python | grep Location: | cut -f2 -d" ")" echo "Site-packages directory is ${prefix}" - installed_files="$(python -m pip show --files wrf-python | grep -v -E -e '^[-a-zA-Z]+:'| sed -E -e "/^\s+/ s|^\s+|${prefix}/|g")" + cd "${prefix}" + installed_files="$(python -m pip show --files wrf-python | grep -v -E -e '^[-a-zA-Z]+:')" ls -l ${installed_files} file ${installed_files} ldd $(echo ${installed_files} | grep -F -v -e ".py" -e ".dist-info") From 80265d68feefac1d7d2a5f1cf3e2c353f4f7a6df Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:47:42 -0400 Subject: [PATCH 37/40] CI,BUG: Don't run ldd until after python import Mac doesn't call it ldd, not sure what it should be. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb00a83..6d41fe7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,5 +67,5 @@ jobs: installed_files="$(python -m pip show --files wrf-python | grep -v -E -e '^[-a-zA-Z]+:')" ls -l ${installed_files} file ${installed_files} - ldd $(echo ${installed_files} | grep -F -v -e ".py" -e ".dist-info") python -vvv -dd -c "import wrf" + ldd $(echo ${installed_files} | grep -F -v -e ".py" -e ".dist-info") From c9573de4121dd4f201012862b3f57583b661966c Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:58:10 -0400 Subject: [PATCH 38/40] BLD,BUG: Try a different suffix for extension modules --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b977aa8..430587f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -172,7 +172,7 @@ target_include_directories(${f2py_module_name} PUBLIC ${F2PY_INCLUDE_DIR} ${Python_NumPy_INCLUDE_DIRS} ${Python_INCLUDE_DIRS}) -set_target_properties(${f2py_module_name} PROPERTIES SUFFIX ".${Python_SOABI}${CMAKE_SHARED_LIBRARY_SUFFIX}") +set_target_properties(${f2py_module_name} PROPERTIES SUFFIX ".${Python_SOABI}${CMAKE_SHARED_MODULE_SUFFIX}") set_target_properties(${f2py_module_name} PROPERTIES PREFIX "") # https://scikit-build-core.readthedocs.io/en/latest/getting_started.html From f9f690fc8e9adc30befb1d220852e028c98d8a49 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:27:41 -0400 Subject: [PATCH 39/40] CI,ENH: conda package build renamed to python-build --- build_envs/environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_envs/environment.yml b/build_envs/environment.yml index 853e9fb..f292805 100644 --- a/build_envs/environment.yml +++ b/build_envs/environment.yml @@ -17,5 +17,5 @@ dependencies: - sphinx_rtd_theme - wrapt - xarray - - build + - python-build - pip From 97643e7d0b0c54087a029e338878020bdcb7aa39 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:44:00 -0400 Subject: [PATCH 40/40] BLD: Update python_version to >=3.9 in pyproject.toml Don't specify Python version in CMakeLists.txt Co-authored-by: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> --- CMakeLists.txt | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 430587f..265c22c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) ) endif() -find_package(Python 3.8 REQUIRED COMPONENTS Development.Module NumPy) +find_package(Python COMPONENTS Interpreter Development.Module NumPy REQUIRED) # Ensure scikit-build modules if (NOT SKBUILD) diff --git a/pyproject.toml b/pyproject.toml index 4e4e081..5047e19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ maintainers = [ ] description = "Diagnostic and interpolation routines for WRF-ARW data." readme = "README.md" -requires-python = ">=3.7, <3.13" +requires-python = ">=3.9, <3.13" keywords = [ "python", "wrf-python", "wrf", "forecast", "model", "weather research and forecasting", "interpolation",