forked from pydata/xarray
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into groupby-refactor-init
* main: pass kwargs through from save_mfdataset to to_netcdf (pydata#6686) Docs: indexing.rst finetuning (pydata#6685) use micromamba instead of mamba (pydata#6674) install the development version of `matplotlib` into the upstream-dev CI (pydata#6675) Add whatsnew section for v2022.06.0 release notes for 2022.06.0rc0 release notes for the pre-release (pydata#6676) more testpypi workflow fixes (pydata#6673) thin: add examples (pydata#6663) Update multidimensional-coords.ipynb (pydata#6672) try to finally fix the TestPyPI workflow (pydata#6671) pin setuptools in the modify script (pydata#6669) fix the python version for the TestPyPI workflow (pydata#6668) upload wheels from `main` to TestPyPI (pydata#6660) Set keep_attrs for flox (pydata#6667)
- Loading branch information
Showing
16 changed files
with
413 additions
and
95 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import argparse | ||
import copy | ||
import pathlib | ||
|
||
import tomli | ||
import tomli_w | ||
|
||
|
||
def split_path(path, sep="/"): | ||
if isinstance(path, str): | ||
return [part for part in path.split(sep) if part] | ||
else: | ||
return path | ||
|
||
|
||
def extract(mapping, path, sep="/"): | ||
parts = split_path(path, sep=sep) | ||
cur = mapping | ||
for part in parts: | ||
cur = cur[part] | ||
|
||
return cur | ||
|
||
|
||
def update(mapping, path, value, sep="/"): | ||
new = copy.deepcopy(mapping) | ||
|
||
parts = split_path(path, sep=sep) | ||
parent = extract(new, parts[:-1]) | ||
parent[parts[-1]] = value | ||
|
||
return new | ||
|
||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("path", type=pathlib.Path) | ||
args = parser.parse_args() | ||
|
||
content = args.path.read_text() | ||
decoded = tomli.loads(content) | ||
with_local_scheme = update( | ||
decoded, "tool.setuptools_scm.local_scheme", "no-local-version", sep="." | ||
) | ||
# work around a bug in setuptools / setuptools-scm | ||
with_setuptools_pin = copy.deepcopy(with_local_scheme) | ||
requires = extract(with_setuptools_pin, "build-system.requires", sep=".") | ||
requires[0] = "setuptools>=42,<60" | ||
|
||
new_content = tomli_w.dumps(with_setuptools_pin) | ||
args.path.write_text(new_content) |
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 |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: Build and Upload xarray to PyPI | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
# no need for concurrency limits | ||
|
||
jobs: | ||
build-artifacts: | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'pydata/xarray' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-python@v3 | ||
name: Install Python | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install build setuptools setuptools-scm wheel twine check-manifest | ||
python -m pip install tomli tomli_w | ||
- name: Disable local versions | ||
run: | | ||
python .github/workflows/configure-testpypi-version.py pyproject.toml | ||
git update-index --assume-unchanged pyproject.toml | ||
cat pyproject.toml | ||
- name: Build tarball and wheels | ||
run: | | ||
git clean -xdf | ||
python -m build --sdist --wheel . | ||
- name: Check built artifacts | ||
run: | | ||
python -m twine check dist/* | ||
pwd | ||
if [ -f dist/xarray-0.0.0.tar.gz ]; then | ||
echo "❌ INVALID VERSION NUMBER" | ||
exit 1 | ||
else | ||
echo "✅ Looks good" | ||
fi | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: releases | ||
path: dist | ||
|
||
test-built-dist: | ||
needs: build-artifacts | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-python@v3 | ||
name: Install Python | ||
with: | ||
python-version: "3.10" | ||
- uses: actions/download-artifact@v3 | ||
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/xarray*.whl | ||
python -m xarray.util.print_versions | ||
- name: Publish package to TestPyPI | ||
if: github.event_name == 'push' | ||
uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TESTPYPI_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
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
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
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
Oops, something went wrong.