Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update np.typing import #29

Merged
merged 3 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 74 additions & 15 deletions .github/workflows/pypipublish.yaml
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
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
xarray>=0.16
numpy>=1.20
numpy>=1.21
3 changes: 1 addition & 2 deletions xarray_schema/types.py
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]]]