Skip to content

Commit 27e812e

Browse files
authored
Merge pull request #416 from raybellwaves/use-pyproject
Use pyproject
2 parents aa293ff + d4422cf commit 27e812e

39 files changed

Lines changed: 918 additions & 1154 deletions

.github/workflows/python-publish.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Upload Python Package
33
on:
44
push:
55
tags:
6-
- 'v*' # Push events to matching v*, i.e. v0.0.x,
6+
- "v*" # Push events to matching v*, i.e. v0.0.x,
77

88
jobs:
99
release:
@@ -28,19 +28,19 @@ jobs:
2828
needs: release
2929
runs-on: ubuntu-latest
3030
steps:
31-
- uses: actions/checkout@v1
32-
- name: Set up Python
33-
uses: actions/setup-python@v1
34-
with:
35-
python-version: '3.x'
36-
- name: Install dependencies
37-
run: |
38-
python -m pip install --upgrade pip
39-
pip install setuptools wheel twine
40-
- name: Build and publish
41-
env:
42-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
43-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
44-
run: |
45-
python setup.py sdist bdist_wheel
46-
twine upload dist/*
31+
- uses: actions/checkout@v3
32+
- name: Set up Python
33+
uses: actions/setup-python@v3
34+
with:
35+
python-version: "3.x"
36+
- name: Install dependencies
37+
run: |
38+
python -m pip install --upgrade pip
39+
pip install build
40+
- name: Build and publish
41+
run: python -m build
42+
- name: Publish package
43+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
44+
with:
45+
user: __token__
46+
password: ${{ secrets.PYPI_API_TOKEN }}

.pep8speaks.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,84 +2,83 @@ default_language_version:
22
python: python3
33

44
ci:
5-
autofix_commit_msg: |
6-
[pre-commit.ci] auto fixes from pre-commit.com hooks
5+
autofix_commit_msg: |
6+
[pre-commit.ci] auto fixes from pre-commit.com hooks
77
8-
for more information, see https://pre-commit.ci
9-
autofix_prs: true
10-
autoupdate_branch: ''
11-
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
12-
autoupdate_schedule: quarterly
13-
skip: []
14-
submodules: false
8+
for more information, see https://pre-commit.ci
9+
autofix_prs: true
10+
autoupdate_branch: ""
11+
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
12+
autoupdate_schedule: quarterly
13+
skip: []
14+
submodules: false
1515

1616
repos:
17-
- repo: https://github.com/pre-commit/pre-commit-hooks
18-
rev: v4.4.0
19-
hooks:
17+
- repo: https://github.com/pre-commit/pre-commit-hooks
18+
rev: v4.4.0
19+
hooks:
2020
- id: check-added-large-files
2121
- id: check-docstring-first
2222
- id: check-json
23-
exclude: 'asv.conf.json'
23+
exclude: "asv.conf.json"
2424
- id: check-merge-conflict
2525
- id: check-toml
2626
- id: check-yaml
27-
args: [ '--allow-multiple-documents' ]
27+
args: ["--allow-multiple-documents"]
2828
- id: debug-statements
2929
- id: end-of-file-fixer
3030
- id: no-commit-to-branch
3131
- id: pretty-format-json
32-
args: [ '--autofix', '--no-ensure-ascii', '--no-sort-keys' ]
33-
exclude: '.ipynb|asv.conf.json'
32+
args: ["--autofix", "--no-ensure-ascii", "--no-sort-keys"]
33+
exclude: ".ipynb|asv.conf.json"
3434
- id: trailing-whitespace
3535

36-
- repo: https://github.com/psf/black-pre-commit-mirror
37-
rev: 23.10.1
38-
hooks:
39-
- id: black
36+
- repo: https://github.com/charliermarsh/ruff-pre-commit
37+
rev: "v0.1.14"
38+
hooks:
39+
- id: ruff
40+
args: ["--select", "E,F,I001"]
41+
types_or: [python, pyi, jupyter]
42+
- id: ruff-format
43+
types_or: [python, pyi, jupyter]
4044

41-
- repo: https://github.com/PyCQA/flake8
42-
rev: 6.1.0
43-
hooks:
44-
- id: flake8
45-
46-
- repo: https://github.com/PyCQA/isort
47-
rev: 5.12.0
48-
hooks:
49-
- id: isort
50-
51-
- repo: https://github.com/keewis/blackdoc
52-
rev: v0.3.8
53-
hooks:
45+
- repo: https://github.com/keewis/blackdoc
46+
rev: v0.3.8
47+
hooks:
5448
- id: blackdoc
55-
additional_dependencies: [ 'black==23.10.1' ]
49+
additional_dependencies: ["black==23.10.1"]
5650

57-
- repo: https://github.com/PyCQA/doc8
58-
rev: v1.0.0
59-
hooks:
51+
- repo: https://github.com/PyCQA/doc8
52+
rev: v1.0.0
53+
hooks:
6054
- id: doc8
61-
args: ["--max-line-length", "100",
62-
"--allow-long-titles",
63-
"--ignore-path", "docs/source/api/"]
55+
args:
56+
[
57+
"--max-line-length",
58+
"100",
59+
"--allow-long-titles",
60+
"--ignore-path",
61+
"docs/source/api/",
62+
]
6463

65-
- repo: https://github.com/pre-commit/mirrors-mypy
66-
rev: v0.982
67-
hooks:
64+
- repo: https://github.com/pre-commit/mirrors-mypy
65+
rev: "v1.8.0"
66+
hooks:
6867
- id: mypy
69-
exclude: 'asv_bench'
68+
exclude: "asv_bench"
7069
additional_dependencies: [
7170
# Type stubs
7271
types-python-dateutil,
7372
types-pkg_resources,
7473
types-PyYAML,
7574
types-pytz,
76-
typing-extensions==3.10.0.0,
75+
typing-extensions,
7776
# Dependencies that are typed
7877
numpy,
7978
]
8079

81-
- repo: https://github.com/python-jsonschema/check-jsonschema
82-
rev: 0.27.0
83-
hooks:
80+
- repo: https://github.com/python-jsonschema/check-jsonschema
81+
rev: 0.27.0
82+
hooks:
8483
- id: check-github-workflows
8584
- id: check-readthedocs

HOWTOCONTRIBUTE.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Preparing Pull Requests
125125

126126
#. Install dependencies into a new conda environment::
127127

128-
$ conda env update -f ci/dev.yml
128+
$ mamba env update -f ci/dev.yml
129129
$ conda activate xskillscore-dev
130130

131131
#. Make an editable install of xskillscore by running::
@@ -154,6 +154,12 @@ Preparing Pull Requests
154154

155155
$ pytest --doctest-modules xskillscore --ignore xskillscore/tests
156156

157+
You can also test notebooks by doing::
158+
159+
$ cd docs
160+
$ nbstripout source/*.ipynb
161+
$ make -j4 html
162+
157163
Please stick to `xarray <http://xarray.pydata.org/en/stable/contributing.html>`_'s testing recommendations.
158164

159165
#. Running the performance test suite

HOWTORELEASE.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Release Procedure
88
* Update ``CHANGELOG.rst``
99
* Make sure all new changes, features are reflected in the documentation.
1010

11+
* Update ``pyproject.toml`` and `version` in `xskillscore/__init__`
12+
1113
#. Open a new pull request for this branch targeting `main`
1214

1315
#. After all tests pass and the PR has been approved, merge the PR into ``main``

asv_bench/benchmarks/deterministic.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Write the benchmarking functions here.
22
# See "Writing benchmarks" in the asv docs for more information.
33

4-
import os
5-
6-
import numpy as np
7-
import xarray as xr
84

95
from xskillscore import mae, mse, pearson_r, pearson_r_p_value, rmse
106

asv_bench/benchmarks/probabilistic.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# See "Writing benchmarks" in the asv docs for more information.
33

44

5-
import numpy as np
6-
import xarray as xr
75
from scipy.stats import norm
86

97
from xskillscore import (

asv_bench/benchmarks/xr_vs_xs.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,23 @@
22
# See "Writing benchmarks" in the asv docs for more information.
33

44

5-
import os
6-
import shutil
7-
85
import bottleneck as bn
96
import numpy as np
10-
import pandas as pd
117
import xarray as xr
128

139
from xskillscore import (
1410
mae as xs_mae,
11+
)
12+
from xskillscore import (
1513
mse as xs_mse,
14+
)
15+
from xskillscore import (
1616
pearson_r as xs_pearson_r,
17+
)
18+
from xskillscore import (
1719
rmse as xs_rmse,
20+
)
21+
from xskillscore import (
1822
spearman_r as xs_spearman_r,
1923
)
2024

ci/dev.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,36 @@ channels:
44
dependencies:
55
- python >= 3.9,<3.12
66
# Documentation
7+
- matplotlib-base
78
- nbsphinx
89
- nbstripout
910
- sphinx
1011
- sphinx_rtd_theme
1112
- sphinx-autosummary-accessors
12-
- matplotlib-base
13+
- sphinxcontrib-napoleon
1314
# IDE
1415
- jupyterlab
1516
# Numerics
1617
- bottleneck
17-
- statsmodels
1818
- cftime
1919
- dask-core
2020
- numba>=0.52
2121
- numpy
2222
- properscoring
2323
- scikit-learn
2424
- scipy
25+
- statsmodels
2526
- xarray>=0.16.1
2627
- xhistogram>=0.3.0
2728
# Package Management
2829
- asv
29-
- black
30+
- build
3031
- coveralls
3132
- doc8
32-
- isort
33-
- flake8
3433
- pre-commit
3534
- pytest
3635
- pytest-cov
37-
- pytest-lazy-fixture
36+
- pytest-xdist
3837
- pytest-sugar
3938
- mypy
39+
- ruff

ci/doc.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@ channels:
44
dependencies:
55
- python >=3.9
66
- bottleneck
7+
- cftime
8+
- dask-core
79
- doc8
810
- ipykernel
911
- ipython
12+
- matplotlib-base
1013
- nbsphinx
1114
- numpy
1215
- pip
1316
- properscoring
14-
- statsmodels
15-
- matplotlib-base
17+
- scikit-learn
1618
- scipy
1719
- sphinx!=4.4.0
1820
- sphinx_rtd_theme
1921
- sphinx-autosummary-accessors
2022
- sphinx-copybutton
23+
- statsmodels
2124
- xarray>=0.16.1
2225
- xhistogram>=0.3.0
23-
- scikit-learn
24-
- cftime
25-
- dask-core
2626
- pip:
2727
- -e ..

0 commit comments

Comments
 (0)