-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update PyPI workflow to build and upload intake-esm artifacts (#659)
- Loading branch information
1 parent
1e6229d
commit 141425b
Showing
7 changed files
with
133 additions
and
91 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,84 @@ | ||
name: Publish intake-esm to PyPI | ||
name: Build and Upload intake-esm to PyPI | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
push: | ||
|
||
jobs: | ||
deploy: | ||
if: github.repository == 'intake/intake-esm' | ||
build-artifacts: | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'intake/intake-esm' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v5 | ||
name: Install Python | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install setuptools setuptools-scm wheel twine check-manifest | ||
- name: Build tarball and wheels | ||
run: | | ||
git clean -xdf | ||
git restore -SW . | ||
python -m build --sdist --wheel . | ||
- name: Test the artifacts | ||
- name: Check built artifacts | ||
run: | | ||
python -m twine check dist/* | ||
pwd | ||
if [ -f dist/intake-esm-unknown.tar.gz ]; then | ||
echo "❌ INVALID VERSION NUMBER" | ||
exit 1 | ||
else | ||
echo "✅ Looks good" | ||
fi | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: releases | ||
path: dist | ||
|
||
test-built-dist: | ||
needs: build-artifacts | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-python@v5 | ||
name: Install Python | ||
with: | ||
python-version: "3.11" | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: releases | ||
path: dist | ||
- name: List contents of built dist | ||
run: | | ||
ls -ltrh | ||
ls -ltrh dist | ||
- name: Verify the built dist/wheel is valid | ||
if: github.event_name == 'push' | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install dist/intake_esm*.whl | ||
python -c "import intake_esm; print(intake_esm.__version__)" | ||
upload-to-pypi: | ||
needs: test-built-dist | ||
if: github.event_name == 'release' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: releases | ||
path: dist | ||
- name: Publish package to PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
user: ${{ secrets.PYPI_USERNAME }} | ||
password: ${{ secrets.PYPI_PASSWORD }} | ||
verbose: true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,3 +118,4 @@ tests/test_collections/*.nc | |
dask-worker-space/ | ||
|
||
CMIP6-MRI-ESM2-0* | ||
intake_esm/_version.py |
This file contains 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
This file contains 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
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,65 @@ | ||
[tool.black] | ||
line-length = 100 | ||
target-version = ['py310'] | ||
skip-string-normalization = true | ||
|
||
[build-system] | ||
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"] | ||
|
||
[tool.pytest.ini_options] | ||
console_output_style = "count" | ||
addopts = "--cov=./ --cov-report=xml --verbose" | ||
markers = "network: tests requiring a network connection" | ||
[project] | ||
name = "intake-esm" | ||
description = "An intake plugin for parsing an Earth System Model (ESM) catalog and loading netCDF files and/or Zarr stores into Xarray datasets." | ||
readme = "README.md" | ||
license = {text="Apache Software License 2.0"} | ||
requires-python = ">=3.10" | ||
maintainers = [ | ||
{ name = "NCAR XDev Team", email = "[email protected]" }, | ||
] | ||
keywords = [ | ||
"catalog", | ||
"intake", | ||
"xarray", | ||
] | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Topic :: Scientific/Engineering", | ||
] | ||
|
||
dynamic = ["version", "dependencies"] | ||
|
||
[tool.setuptools.dynamic] | ||
|
||
dependencies = { file = ["requirements.txt"] } | ||
optional-dependencies = { dev = { file = ["requirements-dev.txt"] } } | ||
|
||
[project.entry-points."intake.drivers"] | ||
esm_datasource = "intake_esm.source:ESMDataSource" | ||
esm_datastore = "intake_esm.core:esm_datastore" | ||
|
||
[project.urls] | ||
Documentation = "https://intake-esm.readthedocs.io" | ||
Homepage = "https://intake-esm.readthedocs.io" | ||
Source = "https://github.com/intake/intake-esm" | ||
Tracker = "https://github.com/intake/intake-esm/issues" | ||
|
||
|
||
[tool.setuptools.packages.find] | ||
include = ["intake_esm*"] | ||
|
||
[tool.setuptools.package-data] | ||
intake_esm = ["py.typed"] | ||
|
||
|
||
|
||
[tool.setuptools_scm] | ||
version_scheme = "post-release" | ||
local_scheme = "node-and-date" | ||
fallback_version = "999" | ||
write_to = "intake_esm/_version.py" | ||
write_to_template = '__version__ = "{version}"' | ||
|
||
|
||
|
||
|
@@ -82,3 +132,8 @@ docstring-code-format = true | |
|
||
[tool.ruff.lint.pydocstyle] | ||
convention = "numpy" | ||
|
||
[tool.pytest.ini_options] | ||
console_output_style = "count" | ||
addopts = "--cov=./ --cov-report=xml --verbose" | ||
markers = "network: tests requiring a network connection" |