Skip to content

Commit 92bb40c

Browse files
authored
Merge pull request #52 from scipp/copier-update-2024-06
Copier update 2024 06
2 parents acf1cba + bd382db commit 92bb40c

32 files changed

+121
-708
lines changed

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2-
_commit: '2955216'
2+
_commit: 91ffffb
33
_src_path: gh:scipp/copier_template
44
description: Reflectometry data reduction for the European Spallation Source
55
max_python: '3.12'

.github/workflows/docs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
- uses: actions/checkout@v4
4848
with:
4949
ref: ${{ inputs.branch == '' && github.ref_name || inputs.branch }}
50+
repository: ${{ github.event.pull_request.head.repo.full_name }}
5051
fetch-depth: 0 # history required so cmake can determine version
5152
- uses: actions/setup-python@v5
5253
with:
@@ -64,7 +65,7 @@ jobs:
6465
name: docs_html
6566
path: html/
6667

67-
- uses: JamesIves/github-pages-deploy-action@v4.5.0
68+
- uses: JamesIves/github-pages-deploy-action@v4.6.1
6869
if: ${{ inputs.publish }}
6970
with:
7071
branch: gh-pages

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
id-token: write
6868
if: github.event_name == 'release' && github.event.action == 'published'
6969
steps:
70-
- uses: actions/download-artifact@v3
70+
- uses: actions/download-artifact@v4
7171
- uses: pypa/[email protected]
7272

7373
upload_conda:
@@ -77,7 +77,7 @@ jobs:
7777
if: github.event_name == 'release' && github.event.action == 'published'
7878

7979
steps:
80-
- uses: actions/download-artifact@v3
80+
- uses: actions/download-artifact@v4
8181
- uses: mamba-org/setup-micromamba@v1
8282
with:
8383
environment-name: upload-env
@@ -101,7 +101,7 @@ jobs:
101101
permissions:
102102
contents: write # This is needed so that the action can upload the asset
103103
steps:
104-
- uses: actions/download-artifact@v3
104+
- uses: actions/download-artifact@v4
105105
- name: Zip documentation
106106
run: |
107107
mv docs_html documentation-${{ github.ref_name }}

.pre-commit-config.yaml

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,21 @@ repos:
1313
- id: trailing-whitespace
1414
args: [ --markdown-linebreak-ext=md ]
1515
exclude: '\.svg'
16-
- repo: https://github.com/pycqa/isort
17-
rev: 5.12.0
18-
hooks:
19-
- id: isort
20-
name: isort (python)
21-
- repo: https://github.com/psf/black-pre-commit-mirror
22-
rev: 23.11.0
23-
hooks:
24-
- id: black
2516
- repo: https://github.com/kynan/nbstripout
2617
rev: 0.6.0
2718
hooks:
2819
- id: nbstripout
2920
types: [ "jupyter" ]
3021
args: [ "--drop-empty-cells",
3122
"--extra-keys 'metadata.language_info.version cell.metadata.jp-MarkdownHeadingCollapsed cell.metadata.pycharm'" ]
32-
- repo: https://github.com/pycqa/flake8
33-
rev: 6.1.0
34-
hooks:
35-
- id: flake8
36-
types: ["python"]
37-
additional_dependencies: ["flake8-bugbear==23.9.16"]
38-
- repo: https://github.com/pycqa/bandit
39-
rev: 1.7.5
40-
hooks:
41-
- id: bandit
42-
additional_dependencies: ["bandit[toml]"]
43-
args: ["-c", "pyproject.toml"]
23+
- repo: https://github.com/astral-sh/ruff-pre-commit
24+
rev: v0.4.3
25+
hooks:
26+
- id: ruff
27+
args: [ --fix ]
28+
types_or: [ python, pyi, jupyter ]
29+
- id: ruff-format
30+
types_or: [ python, pyi ]
4431
- repo: https://github.com/codespell-project/codespell
4532
rev: v2.2.6
4633
hooks:

conda/meta.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ package:
66
source:
77
path: ..
88

9+
10+
{% set pyproject = load_file_data('pyproject.toml') %}
11+
{% set dependencies = pyproject.get('project', {}).get('dependencies', {}) %}
12+
13+
914
requirements:
1015
build:
1116
- setuptools
1217
- setuptools_scm
1318
run:
14-
- dask
15-
- python-dateutil
16-
- graphviz
17-
- plopp
18-
- pythreejs
19-
- orsopy
20-
- sciline>=23.9.1
21-
- scipp>=23.8.0
22-
- scippneutron>=23.9.0
23-
- essreduce
2419
- python>=3.10
2520

21+
{% for package in dependencies %}
22+
- {% if package == "graphviz" %}python-graphviz{% else %}{{ package }}{% endif %}
23+
{% endfor %}
24+
25+
2626
test:
2727
imports:
2828
- ess.reflectometry

docs/_templates/doc_version.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<!-- This will display the version of the docs -->
2-
Current {{ project }} version: {{ version }} (<a href="https://github.com/{{orgname}}/{{ project|lower }}/releases">older versions</a>).
2+
Current ESSreflectometry version: {{ version }} (<a href="https://github.com/scipp/essreflectometry/releases">older versions</a>).

docs/conf.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
# -*- coding: utf-8 -*-
2-
31
import doctest
42
import os
53
import sys
4+
from importlib.metadata import PackageNotFoundError
5+
from importlib.metadata import version as get_version
66

7-
from ess import reflectometry
7+
from sphinx.util import logging
88

99
sys.path.insert(0, os.path.abspath('.'))
1010

11+
logger = logging.getLogger(__name__)
12+
1113
# General information about the project.
12-
project = u'ESSreflectometry'
13-
copyright = u'2024 Scipp contributors'
14-
author = u'Scipp contributors'
14+
project = 'ESSreflectometry'
15+
copyright = '2024 Scipp contributors'
16+
author = 'Scipp contributors'
1517

1618
html_show_sourcelink = True
1719

@@ -35,6 +37,8 @@
3537
import sciline.sphinxext.domain_types # noqa: F401
3638

3739
extensions.append('sciline.sphinxext.domain_types')
40+
# See https://github.com/tox-dev/sphinx-autodoc-typehints/issues/457
41+
suppress_warnings = ["config.cache"]
3842
except ModuleNotFoundError:
3943
pass
4044

@@ -111,10 +115,15 @@
111115
# built documents.
112116
#
113117

114-
# The short X.Y version.
115-
version = reflectometry.__version__
116-
# The full version, including alpha/beta/rc tags.
117-
release = reflectometry.__version__
118+
try:
119+
release = get_version("essreflectometry")
120+
version = ".".join(release.split('.')[:3]) # CalVer
121+
except PackageNotFoundError:
122+
logger.info(
123+
"Warning: determining version from package metadata failed, falling back to "
124+
"a dummy version number."
125+
)
126+
release = version = "0.0.0-dev"
118127

119128
warning_is_error = True
120129

docs/developer/coding-conventions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Code formatting
44

5-
There are no explicit code formatting conventions since we use `black` to enforce a format.
5+
There are no explicit code formatting conventions since we use `ruff` to enforce a format.
66

77
## Docstring format
88

docs/user-guide/amor/amor-reduction.ipynb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"outputs": [],
2626
"source": [
2727
"import scipp as sc\n",
28-
"import sciline\n",
2928
"from ess import amor\n",
3029
"from ess.reflectometry.types import *\n",
3130
"from ess.amor.types import *"
@@ -354,8 +353,7 @@
354353
"mimetype": "text/x-python",
355354
"name": "python",
356355
"nbconvert_exporter": "python",
357-
"pygments_lexer": "ipython3",
358-
"version": "3.10.13"
356+
"pygments_lexer": "ipython3"
359357
}
360358
},
361359
"nbformat": 4,

docs/user-guide/amor/compare-to-eos.ipynb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"\n",
2424
"import scipp as sc\n",
2525
"import plopp as pp\n",
26-
"import sciline\n",
2726
"from ess import amor\n",
2827
"from ess.reflectometry.types import *\n",
2928
"from ess.amor.types import ChopperPhase"
@@ -137,7 +136,7 @@
137136
"outputs": [],
138137
"source": [
139138
"# PSI results\n",
140-
"for key, angle in mu.items():\n",
139+
"for key in mu:\n",
141140
" d = orsopy.fileio.load_orso(amor.data.amor_psi_software_result(key))[0].data\n",
142141
" y = sc.array(dims=['Q'], values=d[:, 1], variances=d[:, 2] ** 2)\n",
143142
" results['psi'][key] = sc.DataArray(\n",
@@ -162,7 +161,7 @@
162161
"source": [
163162
"fig, axs = plt.subplots(3, 2, figsize=(12, 12))\n",
164163
"\n",
165-
"for ax, (key, angle) in zip(axs.ravel(), mu.items()):\n",
164+
"for ax, (key, angle) in zip(axs.ravel(), mu.items(), strict=True):\n",
166165
" pp.plot(\n",
167166
" {\n",
168167
" facility: results[facility][key][results[facility][key].data > 0.0]\n",
@@ -196,9 +195,9 @@
196195
"source": [
197196
"fig, axs = plt.subplots(1, 2, figsize=(12, 4))\n",
198197
"\n",
199-
"for ax, (facility, res) in zip(axs.ravel(), results.items()):\n",
198+
"for ax, (facility, res) in zip(axs.ravel(), results.items(), strict=True):\n",
200199
" pp.plot(\n",
201-
" {k: v for k, v in list(res.items())[:4]}, # First 4 curves\n",
200+
" dict(list(res.items())[:4]), # First 4 curves\n",
202201
" ax=ax,\n",
203202
" norm='log',\n",
204203
" ls='solid',\n",

0 commit comments

Comments
 (0)