Integrate papiex C library compilation into pip install (setup.py + compile_papiex.sh)#171
Open
Integrate papiex C library compilation into pip install (setup.py + compile_papiex.sh)#171
Conversation
…mpile_papiex.sh Co-authored-by: ilaflott <6273252+ilaflott@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add papiex C library compilation step to pip install epmt
Integrate papiex C library compilation into pip install (setup.py + compile_papiex.sh)
Mar 18, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #171 +/- ##
==========================================
+ Coverage 76.67% 76.71% +0.04%
==========================================
Files 34 34
Lines 6636 6636
==========================================
+ Hits 5088 5091 +3
+ Misses 1548 1545 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ubprocess stdout stderr piping which obscures good output in the github CI
Makefile: - Remove OUTSIDE_DOCKER branch from papiex-dist rule (docker-dist only) - Update python-dist comments to document Docker-only usage - Clean up extracted papiex-epmt-install/ dir after copying .so files build_and_test_epmt.yml: - Remove OUTSIDE_DOCKER papiex tarball cache/build steps - Replace sdist-based install with direct pip install ./src - Remove -v -v flags (output now visible by default) weekly_cache_builds.yml: - Remove OUTSIDE_DOCKER papiex build/verify/cache steps setup.py: - Tee compile_papiex.sh output to /dev/tty (bypasses pip capture) - Fall back to stderr when no TTY available (CI) - Always write to install_papiex.log .gitignore: - Add src/build/, src/epmt/bin/, src/epmt/include/ Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
|
appears to work at this point- freezing but not merging yet |
Member
|
this will not be ready for releasing |
…mpile_papiex.sh Co-authored-by: ilaflott <6273252+ilaflott@users.noreply.github.com>
…ubprocess stdout stderr piping which obscures good output in the github CI
928557f to
52ac9f7
Compare
…ove-outside-docker-papiex-v2
…papiex-v2 Remove OUTSIDE_DOCKER papiex path, show build output at install time
Member
|
this is doing somethings right...
todo: forseeable problem, with possible alternative: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Folds papiex native library compilation into
pip install epmtusing the samepyproject.toml+setup.pyhybrid pattern as NOAA-GFDL/pyFMS. Compilation is best-effort: EPMT installs cleanly even when build tools or network are unavailable.New files
src/compile_papiex.sh— Downloads papiex source (or usessrc/vendor/papiex/if pre-populated) and runsmake PREFIX=<epmt_lib_dir> install. Skips gracefully (exit 0) when.sofiles are already present,gcc/make/curlare missing, or the source download fails. Exits non-zero only on actualmakefailure (caught and warned bysetup.py). RespectsPAPIEX_SRC_BRANCH,CONFIG_PAPIEX_PAPI,CONFIG_PAPIEX_DEBUG.src/setup.py— Minimal hook following pyFMS pattern. All metadata stays inpyproject.toml.Modified files
src/MANIFEST.in— Includecompile_papiex.shin sdist so it ships with the package.Makefile—vendor-papiextarget downloads papiex source intosrc/vendor/papiex/for air-gapped installs;pip-installtarget runsvendor-papiexthenpip3 install ./src;papiexcleannow also removessrc/vendor/papiexandsrc/epmt/lib..gitignore— Excludesrc/vendor/,src/epmt/lib/,install_papiex.log.build_and_test_epmt.yml— New CI step exercisespip install ./src(with papiex compiled from source) before the existing sdist-based path.epmtdocs/docs/INSTALL.md— Documentspip install epmt, themake vendor-papiex/make pip-installtargets, and the controlling environment variables.Backward compatibility
The existing Makefile workflow (
make python-dist) pre-copies.sofiles intosrc/epmt/lib/before building the sdist.compile_papiex.shdetects those files and skips compilation, so the current Docker/CI release path is unaffected.Checklist
Original prompt
Goal
Integrate the papiex C library compilation step into
pip install epmt, following the same pattern that NOAA-GFDL/pyFMS uses to compile cFMS during pip install. The approach uses declarative metadata inpyproject.tomland imperative build logic insetup.py— the recommended setuptools pattern for custom build steps.Context
Currently, EPMT and papiex are built and distributed separately:
src/pyproject.tomlusingsetuptools.build_metaas the build backend.make PREFIX=... install, producing shared libraries (libpapiex.so,libmonitor.so, etc.).Makefiledownloads the papiex source tarball viacurl, compiles it (natively or in Docker), and bundles the resultingpapiex-epmt-*.tgzalongside the EPMT pip package in the release..sofiles are included in the EPMT package via[tool.setuptools.package-data]with"lib/*.so*".pyFMS demonstrates the pattern we want to follow. Its
pyproject.tomldeclaresbuild-backend = "setuptools.build_meta"and itssetup.pydefines aCustomBuildclass that runscompile_c_libs.shbefore the normal build:Implementation Plan
1. Create
compile_papiex.shin thesrc/directory (next topyproject.toml)This script should:
src/vendor/papiexor already present).https://github.com/NOAA-GFDL/papiex(using the branch/tag configured in the top-level Makefile variablesPAPIEX_SRC_BRANCH).gccandmakeare available on the system.epmt check).make PREFIX=<target> installintosrc/epmt/lib/so the resulting.sofiles are picked up by the existing[tool.setuptools.package-data]glob"lib/*.so*".CONFIG_PAPIEX_PAPIandCONFIG_PAPIEX_DEBUGthat control papiex build options.install_papiex.logfile.2. Create
src/setup.pyFollowing pyFMS's pattern, create a minimal
setup.pythat hooks into setuptools' build step:3. Update
src/pyproject.tomlbuild-backend = "setuptools.build_meta"is set (it already is).[tool.setuptools.package-data]section already includes"lib/*.so*"which will pick up the compiled papiex libraries.pyproject.tomlsince all declarative metadata remains there.4. Update the top-level
Makefilepapiex-dist,$(PAPIEX_RELEASE),$(PAPIEX_SRC),$(PAPIEX_SRC_TARBALL)) to see if they can be simplified or if they need to reference the newcompile_papiex.sh.pip-installorinstall-with-papiex) that demonstratespip install ./srcwith papiex compilation.vendor-papiextarget that clones/downloads the papiex source intosrc/vendor/papiex/.5. Update
.github/workflowsReview...
This pull request was created from Copilot chat.
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.