Skip to content

Commit 495f539

Browse files
authored
Merge xarray-contrib/datatree#20 from jhamman/ci
Add basic CI setup
2 parents c0a75b5 + 2709f18 commit 495f539

9 files changed

+222
-16
lines changed

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
# Check for updates to GitHub Actions every weekday
11+
interval: "daily"

.github/workflows/main.yaml

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: "*"
6+
pull_request:
7+
branches: main
8+
schedule:
9+
- cron: "0 0 * * *"
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/[email protected]
16+
- uses: actions/[email protected]
17+
- uses: pre-commit/[email protected]
18+
19+
test:
20+
name: ${{ matrix.python-version }}-build
21+
runs-on: ubuntu-latest
22+
strategy:
23+
matrix:
24+
python-version: [3.7, 3.8, 3.9]
25+
steps:
26+
- uses: actions/[email protected]
27+
- uses: conda-incubator/setup-miniconda@v2
28+
with:
29+
mamba-version: "*"
30+
auto-update-conda: true
31+
python-version: ${{ matrix.python-version }}
32+
auto-activate-base: false
33+
activate-environment: datatree
34+
environment-file: ci/environment.yml
35+
- name: Conda info
36+
shell: bash -l {0}
37+
run: conda info
38+
- name: Conda list
39+
shell: bash -l {0}
40+
run: conda list
41+
- name: Install datatree
42+
shell: bash -l {0}
43+
run: |
44+
python -m pip install --no-deps -e .
45+
python -m pip list
46+
- name: Running Tests
47+
shell: bash -l {0}
48+
run: |
49+
python -m pytest --cov=./ --cov-report=xml --verbose
50+
# - name: Upload coverage to Codecov
51+
# uses: codecov/[email protected]
52+
# if: ${{ matrix.python-version }} == 3.8
53+
# with:
54+
# file: ./coverage.xml
55+
# fail_ci_if_error: false
56+
57+
test-upstream:
58+
name: ${{ matrix.python-version }}-dev-build
59+
runs-on: ubuntu-latest
60+
strategy:
61+
matrix:
62+
python-version: [3.8, 3.9]
63+
steps:
64+
- uses: actions/[email protected]
65+
- uses: conda-incubator/setup-miniconda@v2
66+
with:
67+
mamba-version: "*"
68+
auto-update-conda: true
69+
python-version: ${{ matrix.python-version }}
70+
auto-activate-base: false
71+
activate-environment: datatree
72+
environment-file: ci/environment.yml
73+
- name: Conda info
74+
shell: bash -l {0}
75+
run: conda info
76+
- name: Conda list
77+
shell: bash -l {0}
78+
run: conda list
79+
- name: Install dev reqs
80+
shell: bash -l {0}
81+
run: |
82+
python -m pip install --no-deps --upgrade \
83+
git+https://github.com/pydata/xarray \
84+
git+https://github.com/Unidata/netcdf4-python \
85+
git+https://github.com/c0fec0de/anytree
86+
python -m pip install --no-deps -e .
87+
python -m pip list
88+
- name: Running Tests
89+
shell: bash -l {0}
90+
run: |
91+
python -m pytest --verbose

.github/workflows/pypipublish.yaml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Upload Python Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/[email protected]
12+
- name: Set up Python
13+
uses: actions/[email protected]
14+
with:
15+
python-version: "3.x"
16+
- name: Install dependencies
17+
run: |
18+
python -m pip install --upgrade pip
19+
python -m pip install setuptools setuptools-scm wheel twine
20+
- name: Build and publish
21+
env:
22+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
23+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
24+
run: |
25+
python setup.py sdist bdist_wheel
26+
twine upload dist/*

.pre-commit-config.yaml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# https://pre-commit.com/
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.0.1
5+
hooks:
6+
- id: trailing-whitespace
7+
- id: end-of-file-fixer
8+
- id: check-yaml
9+
# isort should run before black as black sometimes tweaks the isort output
10+
- repo: https://github.com/PyCQA/isort
11+
rev: 5.9.3
12+
hooks:
13+
- id: isort
14+
# https://github.com/python/black#version-control-integration
15+
- repo: https://github.com/psf/black
16+
rev: 21.7b0
17+
hooks:
18+
- id: black
19+
- repo: https://github.com/keewis/blackdoc
20+
rev: v0.3.4
21+
hooks:
22+
- id: blackdoc
23+
- repo: https://gitlab.com/pycqa/flake8
24+
rev: 3.9.2
25+
hooks:
26+
- id: flake8
27+
# - repo: https://github.com/Carreau/velin
28+
# rev: 0.0.8
29+
# hooks:
30+
# - id: velin
31+
# args: ["--write", "--compact"]
32+
- repo: https://github.com/pre-commit/mirrors-mypy
33+
rev: v0.910
34+
hooks:
35+
- id: mypy
36+
# Copied from setup.cfg
37+
exclude: "properties|asv_bench"
38+
additional_dependencies: [
39+
# Type stubs
40+
types-python-dateutil,
41+
types-pkg_resources,
42+
types-PyYAML,
43+
types-pytz,
44+
# Dependencies that are typed
45+
numpy,
46+
typing-extensions==3.10.0.0,
47+
]
48+
# run this occasionally, ref discussion https://github.com/pydata/xarray/pull/3194
49+
# - repo: https://github.com/asottile/pyupgrade
50+
# rev: v1.22.1
51+
# hooks:
52+
# - id: pyupgrade
53+
# args:
54+
# - "--py3-only"
55+
# # remove on f-strings in Py3.7
56+
# - "--keep-percent-format"

ci/environment.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: datatree
2+
channels:
3+
- conda-forge
4+
- nodefaults
5+
dependencies:
6+
- xarray >=0.19.0
7+
- netcdf4
8+
- anytree
9+
- pytest
10+
- flake8
11+
- black
12+
- codecov
13+
- pytest-cov

datatree/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.1.dev9+g805d97f.d20210817"
1+
__version__ = "0.1.dev46+g415cbb7.d20210825"

dev-requirements.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pytest
2+
flake8
3+
black
4+
codecov
5+
pytest-cov
6+
-r requirements.txt

requirements.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
xarray>=0.19.0
2+
netcdf4
3+
anytree
4+
future

setup.py

+14-15
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
1+
from os.path import exists
12
from setuptools import find_packages, setup
23

3-
install_requires = [
4-
"xarray>=0.19.0",
5-
"netcdf4"
6-
"anytree",
7-
"future",
8-
]
94

10-
extras_require = {'tests':
11-
[
12-
"pytest",
13-
"flake8",
14-
"black",
15-
"codecov",
16-
]
17-
}
5+
with open('requirements.txt') as f:
6+
install_requires = f.read().strip().split('\n')
7+
8+
if exists('README.rst'):
9+
with open('README.rst') as f:
10+
long_description = f.read()
11+
else:
12+
long_description = ''
13+
1814

1915
setup(
2016
name="datatree",
2117
description="Hierarchical tree-like data structures for xarray",
18+
long_description=long_description,
2219
url="https://github.com/TomNicholas/datatree",
2320
author="Thomas Nicholas",
2421
author_email="[email protected]",
@@ -29,11 +26,13 @@
2926
"Topic :: Scientific/Engineering",
3027
"License :: OSI Approved :: Apache License",
3128
"Operating System :: OS Independent",
29+
"Programming Language :: Python :: 3",
3230
"Programming Language :: Python :: 3.7",
31+
"Programming Language :: Python :: 3.8",
32+
"Programming Language :: Python :: 3.9",
3333
],
3434
packages=find_packages(exclude=["docs", "tests", "tests.*", "docs.*"]),
3535
install_requires=install_requires,
36-
extras_require=extras_require,
3736
python_requires=">=3.7",
3837
setup_requires="setuptools_scm",
3938
use_scm_version={

0 commit comments

Comments
 (0)