Skip to content

Commit b0de004

Browse files
Enable additional Ruff rule sets and raise Python support to 3.12-3.14 (#139)
* Refactor type annotations to remove explicit numpy types in multiple files * Enable RSE and SLOT rules * Enable PYI rule and apply some formatting * Enable PT rule * Enable FA, INP, ISC, LOG rules * Enable EM rules * Enable COM rule * Enable C4 rule * Enable PLE, PLW, ASYNC rules * Fix PLC0415 and PLC2801 ruff errors with targeted noqa * Enable UP rule * Enable TRY rule * Enable PERF rule * Update Python version compatibility to 3.12 and adjust related configurations * Fix np.array to np.ndarray in type annotations * Add repository name to GitHub action configuration * Add additional Conda dependencies for osx-arm64 platform * Update GitHub Actions workflow to add concurrency and conditional execution * Correct typo: from "Crystall" to "Crystal"
1 parent 3361501 commit b0de004

92 files changed

Lines changed: 1286 additions & 1395 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.copier-answers.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ _src_path: gh:easyscience/templates
55
app_docs_url: https://easyscience.github.io/diffraction-app
66
app_doi: 10.5281/zenodo.18163581
77
app_package_name: easydiffraction_app
8-
app_python: '3.13'
8+
app_python: '3.14'
99
app_repo_name: diffraction-app
1010
home_page_url: https://easyscience.github.io/diffraction
1111
home_repo_name: diffraction
1212
lib_docs_url: https://easyscience.github.io/diffraction-lib
1313
lib_doi: 10.5281/zenodo.18163581
1414
lib_package_name: easydiffraction
1515
lib_python_max: '3.14'
16-
lib_python_min: '3.11'
16+
lib_python_min: '3.12'
1717
lib_repo_name: diffraction-lib
1818
project_contact_email: support@easydiffraction.org
1919
project_copyright_years: 2021-2026

.github/workflows/issues-labels.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ permissions:
1313

1414
jobs:
1515
check-labels:
16+
if: github.actor != 'easyscience[bot]'
17+
1618
runs-on: ubuntu-latest
1719

20+
concurrency:
21+
group: issue-labels-${{ github.event.issue.number }}
22+
cancel-in-progress: true
23+
1824
steps:
1925
- name: Checkout repository
2026
uses: actions/checkout@v5

.github/workflows/pypi-test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ jobs:
5151

5252
- name: Add other Conda dependencies
5353
working-directory: easydiffraction
54-
run: pixi add gsl
54+
run: |
55+
pixi add gsl
56+
pixi add --platform osx-arm64 libcxx
5557
5658
- name: Add easydiffraction from PyPI
5759
working-directory: easydiffraction

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ concurrency:
4444
# Set the environment variables to be used in all jobs defined in this workflow
4545
env:
4646
CI_BRANCH: ${{ github.head_ref || github.ref_name }}
47-
PY_VERSIONS: '3.11 3.14'
48-
PIXI_ENVS: 'py-311-env py-314-env'
47+
PY_VERSIONS: '3.12 3.14'
48+
PIXI_ENVS: 'py-312-env py-314-env'
4949

5050
jobs:
5151
# Job 1: Set up environment variables

docs/docs/installation-and-setup/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ icon: material/cog-box
55
# :material-cog-box: Installation & Setup
66

77
**EasyDiffraction** is a cross-platform Python library compatible with
8-
**Python 3.11** through **3.14**.
8+
**Python 3.12** through **3.14**.
99

1010
EasyDiffraction is a cross-platform Python library compatible with
1111
**Python 3.11 through 3.13**.

docs/docs/user-guide/parameters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ the table.
8181
Below is a list of parameters used to describe the structure in
8282
EasyDiffraction.
8383

84-
### Crystall structure parameters
84+
### Crystal structure parameters
8585

8686
[pd-neut-cwl][3]{:.label-experiment}
8787
[pd-neut-tof][3]{:.label-experiment} [pd-xray][3]{:.label-experiment}

pixi.lock

Lines changed: 610 additions & 758 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pixi.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ easydiffraction = { path = '.', editable = true, extras = ['dev'] }
6363
# Specific features: Set specific Python versions
6464

6565
[feature.py-min.dependencies]
66-
python = '3.11.*'
66+
python = '3.12.*'
6767
[feature.py-max.dependencies]
6868
python = '3.14.*'
6969

@@ -75,7 +75,7 @@ python = '3.14.*'
7575

7676
# The `default` feature is always included in all environments.
7777
# Additional features can be specified per environment.
78-
py-311-env = { features = ['default', 'py-min'] }
78+
py-312-env = { features = ['default', 'py-min'] }
7979
py-314-env = { features = ['default', 'py-max'] }
8080

8181
# The `default` environment is always created and includes the `default` feature.

pyproject.toml

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ classifiers = [
1717
'Operating System :: OS Independent',
1818
'Programming Language :: Python :: 3 :: Only',
1919
'Programming Language :: Python :: 3',
20-
'Programming Language :: Python :: 3.11',
2120
'Programming Language :: Python :: 3.12',
2221
'Programming Language :: Python :: 3.13',
2322
'Programming Language :: Python :: 3.14',
2423
]
25-
requires-python = '>=3.11'
24+
requires-python = '>=3.12'
2625
dependencies = [
2726
'essdiffraction', # ESS-specific diffraction library
2827
'numpy', # Numerical computing library
@@ -221,55 +220,55 @@ select = [
221220
'F', # https://docs.astral.sh/ruff/rules/#pyflakes-f
222221
'FLY', # https://docs.astral.sh/ruff/rules/#flynt-fly
223222
#'FURB', # https://docs.astral.sh/ruff/rules/#refurb-furb
224-
'I', # https://docs.astral.sh/ruff/rules/#isort-i
225-
'N', # https://docs.astral.sh/ruff/rules/#pep8-naming-n
226-
'NPY', # https://docs.astral.sh/ruff/rules/#numpy-specific-rules-npy
227-
'PGH', # https://docs.astral.sh/ruff/rules/#pygrep-hooks-pgh
228-
#'PERF', # https://docs.astral.sh/ruff/rules/#perflint-perf
223+
'I', # https://docs.astral.sh/ruff/rules/#isort-i
224+
'N', # https://docs.astral.sh/ruff/rules/#pep8-naming-n
225+
'NPY', # https://docs.astral.sh/ruff/rules/#numpy-specific-rules-npy
226+
'PGH', # https://docs.astral.sh/ruff/rules/#pygrep-hooks-pgh
227+
'PERF', # https://docs.astral.sh/ruff/rules/#perflint-perf
229228
#'RUF', # https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
230-
#'TRY', # https://docs.astral.sh/ruff/rules/#tryceratops-try
231-
#'UP', # https://docs.astral.sh/ruff/rules/#pyupgrade-up
229+
'TRY', # https://docs.astral.sh/ruff/rules/#tryceratops-try
230+
'UP', # https://docs.astral.sh/ruff/rules/#pyupgrade-up
232231
# pycodestyle (E, W) rules
233232
'E', # https://docs.astral.sh/ruff/rules/#error-e
234233
'W', # https://docs.astral.sh/ruff/rules/#warning-w
235234
# Pylint (PL) rules
236-
#'PLC', # https://docs.astral.sh/ruff/rules/#convention-plc
237-
#'PLE', # https://docs.astral.sh/ruff/rules/#error-ple
235+
'PLC', # https://docs.astral.sh/ruff/rules/#convention-plc
236+
'PLE', # https://docs.astral.sh/ruff/rules/#error-ple
238237
#'PLR', # https://docs.astral.sh/ruff/rules/#refactor-plr
239-
#'PLW', # https://docs.astral.sh/ruff/rules/#warning-plw
238+
'PLW', # https://docs.astral.sh/ruff/rules/#warning-plw
240239
# flake8 rules
241240
#'A', # https://docs.astral.sh/ruff/rules/#flake8-builtins-a
242-
'ANN', # https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
243-
'ARG', # https://docs.astral.sh/ruff/rules/#flake8-unused-arguments-arg
244-
#'ASYNC', # https://docs.astral.sh/ruff/rules/#flake8-async-async
245-
'B', # https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
241+
'ANN', # https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
242+
'ARG', # https://docs.astral.sh/ruff/rules/#flake8-unused-arguments-arg
243+
'ASYNC', # https://docs.astral.sh/ruff/rules/#flake8-async-async
244+
'B', # https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
246245
#'BLE', # https://docs.astral.sh/ruff/rules/#flake8-blind-except-ble
247-
#'C4', # https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
248-
#'COM', # https://docs.astral.sh/ruff/rules/#flake8-commas-com
246+
'C4', # https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
247+
'COM', # https://docs.astral.sh/ruff/rules/#flake8-commas-com
249248
'DTZ', # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz
250-
#'EM', # https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
251-
#'FA', # https://docs.astral.sh/ruff/rules/#flake8-future-annotations-fa
249+
'EM', # https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
250+
'FA', # https://docs.astral.sh/ruff/rules/#flake8-future-annotations-fa
252251
#'FBT', # https://docs.astral.sh/ruff/rules/#flake8-boolean-trap-fbt
253252
#'FIX', # https://docs.astral.sh/ruff/rules/#flake8-fixme-fix
254253
'G', # https://docs.astral.sh/ruff/rules/#flake8-logging-format-g
255254
'ICN', # https://docs.astral.sh/ruff/rules/#flake8-import-conventions-icn
256-
#'INP', # https://docs.astral.sh/ruff/rules/#flake8-no-pep420-inp
257-
#'ISC', # https://docs.astral.sh/ruff/rules/#flake8-implicit-str-concat-isc
258-
#'LOG', # https://docs.astral.sh/ruff/rules/#flake8-logging-log
255+
'INP', # https://docs.astral.sh/ruff/rules/#flake8-no-pep420-inp
256+
'ISC', # https://docs.astral.sh/ruff/rules/#flake8-implicit-str-concat-isc
257+
'LOG', # https://docs.astral.sh/ruff/rules/#flake8-logging-log
259258
#'PIE', # https://docs.astral.sh/ruff/rules/#flake8-pie-pie
260-
#'PT', # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
259+
'PT', # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
261260
'PTH', # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
262-
#'PYI', # https://docs.astral.sh/ruff/rules/#flake8-pyi-pyi
261+
'PYI', # https://docs.astral.sh/ruff/rules/#flake8-pyi-pyi
263262
#'RET', # https://docs.astral.sh/ruff/rules/#flake8-return-ret
264-
#'RSE', # https://docs.astral.sh/ruff/rules/#flake8-raise-rse
263+
'RSE', # https://docs.astral.sh/ruff/rules/#flake8-raise-rse
265264
'S', # https://docs.astral.sh/ruff/rules/#flake8-bandit-s
266265
'SIM', # https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
267266
#'SLF', # https://docs.astral.sh/ruff/rules/#flake8-self-slf
268-
#'SLOT', # https://docs.astral.sh/ruff/rules/#flake8-slots-slot
267+
'SLOT', # https://docs.astral.sh/ruff/rules/#flake8-slots-slot
269268
#'T20', # https://docs.astral.sh/ruff/rules/#flake8-print-t20
270-
#'TC', # https://docs.astral.sh/ruff/rules/#flake8-type-checking-tc
269+
'TC', # https://docs.astral.sh/ruff/rules/#flake8-type-checking-tc
271270
#'TD', # https://docs.astral.sh/ruff/rules/#flake8-todos-td
272-
#'TID', # https://docs.astral.sh/ruff/rules/#flake8-tidy-imports-tid
271+
'TID', # https://docs.astral.sh/ruff/rules/#flake8-tidy-imports-tid
273272
]
274273

275274
# Exceptions to the linting rules
@@ -318,6 +317,7 @@ ignore = [
318317
'PLR',
319318
'PLW',
320319
'SIM117',
320+
'TRY',
321321
'W505',
322322
]
323323
'docs/**' = [

src/easydiffraction/__main__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
@app.callback(invoke_without_command=True)
1919
def main(
2020
ctx: typer.Context,
21-
version: bool = typer.Option( # noqa: FBT003 - boolean option is intended
21+
version: bool = typer.Option(
2222
False,
2323
'--version',
2424
'-V',
@@ -53,7 +53,7 @@ def download_tutorial(
5353
help='Directory to save the tutorial into.',
5454
),
5555
overwrite: bool = typer.Option(
56-
False, # noqa: FBT003 - boolean option is intended
56+
False,
5757
'--overwrite',
5858
'-o',
5959
help='Overwrite existing file if present.',
@@ -72,7 +72,7 @@ def download_all_tutorials(
7272
help='Directory to save the tutorials into.',
7373
),
7474
overwrite: bool = typer.Option(
75-
False, # noqa: FBT003 - boolean option is intended
75+
False,
7676
'--overwrite',
7777
'-o',
7878
help='Overwrite existing files if present.',

0 commit comments

Comments
 (0)