Skip to content

Commit

Permalink
Merge branch 'main' into fix-group-auto-groups-str
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonHeybrock committed May 14, 2024
2 parents 32fe53a + 25d6577 commit 3ac6119
Show file tree
Hide file tree
Showing 93 changed files with 649 additions and 676 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
micromamba-version: 1.5.6-0
environment-file: env.yml
cache-environment: true
create-args: python=3.9
create-args: python=3.10

- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.13
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
fetch-depth: 0 # history required so cmake can determine version
- uses: actions/setup-python@v3
with:
python-version: '3.9'
python-version: '3.10'
- run: python -m pip install --upgrade pip
- run: python -m pip install -r requirements/ci.txt
- run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr_and_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v3
with:
python-version: '3.9'
python-version: '3.10'
- run: python -m pip install --upgrade pip
- run: python -m pip install -r requirements/ci.txt
- run: tox -e static
Expand All @@ -40,7 +40,7 @@ jobs:
- {os: ubuntu-22.04, cmake-preset: ci-linux}
- {os: macos-11, cmake-preset: ci-macos}
- {os: windows-2019, cmake-preset: ci-windows}
python-version: ["3.9"]
python-version: ["3.10"]

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-22.04]
build: [cp39, cp310]
build: [cp310]
uses: ./.github/workflows/wheel.yml
with:
os: ${{ matrix.os }}
Expand All @@ -32,7 +32,7 @@ jobs:
merge-multiple: true
- uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.10"
- run: python .github/workflows/rename-dev-wheels.py
- uses: ncipollo/release-action@v1
with:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v3
with:
python-version: '3.9'
python-version: '3.10'
- run: python -m pip install --upgrade pip
- run: python -m pip install -r requirements/ci.txt
- run: tox -e check-release
Expand All @@ -33,7 +33,7 @@ jobs:
- {os: macos-11, target: osx_64}
- {os: macos-11, target: osx_arm64}
- {os: windows-2019, target: win_64}
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11"]
uses: ./.github/workflows/conda.yml
with:
os: ${{ matrix.variant.os }}
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-11, windows-2019]
build: [cp39, cp310, cp311, cp312]
build: [cp310, cp311, cp312]
uses: ./.github/workflows/wheel.yml
with:
os: ${{ matrix.os }}
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
merge-multiple: true
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.9'
python-version: '3.10'
- run: conda install -c conda-forge --yes anaconda-client
- run: anaconda --token ${{ secrets.ANACONDATOKEN }} upload --user scipp --label main $(ls conda-package-*/*/*.tar.bz2)

Expand All @@ -121,7 +121,7 @@ jobs:
fetch-depth: 0 # history required so cmake can determine version
- uses: actions/setup-python@v3
with:
python-version: '3.9'
python-version: '3.10'
- run: python -m pip install --upgrade pip
- run: python -m pip install -r requirements/ci.txt
- name: Set outputs
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
matrix:
variant:
- {os: ubuntu-22.04, target: linux_64}
python-version: ["3.9", "3.11"]
python-version: ["3.10", "3.11"]
uses: ./.github/workflows/conda.yml
with:
os: ${{ matrix.variant.os }}
Expand All @@ -29,7 +29,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-22.04]
build: [cp39, cp312]
build: [cp310, cp312]
uses: ./.github/workflows/wheel.yml
with:
os: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
submodules: true
fetch-depth: 0 # history required so cmake can determine version

- uses: pypa/cibuildwheel@v2.17.0
- uses: pypa/cibuildwheel@v2.18.0
env:
CIBW_BUILD: ${{ inputs.build }}-*
MACOSX_DEPLOYMENT_TARGET: "10.15"
Expand Down
3 changes: 1 addition & 2 deletions docs/environments/developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ dependencies:
- cmake>=3.21
- conan==1.59.0
- conda-build
- graphlib-backport # for python < 3.9
- h5py
- hypothesis
- ipympl
Expand All @@ -26,7 +25,7 @@ dependencies:
- pooch
- pre-commit
- pytest
- python=3.8
- python=3.10
- python-graphviz
- pythreejs
- pyyaml
Expand Down
14 changes: 7 additions & 7 deletions docs/getting-started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Installation
============

Scipp requires Python 3.8 or above.
Scipp requires Python 3.10 or above.

Conda
-----
Expand Down Expand Up @@ -64,7 +64,7 @@ To add Scipp to an existing conda environment:

After installation the module, Scipp can be imported in Python.
Note that only the bare essential dependencies are installed.
If you wish to use plotting functionality you will also need to install ``plopp`` and ``ipywidgets``.
If you wish to use plotting functionality you will also need to install ``plopp``, ``ipympl``, and ``pythreejs``.

To update or remove Scipp use `conda update <https://docs.conda.io/projects/conda/en/latest/commands/update.html>`_ and `conda remove <https://docs.conda.io/projects/conda/en/latest/commands/remove.html>`_.

Expand All @@ -78,19 +78,19 @@ Scipp is available from `PyPI <https://pypi.org/>`_ via ``pip``:
pip install scipp
By default, this is only a minimal install without optional dependencies.
To install components for additional submodules, use the ``all`` extras of the module:
To install all optional dependencies, including libraries for interactive plotting in Jupyter, use:

.. code-block:: sh
pip install scipp[all]
This will install everything that is needed, with the exception of plotting libraries for interactive use in Jupyter.
These are available in the ``interactive`` extra.
We recommend combining this with ``all``:
You can also leave out the interactive tools and bring in only functional optional dependencies,
such as ``h5py`` and ``scipy``, use ``extra`` instead of ``all``:

.. code-block:: sh
pip install scipp[all,interactive]
pip install scipp[extra]
From source
-----------
Expand Down
3 changes: 1 addition & 2 deletions docs/getting-started/tutorials/prepare_data_rhessi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import re
from datetime import date, datetime, time, timedelta
from pathlib import Path
from typing import Dict, Union

import numpy as np
import pooch
Expand Down Expand Up @@ -76,7 +75,7 @@ def parse_time(t) -> time:
return time.fromisoformat(t)


def parse_datetimes(d, start, peak, end) -> Dict[str, Union[np.datetime64, int]]:
def parse_datetimes(d, start, peak, end) -> dict[str, np.datetime64 | int]:
d = parse_date(d)
start = parse_time(start)
peak = parse_time(peak)
Expand Down
6 changes: 3 additions & 3 deletions docs/user-guide/binned-data/binned-data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
" data=sc.array(dims=['row'], unit=sc.units.counts, values=values, variances=values),\n",
" coords={\n",
" 'position': sc.array(\n",
" dims=['row'], values=['site-{}'.format(i) for i in range(N)]\n",
" dims=['row'], values=[f'site-{i}' for i in range(N)]\n",
" ),\n",
" 'x': sc.array(dims=['row'], unit='m', values=np.random.rand(N)),\n",
" 'y': sc.array(dims=['row'], unit='m', values=np.random.rand(N)),\n",
Expand Down Expand Up @@ -140,7 +140,7 @@
"ax.set_xlabel('x [{}]'.format(table.coords['x'].unit))\n",
"ax.set_ylabel('y [{}]'.format(table.coords['y'].unit))\n",
"cbar = plt.colorbar(scatter)\n",
"cbar.set_label(\"[{}]\".format(table.unit))"
"cbar.set_label(f\"[{table.unit}]\")"
]
},
{
Expand Down Expand Up @@ -207,7 +207,7 @@
"ax.set_yticks(binned.coords['y'].values)\n",
"ax.grid()\n",
"cbar = fig.colorbar(scatter)\n",
"cbar.set_label(\"[{}]\".format(table.unit))"
"cbar.set_label(f\"[{table.unit}]\")"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions lib/cmake/.conan-recipes/pybind11/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sources:
2.10.0:
sha256: eacf582fa8f696227988d08cfc46121770823839fe9e301a20fbce67e7cd70ec
url: https://github.com/pybind/pybind11/archive/v2.10.0.tar.gz
2.12.0:
sha256: bf8f242abd1abcd375d516a7067490fb71abd79519a282d22b6e4d19282185a7
url: https://github.com/pybind/pybind11/archive/v2.12.0.tar.gz
12 changes: 0 additions & 12 deletions lib/cmake/.conan-recipes/pybind11/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,6 @@ def package(self):
except RuntimeError:
pass
if Version(self.version) >= "2.6.0":
replace_in_file(
self,
os.path.join(
self.package_folder,
"lib",
"cmake",
"pybind11",
"pybind11Common.cmake",
),
"if(TARGET pybind11::lto)",
"if(FALSE)",
)
replace_in_file(
self,
os.path.join(
Expand Down
4 changes: 2 additions & 2 deletions lib/cmake/scipp-conan.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ execute_process(
COMMAND_ECHO STDOUT
)
execute_process(
COMMAND conan export . 2.10.0@
COMMAND conan export . 2.12.0@
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/.conan-recipes/pybind11"
COMMAND_ECHO STDOUT
)
Expand Down Expand Up @@ -58,7 +58,7 @@ conan_cmake_configure(
eigen/3.4.0
gtest/1.11.0
LLNL-Units/0.9.1
pybind11/2.10.0
pybind11/2.12.0
${CONAN_ONETBB}
OPTIONS
benchmark:shared=False
Expand Down
3 changes: 0 additions & 3 deletions lib/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ set_target_properties(
"${CMAKE_INSTALL_RPATH}/${RELATIVE_LIB}/${CMAKE_INSTALL_LIBDIR}"
)

pybind11_strip(_scipp)
pybind11_extension(_scipp)

if(PRECOMPILED_HEADERS)
target_precompile_headers(_scipp PRIVATE pybind11.h)
endif()
Expand Down
10 changes: 4 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ classifiers = [
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand All @@ -28,7 +27,7 @@ classifiers = [
"Topic :: Scientific/Engineering",
"Typing :: Typed",
]
requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = [
"numpy >= 1.20",
]
Expand All @@ -47,24 +46,23 @@ test = [
"bs4",
"ipython",
]
all = [
extra = [
"h5py",
"scipy>=1.7.0",
"graphviz",
"pooch",
"plopp",
"matplotlib"
]
interactive = [
all = [
"scipp[extra]",
"ipympl",
"ipython",
"ipywidgets",
"matplotlib",
"jupyterlab",
"jupyterlab-widgets",
"jupyter_nbextensions_configurator",
"nodejs",
"plopp",
"pythreejs",
]

Expand Down
2 changes: 1 addition & 1 deletion src/scipp/compat/dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def _dict_to_data_array(d):
if "data" not in d:
raise KeyError(
"To create a DataArray, the supplied dict must contain "
"'data'. Got {}.".format(d.keys())
f"'data'. Got {d.keys()}."
)
out = {"coords": {}, "masks": {}, "attrs": {}}
for key in out.keys():
Expand Down
17 changes: 9 additions & 8 deletions src/scipp/compat/pandas_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

from __future__ import annotations

from typing import TYPE_CHECKING, Callable, Iterable, Literal, Optional, Tuple, Union
from collections.abc import Callable, Iterable
from typing import TYPE_CHECKING, Literal

from ..core import DataArray, Dataset, Unit, UnitError, array
from ..typing import VariableLike
Expand Down Expand Up @@ -56,7 +57,7 @@ def from_pandas_series(
def from_pandas_dataframe(
df: pd.DataFrame,
*,
data_columns: Optional[Union[str, Iterable[str]]] = None,
data_columns: str | Iterable[str] | None = None,
include_trivial_index: bool = False,
header_parser: HeaderParserArg = None,
) -> Dataset:
Expand Down Expand Up @@ -85,9 +86,9 @@ def from_pandas_dataframe(


def from_pandas(
pd_obj: Union[pd.DataFrame, pd.Series],
pd_obj: pd.DataFrame | pd.Series,
*,
data_columns: Optional[Union[str, Iterable[str]]] = None,
data_columns: str | Iterable[str] | None = None,
include_trivial_index: bool = False,
header_parser: HeaderParserArg = None,
) -> VariableLike:
Expand Down Expand Up @@ -146,11 +147,11 @@ def from_pandas(
raise ValueError(f"from_pandas: cannot convert type '{type(pd_obj)}'")


HeaderParser = Callable[[str], Tuple[str, Optional[Unit]]]
HeaderParserArg = Optional[Union[Literal["bracket"], HeaderParser]]
HeaderParser = Callable[[str], tuple[str, Unit | None]]
HeaderParserArg = Literal["bracket"] | HeaderParser | None


def parse_bracket_header(head: str) -> Tuple[str, Optional[Unit]]:
def parse_bracket_header(head: str) -> tuple[str, Unit | None]:
"""Parses strings of the form ``name [unit]``.
``name`` may be any string that does not contain the character ``[``.
Expand Down Expand Up @@ -207,7 +208,7 @@ def parse_bracket_header(head: str) -> Tuple[str, Optional[Unit]]:
}


def _parse_header(header: str, parser: HeaderParserArg) -> Tuple[str, Optional[Unit]]:
def _parse_header(header: str, parser: HeaderParserArg) -> tuple[str, Unit | None]:
if parser is None:
return header, default_unit
if callable(parser):
Expand Down

0 comments on commit 3ac6119

Please sign in to comment.