Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a658c81
Upgrade GitHub Actions for Python setup and artifact upload
tharen Mar 16, 2026
4989a09
Update build step separate wheel and sdist packaging
tharen Mar 16, 2026
550df45
Install build package in Python workflow
tharen Mar 16, 2026
3eb9c56
Refactor GitHub Actions workflow for Python package
tharen Mar 16, 2026
8022847
Install additional packages for sdist creation
tharen Mar 16, 2026
e3b5cb6
Update Python setup step in workflow file
tharen Mar 18, 2026
619c908
Comment out dependency on make-wheels for make-sdist
tharen Mar 18, 2026
34eee9d
Debugging actions
tharen May 23, 2026
2dbbf51
debugging actions
tharen May 23, 2026
3aca047
debugging actions
tharen May 23, 2026
42da574
Add TestPyPi publishing after clean build and tests
tharen May 24, 2026
8fb47d9
Update publish-testpypi.yml
tharen May 24, 2026
781b16b
Update python-package.yml
tharen May 24, 2026
bbf9923
Delete .github/workflows/publish-testpypi.yml
tharen May 24, 2026
90a16de
Update python-package.yml
tharen May 24, 2026
e3eeccf
Update action workflow to use cibuildwheels
tharen May 25, 2026
e0b0463
Update build version requirement
tharen May 25, 2026
8b889b1
Update actions cibuildwheel config
tharen May 25, 2026
2095583
revert
tharen May 25, 2026
d068cc0
Testing alternate CI build and publish workflow
tharen May 25, 2026
b2a0bd5
Add testing to the cibuildwheel workflow
tharen May 26, 2026
9e1220c
Towards dev version assignment cleanup.
tharen May 26, 2026
2089414
Update test run location
tharen May 26, 2026
4986277
Merge main into dev and resolve conflicts in workflow
tharen May 26, 2026
8469d91
Skip tests to verify versioning
tharen May 26, 2026
e3181c0
Reconfigure as a "src" project structure
tharen May 26, 2026
2496259
Testing src project structure
tharen May 26, 2026
d524f08
Move cibuildwheel config to pyproject.toml
tharen May 26, 2026
9e550f8
Remove distutils import from fvs.py
tharen May 26, 2026
03d6b29
Move api sources into src
tharen May 26, 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
186 changes: 137 additions & 49 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
# This workflow builds binary wheels using cibuildwheel and a source distribution.
# cibuildwheel handles manylinux and Windows wheel building across Python versions.
# Publishes to TestPyPI on pushes to dev, and PyPI on pushes to main.

name: Build Packages

Expand All @@ -10,80 +11,167 @@ on:
branches: [ "main", "dev" ]

jobs:
build:

make-wheels:
name: Build wheels on ${{ matrix.os }} (compiler ${{ matrix.compiler-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.10","3.11","3.12","3.13"]
os: [ubuntu-latest, windows-latest] #, macos-latest]
compiler: [gcc]
compiler-version: [13, 15]
exclude:
- os: windows-latest
compiler-version: 15
include:
- os: ubuntu-latest
compiler: gcc
compiler-version: 15
- os: windows-latest
compiler: gcc
compiler-version: 13

steps:
- name: Fortran Setup
uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}
compiler: ${{ matrix.compiler }}
version: ${{ matrix.compiler-version }}

- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
submodules: recursive

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
cache: 'pip'

- name: show-versions
fetch-depth: 0

- name: Show compiler versions
run: |
gcc --version
gfortran --version

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install click numpy pandas matplotlib build wheel setuptools setuptools_scm meson-python pytest ninja

- name: Install Patchelf
if: runner.os == 'Linux'
run: |
python -m pip install patchelf

- name: Build and package
run: |
python -m build --no-isolation

- name: Store Wheel
uses: actions/upload-artifact@v4
- name: Build wheels
uses: pypa/cibuildwheel@v3.4.1
env:
# Build for Python 3.10–3.13, 64-bit only
CIBW_BUILD: cp310-* cp311-* cp312-* cp313-* cp314-*
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux*"
CIBW_ARCHS_LINUX: x86_64
CIBW_ARCHS_WINDOWS: AMD64

# Use manylinux_2_28 to get a gfortran-15-capable image
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_28_x86_64

# Install build dependencies inside the wheel-build environment
CIBW_BEFORE_BUILD_LINUX: |
dnf install -y gcc-gfortran ninja-build &&
pip install click numpy pandas build wheel setuptools setuptools_scm meson-python ninja patchelf

CIBW_BEFORE_BUILD_WINDOWS: |
pip install click numpy pandas build wheel setuptools setuptools_scm meson-python ninja

CIBW_BUILD_FRONTEND: "build"
CIBW_BUILD_VERBOSITY: 1

with:
name: pyfvs-${{ runner.os }}-py${{ matrix.python-version }}-wheels
output-dir: dist

- name: Store wheels
uses: actions/upload-artifact@v7
with:
name: pyfvs-${{ matrix.os }}-wheels
path: dist/*.whl
if-no-files-found: warn
overwrite: true

- name: Store Sdist
uses: actions/upload-artifact@v4

make-sdist:
name: Build source distribution
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
architecture: x64
cache: pip

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install click numpy pandas build wheel \
setuptools setuptools_scm meson-python ninja patchelf

- name: Create sdist
run: python -m build --sdist --no-isolation

- name: Store sdist
uses: actions/upload-artifact@v7
with:
name: pyfvs-sdist
path: dist/*.tar.gz
if-no-files-found: warn
overwrite: true

- name: Test with pytest
working-directory: .
run: |
pip install confuse typing-extensions openpyxl
pip install dist/*.whl
pytest
publish-testpypi:
name: Publish to TestPyPI (dev branch)
if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
needs: [ make-wheels, make-sdist ]
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/pyfvs
permissions:
id-token: write # Required for OIDC trusted publishing

steps:
- name: Download all wheels
uses: actions/download-artifact@v4
with:
pattern: pyfvs-*-wheels
path: dist
merge-multiple: true

- name: Download sdist
uses: actions/download-artifact@v4
with:
name: pyfvs-sdist
path: dist

- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
verbose: true

publish-pypi:
name: Publish to PyPI (main branch)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [ make-wheels, make-sdist ]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pyfvs
permissions:
id-token: write # Required for OIDC trusted publishing

steps:
- name: Download all wheels
uses: actions/download-artifact@v4
with:
pattern: pyfvs-*-wheels
path: dist
merge-multiple: true

- name: Download sdist
uses: actions/download-artifact@v4
with:
name: pyfvs-sdist
path: dist

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ Python wrappers and utilities for using the Forest Vegetation Simulator

The PyFVS [FVS source code](https://github.com/forest-modeling/ForestVegetationSimulator/tree/open-dev) is forked from the [USFS FVS GitHub](https://github.com/USDAForestService/ForestVegetationSimulator) repository, [open-dev](https://github.com/USDAForestService/ForestVegetationSimulator/tree/open-dev) branch

_____ ______ __ __ _____
| __ \ | ____|\ \ / / / ____|
| |__) | _ _ | |__ \ \ / / | (____
| ___/ | | | | | __| \ \/ / \___ \
| | | |__| | | | \ / ____) |
|_| \____ | |_| \/ |______/
__/ |
|___/

## Documentation

Check out the new AI generated documentation [wiki](https://deepwiki.com/forest-modeling/PyFVS).
Expand Down
44 changes: 22 additions & 22 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ foreach variant : variants
variant_args += '-DFVS_MORTS_WRAP'

# Add the wrappers to the file lists
f_sources += 'api/variant/@0@/morts_fvs.f'.format(variant)
f90_sources += 'api/morts_wrap.f90'
f_sources += 'src/api/variant/@0@/morts_fvs.f'.format(variant)
f90_sources += 'src/api/morts_wrap.f90'

endif

Expand All @@ -368,7 +368,7 @@ foreach variant : variants
conf_data = configuration_data()
conf_data.set('variant', variant)
configure_file(
input: 'api/globals.f90.in',
input: 'src/api/globals.f90.in',
output: variant + '_globals.f90',
configuration: conf_data
)
Expand All @@ -377,26 +377,26 @@ foreach variant : variants
f90_sources += join_paths(meson.project_build_root(), variant + '_globals.f90')

# Additional API files to compile
# f90_sources += 'api/apisubs.f90'

f90_sources += 'api/version.f90'
f90_sources += 'api/fvs_api.f90'
# f90_sources += 'api/sim_monitor.f90'
# f90_sources += 'api/initialize.f90'
f90_sources += 'api/inventory_trees.f90'
f90_sources += 'api/fvs_step.f90'
f90_sources += 'api/tree_data.f90'
f90_sources += 'api/snag_data.f90'
f90_sources += 'api/carbon_data.f90'
f90_sources += 'api/downwood_data.f90'
# f90_sources += 'api/step_tregro.f90'
f90_sources += 'api/prtrls_wrap.f90'
# f90_sources += 'api/stop_wrap.f90'
# f90_sources += 'api/foo.f90'
# f90_sources += 'api/test.f90'
# f90_sources += 'src/api/apisubs.f90'

f90_sources += 'src/api/version.f90'
f90_sources += 'src/api/fvs_api.f90'
# f90_sources += 'src/api/sim_monitor.f90'
# f90_sources += 'src/api/initialize.f90'
f90_sources += 'src/api/inventory_trees.f90'
f90_sources += 'src/api/fvs_step.f90'
f90_sources += 'src/api/tree_data.f90'
f90_sources += 'src/api/snag_data.f90'
f90_sources += 'src/api/carbon_data.f90'
f90_sources += 'src/api/downwood_data.f90'
# f90_sources += 'src/api/step_tregro.f90'
f90_sources += 'src/api/prtrls_wrap.f90'
# f90_sources += 'src/api/stop_wrap.f90'
# f90_sources += 'src/api/foo.f90'
# f90_sources += 'src/api/test.f90'

# ## TODO: Auto-generate F90 includes from F77
# f90_inc_dirs += 'api/gen/@0@/include'.format(variant)
# f90_inc_dirs += 'src/api/gen/@0@/include'.format(variant)

# # Add the include folders as a dependency to trigger
# inc_dep = declare_dependency(
Expand Down Expand Up @@ -537,4 +537,4 @@ foreach variant : variants
# End variant loop
endforeach

subdir('pyfvs')
subdir('src/pyfvs')
4 changes: 2 additions & 2 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
option('fvsvariants', type: 'array',
choices: ['pn','wc','so','op','oc','ec','ca','nc','bm','ie','ci','ak','ws'], #,'em','tt','cr','ut','ls','cs','sn','ne'],
value: ['pn','wc','so','op','oc','ec','ca','nc','bm','ie','ci','ak','ws'], #,'em','tt','cr','ut','ls','cs','sn','ne'],
# value: ['pn','wc','so','op','oc','ec','ca','nc','bm','ie','ci','ak','ws'], #,'em','tt','cr','ut','ls','cs','sn','ne'],
# value: ['pn','wc','so','op','oc','ec','ca','nc','bm'],
# value: ['ie','ci','ak',],
# value: ['pn',],
value: ['pn',],
# value: ['ws',],
description: 'FVS variants to build'
)
39 changes: 0 additions & 39 deletions pyfvs/pyfvs.cfg

This file was deleted.

Loading
Loading