Skip to content

Commit bc1bb8a

Browse files
authored
Update packaging practices (#83)
* Update packaging practices * lint * Updates * upgrade to ruff for linting * Use extent for image data spacing calculation * Bump version * Fix memory sharing issues from pandas 3.0 copied Index
1 parent abd1111 commit bc1bb8a

30 files changed

Lines changed: 249 additions & 319 deletions

.flake8

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

.github/workflows/docker.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ jobs:
1515
runs-on: ubuntu-latest
1616
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || ( github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository )
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- name: Log into the Container registry
20-
uses: docker/login-action@v2
20+
uses: docker/login-action@v3
2121
with:
2222
registry: ${{ env.REGISTRY }}
2323
username: token
2424
password: ${{ secrets.GITHUB_TOKEN }}
2525
- name: Extract metadata for the Docker image
2626
id: meta
27-
uses: docker/metadata-action@v4
27+
uses: docker/metadata-action@v5
2828
with:
2929
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
3030
- name: Build and push the Docker image
31-
uses: docker/build-push-action@v3
31+
uses: docker/build-push-action@v6
3232
with:
3333
context: .
3434
file: Dockerfile

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ jobs:
66
publish:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v3
9+
- uses: actions/checkout@v4
1010
- name: Set up Python
11-
uses: actions/setup-python@v3
11+
uses: actions/setup-python@v5
1212
with:
13-
python-version: "3.9"
13+
python-version: "3.12"
1414
- name: Install dependencies
1515
run: |
1616
python -m pip install --upgrade pip
17-
pip install setuptools wheel twine
17+
pip install build twine
1818
- name: Build and Publish to PyPI
1919
env:
2020
TWINE_USERNAME: __token__
2121
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
2222
run: |
23-
python setup.py sdist bdist_wheel
23+
python -m build
2424
twine upload --skip-existing dist/*

.github/workflows/test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
python-version: [3.9, "3.10", "3.11"]
17+
python-version: ["3.10", "3.11", "3.12", "3.13"]
1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
2020
- name: Set up Python
21-
uses: actions/setup-python@v3
21+
uses: actions/setup-python@v5
2222
with:
2323
python-version: ${{ matrix.python-version }}
2424
- name: Install dependencies
@@ -36,11 +36,11 @@ jobs:
3636
# run: |
3737
# make doctest
3838
- name: Stash coverage
39-
uses: actions/upload-artifact@v3
39+
uses: actions/upload-artifact@v4
4040
with:
41-
name: coverage.xml
41+
name: coverage-${{ matrix.python-version }}.xml
4242
path: coverage.xml
43-
- uses: codecov/codecov-action@v3
43+
- uses: codecov/codecov-action@v5
4444
with:
4545
token: ${{ secrets.CODECOV_TOKEN }}
4646
files: coverage.xml

.pre-commit-config.yaml

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,22 @@ ci:
55
autoupdate_schedule: monthly
66

77
repos:
8-
- repo: https://github.com/psf/black
9-
rev: 24.10.0
8+
- repo: https://github.com/astral-sh/ruff-pre-commit
9+
rev: v0.11.2
1010
hooks:
11-
- id: black
11+
- id: ruff
12+
args: [--fix]
13+
- id: ruff-format
1214

1315
- repo: https://github.com/keewis/blackdoc
14-
rev: v0.3.9
16+
rev: v0.4.6
1517
hooks:
1618
- id: blackdoc
1719
files: '\.py$'
1820
exclude: pyvista/plotting/charts.py
1921

20-
- repo: https://github.com/pycqa/isort
21-
rev: 5.13.2
22-
hooks:
23-
- id: isort
24-
25-
- repo: https://github.com/PyCQA/flake8
26-
rev: 7.1.1
27-
hooks:
28-
- id: flake8
29-
additional_dependencies: [
30-
"flake8-black==0.3.6",
31-
"flake8-isort==6.0.0",
32-
# "flake8-quotes==3.3.2",
33-
]
34-
3522
- repo: https://github.com/codespell-project/codespell
36-
rev: v2.3.0
23+
rev: v2.4.1
3724
hooks:
3825
- id: codespell
3926
args: [
@@ -53,7 +40,7 @@ repos:
5340
exclude: ^pyvista/ext/
5441

5542
- repo: https://github.com/DanielNoord/pydocstringformatter
56-
rev: v0.7.3
43+
rev: v0.7.5
5744
hooks:
5845
- id: pydocstringformatter
5946
args: [
@@ -62,14 +49,8 @@ repos:
6249
"--no-capitalize-first-letter",
6350
]
6451

65-
- repo: https://github.com/asottile/pyupgrade
66-
rev: v3.19.1
67-
hooks:
68-
- id: pyupgrade
69-
args: [--py38-plus, --keep-runtime-typing]
70-
7152
- repo: https://github.com/pre-commit/pre-commit-hooks
72-
rev: v5.0.0
53+
rev: v6.0.0
7354
hooks:
7455
- id: check-merge-conflict
7556
- id: debug-statements

MANIFEST.in

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

examples/cartographic.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
"source": [
2525
"import geovista as gv\n",
2626
"import pyvista as pv\n",
27-
"from pvxarray.vtk_source import PyVistaXarraySource\n",
28-
"import xarray as xr"
27+
"import xarray as xr\n",
28+
"\n",
29+
"from pvxarray.vtk_source import PyVistaXarraySource"
2930
]
3031
},
3132
{

examples/data-cube.ipynb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@
99
},
1010
"outputs": [],
1111
"source": [
12-
"from siphon.catalog import TDSCatalog\n",
13-
"import xarray as xr\n",
1412
"import pyvista as pv\n",
15-
"import pvxarray\n",
16-
"import numpy as np\n",
17-
"import ipywidgets as widgets\n",
18-
"import matplotlib.pyplot as plt\n",
13+
"from siphon.catalog import TDSCatalog\n",
1914
"\n",
2015
"pv.set_plot_theme(\"document\")\n",
2116
"pv.set_jupyter_backend(\"server\") # critical for large data"
@@ -91,7 +86,7 @@
9186
},
9287
"outputs": [],
9388
"source": [
94-
"dt = da[dict(time=0)]"
89+
"dt = da[{\"time\": 0}]"
9590
]
9691
},
9792
{

examples/introduction.ipynb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
"metadata": {},
1616
"outputs": [],
1717
"source": [
18-
"import pvxarray\n",
19-
"import xarray as xr\n",
2018
"import numpy as np\n",
21-
"import pyvista as pv"
19+
"import pyvista as pv\n",
20+
"import xarray as xr"
2221
]
2322
},
2423
{
@@ -54,7 +53,7 @@
5453
"outputs": [],
5554
"source": [
5655
"ds = xr.tutorial.load_dataset(\"air_temperature\")\n",
57-
"da = ds.air[dict(time=0)] # Select DataArray for a timestep\n",
56+
"da = ds.air[{\"time\": 0}] # Select DataArray for a timestep\n",
5857
"\n",
5958
"# Plot in 3D\n",
6059
"da.pyvista.plot(x=\"lon\", y=\"lat\", cpos=\"xy\")"
@@ -129,7 +128,7 @@
129128
"da = da.rio.reproject(\"EPSG:3857\")\n",
130129
"\n",
131130
"# Grab the mesh object for use with PyVista\n",
132-
"mesh = da[dict(band=0)].pyvista.mesh(x=\"x\", y=\"y\")\n",
131+
"mesh = da[{\"band\": 0}].pyvista.mesh(x=\"x\", y=\"y\")\n",
133132
"\n",
134133
"# plot in 3D\n",
135134
"mesh.warp_by_scalar().plot(jupyter_backend=\"server\")"

examples/level_of_detail.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,20 @@ def update_time_index(time_index=0, **kwargs):
7272
style="max-width: 150px",
7373
)
7474

75-
with layout.content:
76-
with vuetify.VContainer(
75+
with (
76+
layout.content,
77+
vuetify.VContainer(
7778
fluid=True,
7879
classes="pa-0 fill-height",
79-
):
80-
view = vtk.VtkRemoteView(
81-
plotter.ren_win,
82-
ref="view",
83-
interactive_ratio=1,
84-
)
85-
ctrl.view_update = view.update
86-
ctrl.view_reset_camera = view.reset_camera
80+
),
81+
):
82+
view = vtk.VtkRemoteView(
83+
plotter.ren_win,
84+
ref="view",
85+
interactive_ratio=1,
86+
)
87+
ctrl.view_update = view.update
88+
ctrl.view_reset_camera = view.reset_camera
8789

8890
# Uncomment following line to hide footer
8991
# layout.footer.hide()

0 commit comments

Comments
 (0)