Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
CIBW_BUILD_FRONTEND: build
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_TEST_SKIP: "*_arm64"
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_REQUIRES: pytest pandas>=2
CIBW_TEST_COMMAND: >
python -c "import gsw; print(f'gsw v{gsw.__version__}')" &&
python -m pytest --pyargs gsw
Expand Down
26 changes: 24 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-ast
- id: debug-statements
- id: check-added-large-files

- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
rev: v2.2.4
hooks:
- id: codespell
exclude: >
Expand All @@ -17,3 +17,25 @@ repos:
)$
args:
- --ignore-words-list=nin,preformed,wih,

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 0.9.2
hooks:
- id: pyproject-fmt


- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.260
hooks:
- id: ruff

ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
autofix_prs: false
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: monthly
skip: []
submodules: false
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ include README.md
graft gsw
recursive-include src *.c
recursive-include src *.h
include src/c_gsw/LICENSE

prune docs
prune .github
prune tools
prune notebooks
prune *.egg-info
Expand Down
13 changes: 13 additions & 0 deletions gsw/tests/test_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
import numpy as np
from numpy.testing import assert_allclose

import pandas as pd


import gsw
from gsw._utilities import Bunch
from check_functions import parse_check_functions
Expand Down Expand Up @@ -141,3 +144,13 @@ def test_xarray_with_coords():
chunked = gsw.z_from_p(p,lat_chunk)
assert_allclose(xarray, expected)
assert_allclose(chunked, expected)

def test_pandas_20():
df = pd.DataFrame(
{
"pressure": [0, 10, 20],
"latitude": [70, 70, 70],
}
)
depth = -1 * gsw.z_from_p(df["pressure"], df["latitude"])
assert isinstance(depth, pd.core.series.Series)
98 changes: 97 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,99 @@
[build-system]
requires = ["pip>9.0.1", "setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4", "oldest-supported-numpy", "build"]
build-backend = "setuptools.build_meta"
requires = [
"build",
"oldest-supported-numpy",
"pip>9.0.1",
"setuptools>=42",
"setuptools_scm[toml]>=3.4",
"wheel",
]

[project]
name = "gsw"
description = "Gibbs Seawater Oceanographic Package of TEOS-10"
license = {text = "BSD-3-Clause"}
authors = [
{name = "Eric Firing, Filipe Fernandes", email = "efiring@hawaii.edu"},
]
requires-python = ">=3.8"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Operating System :: OS Independent",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering",
]
dynamic = [
"readme",
"version",
]
dependencies = [
"numpy>=1.21",
]
[project.urls]
documentation = "https://teos-10.github.io/GSW-Python/"
homepage = "https://www.teos-10.org/"
repository = "https://github.com/TEOS-10/GSW-python"

[tool.setuptools]
license-files = ["LICENSE.txt"]
zip-safe = false
include-package-data = true
packages = ["gsw", "gsw.tests"]


[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
readme = {file = "README.md", content-type = "text/markdown"}

[tool.setuptools_scm]
write_to = "gsw/_version.py"
write_to_template = "__version__ = '{version}'"
tag_regex = "^(?P<prefix>v)?(?P<version>[^\\+]+)(?P<suffix>.*)?$"

[tool.check-manifest]
ignore = [
"*.yml",
".coveragerc",
"docs",
"docs/*",
"*.enc",
"tools",
"tools/*",
"gsw/_version.py",
]

[tool.ruff]
select = [
"A", # flake8-builtins
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"F", # flakes
"I", # import sorting
# "T20", # flake8-print
"UP", # upgrade
]
target-version = "py38"
line-length = 105

ignore = [
"F401",
"E501",
"E713",
]

exclude = [
"tools",
]

[tool.ruff.per-file-ignores]
"docs/source/conf.py" = [
"A001",
]
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ sphinx
sphinx_rtd_theme
twine
xarray
pandas>=2
dask
47 changes: 0 additions & 47 deletions setup.cfg

This file was deleted.

8 changes: 0 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@ def build_extensions(self):
]

config = {
# The package metadata is specified in setup.cfg but GitHub's downstream dependency graph
# does not work unless we put the name this here too.
"name": "gsw",
"use_scm_version": {
"write_to": "gsw/_version.py",
"write_to_template": '__version__ = "{version}"',
"tag_regex": r"^(?P<prefix>v)?(?P<version>[^\+]+)(?P<suffix>.*)?$",
},
"ext_modules": [Extension("gsw._gsw_ufuncs", ufunc_src_list)],
"include_dirs": [os.path.join(rootpath, "src", "c_gsw")],
"cmdclass": {"build_ext": build_ext},
Expand Down