Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9cdeffc
Pre-lim install changes
fmalatino May 5, 2025
4e80357
Merge branch 'main' into fix/build_system
fmalatino Sep 24, 2025
a40dc30
Testing conda install of cFMS locally
fmalatino Sep 30, 2025
c28e606
Switching to main
fmalatino Oct 15, 2025
6090002
Merging main
fmalatino Oct 17, 2025
055f01a
Merge branch 'main' into fix/build_system
fmalatino Oct 27, 2025
fdd3d25
Branch for installing cFMS from conda package
fmalatino Oct 27, 2025
4da5be8
Adding override for editable_wheel for setuptools for editable installs
fmalatino Oct 28, 2025
a3ba236
Current status of build system
fmalatino Mar 10, 2026
691d3be
Pre-lim work to use cmake install of cfms
fmalatino Mar 13, 2026
711f80d
Checking use as a dependency
fmalatino Mar 16, 2026
23f7628
Pre-lim workflow file for new install
fmalatino Mar 16, 2026
f2d3aab
Installing Python in cmake workflow
fmalatino Mar 16, 2026
d393bb8
Adding installation of lsb-release to cmake workflow
fmalatino Mar 16, 2026
ff9df29
Trying sudo in cmake workflow for install of lsb-release
fmalatino Mar 16, 2026
d5180e0
Bumping Python required version to >=3.12
fmalatino Mar 18, 2026
35f2453
Merge main
fmalatino Mar 23, 2026
47be94a
Amending workflows for new Python
fmalatino Mar 23, 2026
b9d6845
Updating before dependency install in unit test workflow
fmalatino Mar 23, 2026
2dd8023
Making install verbose in workflow
fmalatino Mar 23, 2026
7e0d56a
Linting and fixing of test_define_domains
fmalatino Mar 23, 2026
a51efb6
Amending interface fro declare_pelist
fmalatino Mar 23, 2026
92ebaeb
Amending lint workflow
fmalatino Mar 23, 2026
2e35b98
Amending test_gather use of get_current_pelist
fmalatino Mar 23, 2026
b8c57b8
Using dev build option when linting
fmalatino Mar 23, 2026
0d861ab
Amending horiz_interp test use of get_current_pelist
fmalatino Mar 23, 2026
d0b3096
Amending all tests for use of get_current_pelist
fmalatino Mar 23, 2026
4ce868a
Using xarray open_dataset in test_diag_manager
fmalatino Mar 23, 2026
05086e0
Fixing linting issues
fmalatino Mar 24, 2026
82c947e
Pointing to branch of cFMS for CMake build
fmalatino Apr 23, 2026
02085a3
Using correct URL for cFMS
fmalatino Apr 23, 2026
578ddf9
Added installation instructions to README
fmalatino Apr 28, 2026
5a279b5
Linting
fmalatino Apr 28, 2026
08a1164
Updating action steps names in Lint workflow
fmalatino Apr 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3.5.2
with:
submodules: 'recursive'
- name: Step Python
uses: actions/setup-python@v4.6.0
with:
python-version: '3.11.7'
- name: Install OpenMPI for gt4py
run: |
sudo apt-get install libopenmpi-dev netcdf-bin libnetcdf-dev libnetcdff-dev nco libyaml-dev diffutils
- name: Install Python packages
run: |
python -m pip install --upgrade pip setuptools wheel
pip install .[develop]
- name: Run lint via pre-commit
run: |
pre-commit run --all-files
- name: Checkout repository
uses: actions/checkout@v3.5.2
with:
submodules: 'recursive'
- name: Step Python
uses: actions/setup-python@v4.6.0
with:
python-version: '3.12.13'
- name: Install OpenMPI
run: |
sudo apt-get update && sudo apt-get install libopenmpi-dev netcdf-bin libnetcdf-dev libnetcdff-dev nco libyaml-dev diffutils
- name: Install Python packages
run: |
python -m pip install --upgrade pip setuptools wheel
pip install .[dev]
- name: Run lint via pre-commit
run: |
pre-commit run --all-files
36 changes: 18 additions & 18 deletions .github/workflows/unit_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ jobs:
env:
LD_LIBRARY_PATH:
steps:
- name: Checkout out hash that triggered CI
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Step Python
uses: actions/setup-python@v4.6.0
with:
python-version: '3.11.7'
- name: Install OpenMPI for gt4py
run: |
sudo apt-get install libopenmpi-dev netcdf-bin libnetcdf-dev libnetcdff-dev nco libyaml-dev diffutils
- name: install packages
run: |
pip install .[test]
- name: run tests
run: |
cd tests
./run_tests.sh -o
- name: Checkout out hash that triggered CI
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Step Python
uses: actions/setup-python@v4.6.0
with:
python-version: '3.12.13'
- name: Install Dependencies for Build
run: |
sudo apt-get update && sudo apt-get install libopenmpi-dev netcdf-bin libnetcdf-dev libnetcdff-dev nco libyaml-dev diffutils
- name: install packages
run: |
pip install -v .[test]
- name: run tests
run: |
cd tests
./run_tests.sh -o
5 changes: 0 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@

[submodule "cFMS"]
path = cFMS
url = https://github.com/NOAA-GFDL/cFMS.git
branch = main
46 changes: 19 additions & 27 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,30 @@ default_language_version:
python: python3

repos:
- repo: https://github.com/psf/black
- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
additional_dependencies: ["click==8.0.4"]
- id: black
additional_dependencies: ["click==8.0.4"]

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.4.2
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
args: ["--profile", "black"]
- id: isort
args: ["--profile", "black"]

- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
name: flake8
language_version: python3
args: [--config, setup.cfg]
exclude: |
(?x)^(
.*/__init__.py |
)$
- id: flake8
name: flake8 __init__.py files
files: "__init__.py"
# ignore unused import error in __init__.py files
args: ["--ignore=F401,E203", --config, setup.cfg]
- id: flake8
name: flake8
language_version: python3
additional_dependencies: [Flake8-pyproject, flake8-bugbear]
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.18)

project(pyfms LANGUAGES C Fortran)

include(FetchContent)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

FetchContent_Declare(
cFMS
GIT_REPOSITORY https://github.com/NOAA-GFDL/cFMS.git
GIT_TAG main
)
FetchContent_MakeAvailable(cFMS)

install(TARGETS cFMS DESTINATION ${SKBUILD_PLATLIB_DIR})
62 changes: 61 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,61 @@
# fms2py
# pyFMS

The `pyFMS` package is a Python-C-Fortran interface (through the use of the `ctypes` package), for access to select methods from the Flexible Modeling System (`FMS`) developed by NOAA/GFDL (https://github.com/NOAA-GFDL/FMS.git).

## Quickstart - bare metal

### Build

The build backend of `pyFMS` is `scikit-build-core`, which allows for the compilation of extension modules for Python packages through CMake.

`pyFMS` requires:

- GCC > 9.2
- MPI
- Python 3.12

To clone `pyFMS` from its GitHub repository:

```shell
git clone https://github.com/NOAA-GFDL/pyFMS.git
```

We recommend creating a Python `venv` or `conda` environment for your installation.

```shell
python -m venv <name_of_environment>
source .<name_of_environment>/bin/activate
```

Inside of your Python environment, to install `pyFMS` and its dependencies:

```shell
pip install .[install_options]
```

The available `install_options` are:
- `test`
- `dev` (which installs the `test` dependecies as well)
- `extras` (which installs the `dev` dependencies as well)

For developers we suggest installing with the editable flag `-e` and the verbose flag `-v`:

```shell
pip install -e -v .[dev]
```

use of the editable installation method will allow updates to the Python source code to be reflected in the installation without re-installing. Subsequent installs of `pyFMS` will recompile all extension modules, due to the methods of compilation used by `scikit-build-core`.

The `CMakeLists.txt` file will be accessed by the build backend during the installation to compile the necessary shared object file from the C-Fortran interface, `cFMS`, to be loaded by the `ctypes` package for use by `pyFMS`.

### Editing the extension modules of pyFMS

If you require a different version of `cFMS` and/or its dependency `FMS`, depending on the use case, two methods of use are available:

1. Edit the `CMakeLists.txt` file to point to the repository containing your custom `cFMS` and/or `FMS` to install it alongside `pyFMS` through the methods outlined above
2. Perform a separate compilation of `cFMS` and/or `FMS` outside of the provided build tools and point to the desired shared object file when running `pyfms.cfms.init(libpath=<path_to_shared_object_library>)`

## pyFMS as a dependency

This package can be treated like any Python package when used needed as a dependency; ensure it is defined as a dependency for your project, and import as usual.
Subsequent installs of the dependent package will not trigger a recompilation of the extension modules of pyFMS, unless directly called to due so by a reinstall of pyFMS, as the dependency manager of the build backend for the dependent project will see the requirements of pyFMS are satisfied. If an editable version of pyFMS is needed for the dependent package, please use the method of editable install detailed above.
1 change: 0 additions & 1 deletion cFMS
Submodule cFMS deleted from ea7636
Loading
Loading