Skip to content

Commit

Permalink
Merge pull request #29 from carbonplan/more-typing
Browse files Browse the repository at this point in the history
update np.typing import
  • Loading branch information
Joe Hamman committed Apr 5, 2022
2 parents 6c39dd1 + 22e85b9 commit 7a36c74
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 18 deletions.
89 changes: 74 additions & 15 deletions .github/workflows/pypipublish.yaml
@@ -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
2 changes: 1 addition & 1 deletion requirements.txt
@@ -1,2 +1,2 @@
xarray>=0.16
numpy>=1.20
numpy>=1.21
3 changes: 1 addition & 2 deletions xarray_schema/types.py
@@ -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]]]

0 comments on commit 7a36c74

Please sign in to comment.