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 .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: d9ab46a
_commit: 9cf97d4
_src_path: gh:scipp/copier_template
description: Reflectometry data reduction for the European Spallation Source
max_python: '3.12'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly_at_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Nightly test at main branch
on:
workflow_dispatch:
schedule:
- cron: '30 23 * * *'
- cron: '30 1 * * 1-5'

jobs:
setup:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly_at_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Nightly tests at latest release
on:
workflow_dispatch:
schedule:
- cron: '0 23 * * *'
- cron: '0 1 * * 1-5'

jobs:
setup:
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/unpinned.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp)

name: Unpinned tests at latest release

on:
workflow_dispatch:
schedule:
- cron: '0 2 * * 1'

jobs:
setup:
name: Setup variables
runs-on: 'ubuntu-20.04'
outputs:
min_python: ${{ steps.vars.outputs.min_python }}
release_tag: ${{ steps.release.outputs.release_tag }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # history required so we can determine latest release tag
- name: Get last release tag from git
id: release
run: echo "release_tag=$(git describe --tags --abbrev=0 --match '[0-9]*.[0-9]*.[0-9]*')" >> $GITHUB_OUTPUT
- name: Get Python version for other CI jobs
id: vars
run: echo "min_python=$(cat .github/workflows/python-version-ci)" >> $GITHUB_OUTPUT

tests:
name: Tests
needs: setup
strategy:
matrix:
os: ['ubuntu-20.04']
python:
- version: '${{needs.setup.outputs.min_python}}'
tox-env: 'unpinned'
uses: ./.github/workflows/test.yml
with:
os-variant: ${{ matrix.os }}
python-version: ${{ matrix.python.version }}
tox-env: ${{ matrix.python.tox-env }}
checkout_ref: ${{ needs.setup.outputs.release_tag }}
15 changes: 7 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-json
Expand All @@ -18,7 +18,7 @@ repos:
- id: isort
name: isort (python)
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.0
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/kynan/nbstripout
Expand All @@ -29,28 +29,27 @@ repos:
args: [ "--drop-empty-cells",
"--extra-keys 'metadata.language_info.version cell.metadata.jp-MarkdownHeadingCollapsed cell.metadata.pycharm'" ]
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
rev: 6.1.0
hooks:
- id: flake8
types: ["python"]
additional_dependencies: ["flake8-bugbear==22.10.27"]
additional_dependencies: ["flake8-bugbear==23.9.16"]
- repo: https://github.com/pycqa/bandit
rev: 1.7.4
rev: 1.7.5
hooks:
- id: bandit
additional_dependencies: ["bandit[toml]"]
args: ["-c", "pyproject.toml"]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies:
- tomli
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
rev: v1.10.0
hooks:
- id: python-no-eval
exclude: "object_list.py"
- id: python-no-log-warn
- id: python-use-type-annotations
- id: rst-backticks
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ representative at an online or offline event.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
scipp@ess.eu.
scipp[at]ess.eu.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
Expand Down
6 changes: 3 additions & 3 deletions docs/developer/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ tox -e linkcheck
Build the documentation using

```sh
python -m sphinx -v -b html -d build/.doctrees docs build/html
python -m sphinx -v -b html -d .tox/docs_doctrees docs html
```

Additionally, test the documentation using

```sh
python -m sphinx -v -b doctest -d build/.doctrees docs build/html
python -m sphinx -v -b linkcheck -d build/.doctrees docs build/html
python -m sphinx -v -b doctest -d .tox/docs_doctrees docs html
python -m sphinx -v -b linkcheck -d .tox/docs_doctrees docs html
```
````
`````
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ dynamic = ["version"]

[project.urls]
"Bug Tracker" = "https://github.com/scipp/essreflectometry/issues"
"Documentation" = "https://scipp.github.io/essreflectometry"
"Source" = "https://github.com/scipp/essreflectometry"

[tool.setuptools_scm]
Expand All @@ -70,6 +71,7 @@ skip-string-normalization = true
[tool.isort]
skip_gitignore = true
profile = "black"
known_first_party = ["essreflectometry"]

[tool.mypy]
strict = true
Expand Down
24 changes: 14 additions & 10 deletions requirements/make_base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
from argparse import ArgumentParser
from typing import List

import tomli

Expand All @@ -12,7 +13,14 @@
)
args = parser.parse_args()

header = "# Generated by 'tox -e deps', DO NOT EDIT MANUALLY!'\n"

def write_dependencies(dependency_name: str, dependencies: List[str]) -> None:
header = "# Generated by 'tox -e deps', DO NOT EDIT MANUALLY!'\n"
with open(f"{dependency_name}.in", "w") as f:
f.write(header)
f.write("\n".join(dependencies))
f.write("\n")


with open("../pyproject.toml", "rb") as toml_file:
pyproject = tomli.load(toml_file)
Expand All @@ -21,9 +29,7 @@
raise RuntimeError("No dependencies found in pyproject.toml")
dependencies = [dep.strip().strip('"') for dep in dependencies]

with open("base.in", "w") as f:
f.write(header)
f.write("\n".join(dependencies))
write_dependencies("base", dependencies)


def as_nightly(repo: str) -> str:
Expand All @@ -39,10 +45,8 @@ def as_nightly(repo: str) -> str:
return f"{repo} @ git+https://github.com/{org}/{repo}@main"


nightly = args.nightly.split(",") if args.nightly else []
dependencies = [dep for dep in dependencies if not dep.startswith(tuple(nightly))]
dependencies += [as_nightly(arg) for arg in nightly]
nightly = tuple(args.nightly.split(",") if args.nightly else [])
nightly_dependencies = [dep for dep in dependencies if not dep.startswith(nightly)]
nightly_dependencies += [as_nightly(arg) for arg in nightly]

with open("nightly.in", "w") as f:
f.write(header)
f.write("\n".join(dependencies))
write_dependencies("nightly", nightly_dependencies)
1 change: 1 addition & 0 deletions src/essreflectometry/orso.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ def not_found_warning():
"For metadata to be logged in the data array, "
"it is necessary to install the orsopy package.",
UserWarning,
stacklevel=2,
)
7 changes: 4 additions & 3 deletions src/essreflectometry/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ class ThetaData(sciline.Scope[Run, sc.DataArray], sc.DataArray):


class QData(sciline.Scope[Run, sc.DataArray], sc.DataArray):
"""Event data with wavelength, incidence angle and momentum transfer computed per event.
"""Event data with wavelength, incidence angle,
and momentum transfer computed per event.
Binned by momentum transfer according to the QBins provider,
and by `detector_number` (pixel of the detector frame).
"""


class FootprintCorrectedData(sciline.Scope[Run, sc.DataArray], sc.DataArray):
"""Event data with weight corrected for the footprint of the beam on the sample for the
incidence angle of the event."""
"""Event data with weight corrected for the footprint of the beam
on the sample for the incidence angle of the event."""


SpecularReflectionCoordTransformGraph = NewType(
Expand Down
9 changes: 8 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ isolated_build = true
deps = -r requirements/test.txt
setenv =
JUPYTER_PLATFORM_DIRS = 1
commands = pytest
commands = pytest {posargs}

[testenv:nightly]
deps =
-r requirements/nightly.txt
pytest
commands = pytest

[testenv:unpinned]
description = Test with unpinned dependencies, as a user would install now.
deps =
essreflectometry
pytest
commands = pytest

[testenv:docs]
description = invoke sphinx-build to build the HTML docs
deps = -r requirements/docs.txt
Expand Down