Skip to content

Commit 06429d5

Browse files
committed
run copier update
1 parent acf1cba commit 06429d5

File tree

14 files changed

+84
-69
lines changed

14 files changed

+84
-69
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

pyproject.toml

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,43 @@ filterwarnings = [
6767
"ignore:.*metadata to be logged in the data array, it is necessary to install the orsopy package.:UserWarning",
6868
]
6969

70-
[tool.bandit]
71-
# Excluding tests because bandit doesn't like `assert`.
72-
exclude_dirs = ["docs/conf.py", "tests"]
70+
[tool.ruff]
71+
line-length = 88
72+
extend-include = ["*.ipynb"]
73+
extend-exclude = [
74+
".*", "__pycache__", "build", "dist", "install",
75+
]
76+
77+
[tool.ruff.lint]
78+
# See https://docs.astral.sh/ruff/rules/
79+
select = ["B", "C4", "DTZ", "E", "F", "G", "I", "PERF", "PGH", "PT", "PYI", "RUF", "S", "T20", "UP", "W"]
80+
ignore = [
81+
# Conflict with ruff format, see
82+
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
83+
"COM812", "COM819", "D206", "D300", "E111", "E114", "E117", "ISC001", "ISC002", "Q000", "Q001", "Q002", "Q003", "W191",
84+
]
85+
fixable = ["I001", "B010"]
86+
isort.known-first-party = ["essreflectometry"]
87+
pydocstyle.convention = "numpy"
7388

74-
[tool.black]
75-
skip-string-normalization = true
89+
[tool.ruff.lint.per-file-ignores]
90+
# those files have an increased risk of relying on import order
91+
"__init__.py" = ["I"]
92+
"tests/*" = [
93+
"S101", # asserts are fine in tests
94+
"B018", # 'useless expressions' are ok because some tests just check for exceptions
95+
]
96+
"*.ipynb" = [
97+
"E501", # longer lines are sometimes more readable
98+
"F403", # *-imports used with domain types
99+
"F405", # linter may fail to find names because of *-imports
100+
"I", # we don't collect imports at the top
101+
"S101", # asserts are used for demonstration and are safe in notebooks
102+
"T201", # printing is ok for demonstration purposes
103+
]
76104

77-
[tool.isort]
78-
skip_gitignore = true
79-
profile = "black"
80-
known_first_party = ["essreflectometry"]
105+
[tool.ruff.format]
106+
quote-style = "preserve"
81107

82108
[tool.mypy]
83109
strict = true
@@ -87,5 +113,4 @@ enable_error_code = [
87113
"redundant-expr",
88114
"truthy-bool",
89115
]
90-
show_error_codes = true
91116
warn_unreachable = true

requirements/dev.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,3 @@ copier
99
jupyterlab
1010
pip-compile-multi
1111
pre-commit
12-
13-
# See https://github.com/copier-org/copier/issues/1568
14-
pyyaml-include<2

0 commit comments

Comments
 (0)