Skip to content

Commit

Permalink
Merge branch 'main' into named-array
Browse files Browse the repository at this point in the history
  • Loading branch information
andersy005 authored Sep 15, 2023
2 parents 4fafb02 + e00e31b commit c07fa0d
Show file tree
Hide file tree
Showing 25 changed files with 320 additions and 248 deletions.
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def setup(self, dtype, subset):
[
list("abcdefhijk"),
list("abcdefhijk"),
pd.date_range(start="2000-01-01", periods=1000, freq="B"),
pd.date_range(start="2000-01-01", periods=1000, freq="D"),
]
)
series = pd.Series(data, index)
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies:
- numba
- numpy>=1.21
- packaging>=21.3
- pandas>=1.4
- pandas>=1.4,!=2.1.0
- pooch
- pip
- pre-commit
Expand Down
12 changes: 6 additions & 6 deletions doc/getting-started-guide/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ We also maintain other dependency sets for different subsets of functionality::
The above commands should install most of the `optional dependencies`_. However,
some packages which are either not listed on PyPI or require extra
installation steps are excluded. To know which dependencies would be
installed, take a look at the ``[options.extras_require]`` section in
``setup.cfg``:
installed, take a look at the ``[project.optional-dependencies]`` section in
``pyproject.toml``:

.. literalinclude:: ../../setup.cfg
:language: ini
:start-at: [options.extras_require]
:end-before: [options.package_data]
.. literalinclude:: ../../pyproject.toml
:language: toml
:start-at: [project.optional-dependencies]
:end-before: [build-system]

Development versions
--------------------
Expand Down
11 changes: 11 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ New Features
different collections of coordinates prior to assign them to a Dataset or
DataArray (:pull:`8102`) at once.
By `Benoît Bovy <https://github.com/benbovy>`_.
- Provide `preferred_chunks` for data read from netcdf files (:issue:`1440`, :pull:`7948`).
By `Martin Raspaud <https://github.com/mraspaud>`_.
- Improved static typing of reduction methods (:pull:`6746`).
By `Richard Kleijn <https://github.com/rhkleijn>`_.

Breaking changes
~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -59,6 +63,13 @@ Bug fixes
names were not updated properly internally (:issue:`7405`, :issue:`7588`,
:pull:`8104`).
By `Benoît Bovy <https://github.com/benbovy>`_.
- Fix bug where :py:class:`DataArray` instances on the right-hand side
of :py:meth:`DataArray.__setitem__` lose dimension names.
(:issue:`7030`, :pull:`8067`) By `Darsh Ranjan <https://github.com/dranjan>`_.
- Return ``float64`` in presence of ``NaT`` in :py:class:`~core.accessor_dt.DatetimeAccessor` and
special case ``NaT`` handling in :py:meth:`~core.accessor_dt.DatetimeAccessor.isocalendar()`
(:issue:`7928`, :pull:`8084`).
By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_.

Documentation
~~~~~~~~~~~~~
Expand Down
96 changes: 78 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,61 @@
[project]
authors = [
{name = "xarray Developers", email = "[email protected]"},
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering",
]
description = "N-D labeled arrays and datasets in Python"
dynamic = ["version"]
license = {text = "Apache-2.0"}
name = "xarray"
readme = "README.md"
requires-python = ">=3.9"

dependencies = [
"numpy>=1.21",
"packaging>=21.3",
"pandas>=1.4",
]

[project.urls]
Documentation = "https://docs.xarray.dev"
SciPy2015-talk = "https://www.youtube.com/watch?v=X0pAhJgySxk"
homepage = "https://xarray.dev/"
issue-tracker = "https://github.com/pydata/xarray/issues"
source-code = "https://github.com/pydata/xarray"

[project.entry-points."xarray.chunkmanagers"]
dask = "xarray.core.daskmanager:DaskManager"

[project.optional-dependencies]
accel = ["scipy", "bottleneck", "numbagg", "flox"]
complete = ["xarray[accel,io,parallel,viz]"]
io = ["netCDF4", "h5netcdf", "scipy", 'pydap; python_version<"3.10"', "zarr", "fsspec", "cftime", "pooch"]
parallel = ["dask[complete]"]
viz = ["matplotlib", "seaborn", "nc-time-axis"]

[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=42",
"setuptools-scm>=7",
]

[tool.setuptools]
packages = ["xarray"]

[tool.setuptools_scm]
fallback_version = "999"
fallback_version = "9999"

[tool.coverage.run]
omit = [
Expand Down Expand Up @@ -64,40 +113,51 @@ module = [
"sparse.*",
"toolz.*",
"zarr.*",
"numpy.exceptions.*", # remove once support for `numpy<2.0` has been dropped
"numpy.exceptions.*", # remove once support for `numpy<2.0` has been dropped
]

[[tool.mypy.overrides]]
ignore_errors = true
module = []

[tool.ruff]
target-version = "py39"
builtins = ["ellipsis"]
exclude = [
".eggs",
"doc",
"_typed_ops.pyi",
".eggs",
"doc",
"_typed_ops.pyi",
]
target-version = "py39"
# E402: module level import not at top of file
# E501: line too long - let black worry about that
# E731: do not assign a lambda expression, use a def
ignore = [
"E402",
"E501",
"E731",
"E402",
"E501",
"E731",
]
select = [
# Pyflakes
"F",
# Pycodestyle
"E",
"W",
# isort
"I",
# Pyupgrade
"UP",
"F", # Pyflakes
"E", # Pycodestyle
"W",
"I", # isort
"UP", # Pyupgrade
]

[tool.ruff.isort]
known-first-party = ["xarray"]

[tool.pytest.ini-options]
filterwarnings = [
"ignore:Using a non-tuple sequence for multidimensional indexing is deprecated:FutureWarning",
]
markers = [
"flaky: flaky tests",
"network: tests requiring a network connection",
"slow: slow tests",
]
python_files = "test_*.py"
testpaths = ["xarray/tests", "properties"]

[tool.aliases]
test = "pytest"
154 changes: 0 additions & 154 deletions setup.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
from setuptools import setup

setup(use_scm_version={"fallback_version": "999"})
setup(use_scm_version={"fallback_version": "9999"})
2 changes: 1 addition & 1 deletion xarray/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
except Exception:
# Local copy or not installed with setuptools.
# Disable minimum version checks on downstream libraries.
__version__ = "999"
__version__ = "9999"

# A hardcoded __all__ variable is necessary to appease
# `mypy --strict` running in projects that import xarray.
Expand Down
2 changes: 2 additions & 0 deletions xarray/backends/h5netcdf_.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ def open_store_variable(self, name, var):
"fletcher32": var.fletcher32,
"shuffle": var.shuffle,
}
if var.chunks:
encoding["preferred_chunks"] = dict(zip(var.dimensions, var.chunks))
# Convert h5py-style compression options to NetCDF4-Python
# style, if possible
if var.compression == "gzip":
Expand Down
1 change: 1 addition & 0 deletions xarray/backends/netCDF4_.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ def open_store_variable(self, name, var):
else:
encoding["contiguous"] = False
encoding["chunksizes"] = tuple(chunking)
encoding["preferred_chunks"] = dict(zip(var.dimensions, chunking))
# TODO: figure out how to round-trip "endian-ness" without raising
# warnings from netCDF4
# encoding['endian'] = var.endian()
Expand Down
Loading

0 comments on commit c07fa0d

Please sign in to comment.