Skip to content

Publish uwtools releases to PyPI - #969

Open
elcarpenterNOAA wants to merge 3 commits into
ufs-community:mainfrom
elcarpenterNOAA:publish-to-pypi
Open

Publish uwtools releases to PyPI#969
elcarpenterNOAA wants to merge 3 commits into
ufs-community:mainfrom
elcarpenterNOAA:publish-to-pypi

Conversation

@elcarpenterNOAA

@elcarpenterNOAA elcarpenterNOAA commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Synopsis

  • build a PyPI wheel as part of the release workflow
  • publish release wheels to PyPI using Trusted Publishing
  • add CI build tooling to create wheel

Testing: I did a test on my fork (see PR here) and successfully published a package to TesPyPI, which you can try out here. I installed it locally, and confirmed it was working and that ecflow was excluded from uw --help.

Documentation still needs to be written, but I don't feel I'm in a position to write it until it actually exists on PyPI.

Type

  • Bug fix (corrects a known issue)
  • Code maintenance (refactoring, etc. without behavior change)
  • Documentation
  • Enhancement (adds new functionality)
  • Tooling (CI, code-quality, packaging, revision-control, etc.)

Impact

  • This is a breaking change (changes existing functionality)
  • This is a non-breaking change (existing functionality continues to work as expected)

Checklist

  • I have added myself and any co-authors to the PR's Assignees list.
  • I have reviewed the documentation and have made any updates necessitated by this change.
  • Where helpful, I have written comments in this PR's Files changed view to assist reviewers.

@elcarpenterNOAA elcarpenterNOAA self-assigned this Aug 27, 2026

. $(dirname ${BASH_SOURCE[0]})/common.sh
ci_conda_activate
unset CONDEV_SHELL

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

setup.py omits install_requires when CONDEV_SHELL is set, and we need that info to get the Requires-Dist data.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm pretty ignorant about how wheels are built: If install_requires is enabled, does the wheel still contain only the uwtools code, and not the code from dependency packages? I'd hope that the uwtools wheel just contains the uwtools code, plus metadata that tells it what other wheels to install along with it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Correct, the wheel contains the uwtools package, and install_requires adds the metadata.

Comment on lines +12 to +13
permissions:
id-token: write

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This enables GitHub OIDC for Trusted Publishing.

@elcarpenterNOAA
elcarpenterNOAA marked this pull request as ready for review August 27, 2026 23:11

@maddenp-cu maddenp-cu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If anything goes wrong at release time, it's easy to remove conda packages from our ufs-community channel and re-run the release workflow without incrementing versions. Not so easy with PyPI, of course. 🤞


. $(dirname ${BASH_SOURCE[0]})/common.sh
ci_conda_activate
unset CONDEV_SHELL

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm pretty ignorant about how wheels are built: If install_requires is enabled, does the wheel still contain only the uwtools code, and not the code from dependency packages? I'd hope that the uwtools wheel just contains the uwtools code, plus metadata that tells it what other wheels to install along with it.

Comment thread .github/workflows/release.yaml Outdated
Comment on lines +22 to +23
- name: Make PyPI Package
run: .github/scripts/pypi-package-build.sh

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does the PyPI package build run any tests? I guess not. Would it be a good idea to move this step below the conda Make Package step, in that the conda package build will run all the tests and so, if it fails, this workflow won't bother building the wheel? I think the workflow is already safe in that it won't publish to PyPI if the conda build/publish fails, but it might save a little bit of CI time to not even try to build the wheel if we can't build the conda package.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good call. I moved it.

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.

2 participants