Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from carbonplan/more-typing
update np.typing import
- Loading branch information
Showing
3 changed files
with
76 additions
and
18 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,26 +1,85 @@ | ||
name: Upload Python Package | ||
|
||
name: Build distribution | ||
on: | ||
release: | ||
types: [created] | ||
types: | ||
- published | ||
push: | ||
|
||
jobs: | ||
deploy: | ||
build-artifacts: | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'carbonplan/xarray-schema' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3.1.0 | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v3 | ||
name: Install Python | ||
with: | ||
python-version: "3.x" | ||
python-version: 3.9 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install setuptools setuptools-scm wheel twine | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
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: Check built artifacts | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* | ||
python -m twine check dist/* | ||
pwd | ||
if [ -f dist/xarray-schema-unknown.tar.gz ]; then | ||
echo "❌ INVALID VERSION NUMBER" | ||
exit 1 | ||
else | ||
echo "✅ Looks good" | ||
fi | ||
- uses: actions/upload-artifact@v2 | ||
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.9 | ||
- uses: actions/download-artifact@v2 | ||
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_schema*.whl | ||
python -c "import xarray_schema; print(xarray_schema.__version__)" | ||
upload-to-pypi: | ||
needs: test-built-dist | ||
if: github.event_name == 'release' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: releases | ||
path: dist | ||
- name: Publish package to PyPI | ||
uses: pypa/gh-action-pypi-publish@v1.5.0 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_TOKEN }} | ||
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
xarray>=0.16 | ||
numpy>=1.20 | ||
numpy>=1.21 |
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,8 +1,7 @@ | ||
from typing import Dict, Tuple, Union | ||
|
||
import numpy as np | ||
from numpy.typing import DTypeLike # noqa: F401 | ||
|
||
DTypeLike = np.typing.DTypeLike | ||
DimsT = Tuple[Union[str, None]] | ||
ShapeT = Tuple[Union[int, None]] | ||
ChunksT = Union[bool, Dict[str, Union[int, None]]] |