Skip to content

Commit f8ed765

Browse files
authored
Update CI (#36)
1 parent df6b9f0 commit f8ed765

File tree

9 files changed

+110
-139
lines changed

9 files changed

+110
-139
lines changed

Diff for: .github/ISSUE_TEMPLATE/bugreport.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Bug Report
2+
description: File a bug report to help us improve
3+
title: '[Bug]: '
4+
labels: [bug, triage]
5+
assignees: []
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: |
10+
Thanks for submitting an issue!
11+
- type: textarea
12+
id: what-happened
13+
attributes:
14+
label: What happened?
15+
description: |
16+
Describe what you were trying to get done.
17+
Tell us what happened, what went wrong, and what you expected to happen.
18+
placeholder: Tell us what you see!
19+
value: 'A bug happened!'
20+
validations:
21+
required: true
22+
- type: textarea
23+
id: sample-code
24+
attributes:
25+
label: Relevant log output
26+
description: |
27+
Minimal, self-contained copy-pastable example that generates the issue if possible. Please be concise with code posted. See guidelines below on how to provide a good bug report:
28+
29+
- [Minimal Complete Verifiable Examples](https://stackoverflow.com/help/mcve)
30+
- [Craft Minimal Bug Reports](http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports)
31+
render: shell
32+
- type: textarea
33+
id: logs
34+
attributes:
35+
label: Relevant log output
36+
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
37+
render: shell
38+
- type: dropdown
39+
id: version
40+
attributes:
41+
label: Version
42+
description: What version of xpersist are you running?
43+
options:
44+
- main
45+
validations:
46+
required: true
47+
- type: dropdown
48+
id: python-version
49+
attributes:
50+
label: Which Python version are you using?
51+
multiple: true
52+
options:
53+
- '3.7'
54+
- '3.8'
55+
- '3.9'
56+
- '3.10'

Diff for: .github/PULL_REQUEST_TEMPLATE.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!-- Thanks for submitting a PR, your contribution is really appreciated! -->
2+
<!-- Unless your change is trivial, please create an issue to discuss the change before creating a PR -->
3+
<!-- Below are a few things we ask you kindly to self-check before getting a review. Remove checks that are not relevant.
4+
-->
5+
6+
## Change Summary
7+
8+
<!-- Please give a short summary of the changes. -->
9+
10+
## Related issue number
11+
12+
<!-- Are there any issues opened that will be resolved by merging this change? -->
13+
<!--
14+
Please note any issues this fixes using [closing keywords]( https://help.github.com/articles/closing-issues-using-keywords/ ):
15+
-->
16+
17+
## Checklist
18+
19+
- [ ] Unit tests for the changes exist
20+
- [ ] Tests pass on CI
21+
- [ ] Documentation reflects the changes where applicable
22+
23+
<!--
24+
Please add any other relevant info below:
25+
-->

Diff for: .github/dependabot.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
version: 2
22
updates:
3-
- package-ecosystem: pip
4-
directory: '/'
5-
schedule:
6-
interval: 'weekly'
3+
# - package-ecosystem: pip
4+
# directory: '/'
5+
# schedule:
6+
# interval: 'weekly'
77
- package-ecosystem: 'github-actions'
88
directory: '/'
99
schedule:

Diff for: .github/workflows/ci.yaml

-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
name: CI
22
on:
33
push:
4-
branches:
5-
- '*'
64
pull_request:
7-
branches:
8-
- '*'
95
schedule:
106
- cron: '0 0 * * *' # Daily “At 00:00”
117
workflow_dispatch: # allows you to trigger manually

Diff for: .github/workflows/linting.yaml

-15
This file was deleted.

Diff for: .pre-commit-config.yaml

+1-15
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
- repo: https://github.com/psf/black
1313
rev: 21.12b0
1414
hooks:
15-
- id: black
15+
- id: black-jupyter
1616

1717
- repo: https://github.com/keewis/blackdoc
1818
rev: v0.3.4
@@ -24,10 +24,6 @@ repos:
2424
hooks:
2525
- id: flake8
2626

27-
- repo: https://github.com/asottile/seed-isort-config
28-
rev: v2.2.0
29-
hooks:
30-
- id: seed-isort-config
3127
- repo: https://github.com/PyCQA/isort
3228
rev: 5.10.1
3329
hooks:
@@ -37,13 +33,3 @@ repos:
3733
rev: v2.5.1
3834
hooks:
3935
- id: prettier
40-
41-
- repo: https://github.com/nbQA-dev/nbQA
42-
rev: 1.2.2
43-
hooks:
44-
- id: nbqa-black
45-
additional_dependencies: [black==20.8b1]
46-
- id: nbqa-pyupgrade
47-
additional_dependencies: [pyupgrade==2.7.3]
48-
- id: nbqa-isort
49-
additional_dependencies: [isort==5.6.4]

Diff for: README.md

+5-79
Original file line numberDiff line numberDiff line change
@@ -2,91 +2,17 @@
22

33
- [xpersist](#xpersist)
44
- [Badges](#badges)
5-
- [Overview](#overview)
6-
- [Examples](#examples)
7-
- [Applied to function](#applied-to-function)
8-
- [Used as a decorator](#used-as-a-decorator)
95

106
## Badges
117

12-
| CI | [![GitHub Workflow Status][github-ci-badge]][github-ci-link] [![GitHub Workflow Status][github-lint-badge]][github-lint-link] [![Code Coverage Status][codecov-badge]][codecov-link] |
13-
| :---------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
14-
| **Docs** | [![Documentation Status][rtd-badge]][rtd-link] |
15-
| **Package** | [![Conda][conda-badge]][conda-link] [![PyPI][pypi-badge]][pypi-link] |
16-
| **License** | [![License][license-badge]][repo-link] |
17-
18-
## Overview
19-
20-
Simple utility for wrapping functions that generate an `xarray.Dataset` and cache the result to file. If the cache file exists, don't recompute, but read back in from file.
21-
22-
Attempt to detect changes in the function and arguments used to generate the dataset,
23-
to ensure that the cache file is correct (i.e., it was produced by the same function
24-
called with the same arguments).
25-
26-
On the first call, however, assume the cache file is correct.
27-
28-
## Examples
29-
30-
### Applied to function
31-
32-
```python
33-
import xarray as xr
34-
import xpersist as xp
35-
import numpy as np
36-
37-
In [1]: def func(scaleby):
38-
...: return xr.Dataset({'x': xr.DataArray(np.ones((50,))*scaleby)})
39-
40-
In [2]: func(10)
41-
Out[2]:
42-
<xarray.Dataset>
43-
Dimensions: (dim_0: 50)
44-
Dimensions without coordinates: dim_0
45-
Data variables:
46-
x (dim_0) float64 10.0 10.0 10.0 10.0 10.0 ... 10.0 10.0 10.0 10.0
47-
48-
In [3]: ds = xp.persist_ds(func, name='func-output')(10)
49-
making xpersist_cache
50-
writing cache file: xpersist_cache/func-output.nc
51-
52-
In [4]: ds
53-
Out[4]:
54-
<xarray.Dataset>
55-
Dimensions: (dim_0: 50)
56-
Dimensions without coordinates: dim_0
57-
Data variables:
58-
x (dim_0) float64 10.0 10.0 10.0 10.0 10.0 ... 10.0 10.0 10.0 10.0
59-
60-
In [5]: ds = xp.persist_ds(func, name='func-output')(1000)
61-
name mismatch, removing: xpersist_cache/func-output.nc
62-
writing cache file: xpersist_cache/func-output.nc
63-
64-
In [6]: ds = xp.persist_ds(func, name='func-output')(1000)
65-
reading cached file: xpersist_cache/func-output.nc
66-
```
67-
68-
### Used as a decorator
69-
70-
```python
71-
import xarray as xr
72-
import xpersist as xp
73-
import numpy as np
74-
75-
In [1]: @xp.persist_ds(name='func-output')
76-
...: def func(scaleby):
77-
...: return xr.Dataset({'x': xr.DataArray(np.ones((50,))*scaleby)})
78-
79-
In [2]: ds = func(10)
80-
writing cache file: xpersist_cache/func-output.nc
81-
82-
In [3]: ds = func(10)
83-
reading cached file: xpersist_cache/func-output.nc
84-
```
8+
| CI | [![GitHub Workflow Status][github-ci-badge]][github-ci-link] [![Code Coverage Status][codecov-badge]][codecov-link] |
9+
| :---------- | :-----------------------------------------------------------------------------------------------------------------: |
10+
| **Docs** | [![Documentation Status][rtd-badge]][rtd-link] |
11+
| **Package** | [![Conda][conda-badge]][conda-link] [![PyPI][pypi-badge]][pypi-link] |
12+
| **License** | [![License][license-badge]][repo-link] |
8513

8614
[github-ci-badge]: https://img.shields.io/github/workflow/status/NCAR/xpersist/CI?label=CI&logo=github&style=for-the-badge
87-
[github-lint-badge]: https://img.shields.io/github/workflow/status/NCAR/xpersist/linting?label=linting&logo=github&style=for-the-badge
8815
[github-ci-link]: https://github.com/NCAR/xpersist/actions?query=workflow%3ACI
89-
[github-lint-link]: https://github.com/NCAR/xpersist/actions?query=workflow%3Alinting
9016
[codecov-badge]: https://img.shields.io/codecov/c/github/NCAR/xpersist.svg?logo=codecov&style=for-the-badge
9117
[codecov-link]: https://codecov.io/gh/NCAR/xpersist
9218
[rtd-badge]: https://img.shields.io/readthedocs/xpersist/latest.svg?style=for-the-badge

Diff for: pyproject.toml

+5-6
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ line-length = 100
33
target-version = ['py38']
44
skip-string-normalization = true
55

6-
[tool.nbqa.mutate]
7-
isort = 1
8-
black = 1
9-
pyupgrade = 1
6+
[tool.check-manifest]
7+
ignore = ["docs/*", "tests/*", "ci/*"]
108

11-
[tool.nbqa.addopts]
12-
pyupgrade = ["--py36-plus"]
9+
10+
[build-system]
11+
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"]

Diff for: setup.py

+14-16
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,32 @@
33

44
"""The setup script."""
55

6-
from os.path import exists
76

87
from setuptools import setup
98

10-
if exists('README.md'):
11-
with open('README.md') as f:
12-
long_description = f.read()
13-
else:
14-
long_description = ''
9+
with open('README.md') as f:
10+
long_description = f.read()
1511

1612
with open('requirements.txt') as f:
17-
install_requires = f.read().strip().split('\n')
13+
requirements = f.read().strip().split('\n')
1814

19-
test_requirements = ['pytest']
2015

2116
setup(
22-
maintainer='xdev',
17+
maintainer='Xdev',
2318
maintainer_email='[email protected]',
24-
description='xpersist',
25-
install_requires=install_requires,
26-
license='Apache License 2.0',
19+
description='xpersist provides custom caching utility functions in Python',
20+
install_requires=requirements,
21+
license='Apache Software License 2.0',
22+
long_description_content_type='text/markdown',
2723
long_description=long_description,
2824
name='xpersist',
2925
packages=['xpersist'],
30-
test_suite='tests',
31-
tests_require=test_requirements,
32-
url='https://github.com/matt-long/xpersist',
26+
url='https://github.com/NCAR/xpersist',
27+
project_urls={
28+
'Documentation': 'https://github.com/NCAR/xpersist',
29+
'Source': 'https://github.com/NCAR/xpersist',
30+
'Tracker': 'https://github.com/NCAR/xpersist/issues',
31+
},
3332
use_scm_version={'version_scheme': 'post-release', 'local_scheme': 'dirty-tag'},
34-
setup_requires=['setuptools_scm', 'setuptools>=30.3.0'],
3533
zip_safe=False,
3634
)

0 commit comments

Comments
 (0)