Skip to content

Commit bbc6db7

Browse files
authored
Merge pull request #59 from legend-exp/pkg-update
Migrate to pyproject.toml, upgrade pre-commit config
2 parents 0cf3eaa + 515357f commit bbc6db7

Some content is hidden

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

60 files changed

+1136
-771
lines changed

.github/workflows/main.yml

+21-19
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
11
name: lgdo
22

33
on:
4+
workflow_dispatch:
5+
pull_request:
46
push:
57
branches:
68
- main
7-
- 'releases/**'
8-
pull_request:
9-
release:
9+
- "releases/**"
1010

1111
concurrency:
1212
group: ${{ github.workflow }}-${{ github.ref }}
1313
cancel-in-progress: true
1414

15-
jobs:
15+
env:
16+
FORCE_COLOR: 3
1617

18+
jobs:
1719
build-and-test:
1820
name: Test lgdo with Python
1921
runs-on: ${{ matrix.os }}
2022
strategy:
2123
fail-fast: false
2224
matrix:
23-
python-version: ['3.9', '3.10', '3.11']
25+
python-version: ["3.9", "3.10", "3.11"]
2426
os: [ubuntu-latest, macOS-latest]
2527

2628
steps:
27-
- uses: actions/checkout@v4
28-
- name: Set up Python ${{ matrix.python-version }}
29-
uses: actions/setup-python@v5
30-
with:
31-
python-version: ${{ matrix.python-version }}
32-
- name: Get dependencies and install lgdo
33-
run: |
34-
python -m pip install --upgrade pip wheel setuptools
35-
python -m pip install --upgrade .[test]
36-
- name: Run unit tests
37-
run: |
38-
python -m pytest
29+
- uses: actions/checkout@v4
30+
- name: Set up Python ${{ matrix.python-version }}
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
- name: Get dependencies and install lgdo
35+
run: |
36+
python -m pip install --upgrade pip wheel setuptools
37+
python -m pip install --upgrade .[test]
38+
- name: Run unit tests
39+
run: |
40+
python -m pytest
3941
4042
test-coverage:
4143
name: Calculate and upload test coverage
@@ -46,7 +48,7 @@ jobs:
4648
fetch-depth: 2
4749
- uses: actions/setup-python@v5
4850
with:
49-
python-version: '3.10'
51+
python-version: "3.10"
5052

5153
- name: Generate Report
5254
run: |
@@ -65,7 +67,7 @@ jobs:
6567
fetch-depth: 0
6668
- uses: actions/setup-python@v5
6769
with:
68-
python-version: '3.10'
70+
python-version: "3.10"
6971
- name: Setup build environment
7072
run: |
7173
sudo apt-get install -y pandoc

.pre-commit-config.yaml

+71-93
Original file line numberDiff line numberDiff line change
@@ -4,105 +4,83 @@ ci:
44
autofix_commit_msg: "style: pre-commit fixes"
55

66
repos:
7-
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: "v4.5.0"
9-
hooks:
10-
- id: check-added-large-files
11-
- id: check-case-conflict
12-
- id: check-executables-have-shebangs
13-
- id: check-merge-conflict
14-
- id: check-symlinks
15-
- id: check-yaml
16-
- id: check-json
17-
- id: check-toml
18-
- id: check-docstring-first
19-
- id: debug-statements
20-
- id: end-of-file-fixer
21-
- id: forbid-new-submodules
22-
- id: mixed-line-ending
23-
- id: requirements-txt-fixer
24-
- id: trailing-whitespace
7+
- repo: https://github.com/adamchainz/blacken-docs
8+
rev: "1.16.0"
9+
hooks:
10+
- id: blacken-docs
11+
additional_dependencies: [black==23.*]
2512

26-
- repo: https://github.com/asottile/setup-cfg-fmt
27-
rev: "v2.5.0"
28-
hooks:
29-
- id: setup-cfg-fmt
13+
- repo: https://github.com/pre-commit/pre-commit-hooks
14+
rev: "v4.5.0"
15+
hooks:
16+
- id: check-added-large-files
17+
- id: check-case-conflict
18+
- id: check-executables-have-shebangs
19+
- id: check-merge-conflict
20+
- id: check-symlinks
21+
- id: check-yaml
22+
- id: check-json
23+
- id: check-toml
24+
- id: check-docstring-first
25+
- id: debug-statements
26+
- id: end-of-file-fixer
27+
- id: forbid-new-submodules
28+
- id: mixed-line-ending
29+
- id: requirements-txt-fixer
30+
- id: trailing-whitespace
3031

31-
- repo: https://github.com/PyCQA/isort
32-
rev: "5.13.2"
33-
hooks:
34-
- id: isort
32+
- repo: https://github.com/kynan/nbstripout
33+
rev: "0.6.1"
34+
hooks:
35+
- id: nbstripout
36+
args:
37+
[
38+
"--drop-empty-cells",
39+
"--extra-keys",
40+
"metadata.kernelspec metadata.language_info",
41+
]
3542

36-
- repo: https://github.com/asottile/pyupgrade
37-
rev: "v3.15.0"
38-
hooks:
39-
- id: pyupgrade
40-
args: ["--py38-plus"]
43+
- repo: https://github.com/astral-sh/ruff-pre-commit
44+
rev: "v0.1.13"
45+
hooks:
46+
- id: ruff
47+
args: ["--fix", "--show-fixes"]
48+
- id: ruff-format
4149

42-
- repo: https://github.com/psf/black
43-
rev: "23.12.1"
44-
hooks:
45-
- id: black-jupyter
50+
- repo: https://github.com/codespell-project/codespell
51+
rev: "v2.2.6"
52+
hooks:
53+
- id: codespell
54+
args: ["-L", "nd,unparseable,compiletime"]
4655

47-
- repo: https://github.com/pre-commit/mirrors-mypy
48-
rev: "v1.8.0"
49-
hooks:
50-
- id: mypy
51-
files: src
52-
stages: [manual]
56+
- repo: https://github.com/shellcheck-py/shellcheck-py
57+
rev: "v0.9.0.6"
58+
hooks:
59+
- id: shellcheck
5360

54-
- repo: https://github.com/hadialqattan/pycln
55-
rev: "v2.4.0"
56-
hooks:
57-
- id: pycln
58-
args: ["--all"]
61+
- repo: https://github.com/pre-commit/pygrep-hooks
62+
rev: "v1.10.0"
63+
hooks:
64+
- id: python-no-log-warn
65+
- id: rst-backticks
66+
- id: rst-directive-colons
67+
- id: rst-inline-touching-normal
5968

60-
- repo: https://github.com/PyCQA/flake8
61-
rev: "6.1.0"
62-
hooks:
63-
- id: flake8
64-
additional_dependencies: [
65-
flake8-bugbear>=23.1.17,
66-
flake8-print,
67-
# flake8-docstrings,
68-
pep8-naming
69-
]
70-
# args: ["--docstring-convention", "numpy"] # or google, change me
69+
- repo: https://github.com/pre-commit/mirrors-prettier
70+
rev: "v4.0.0-alpha.8"
71+
hooks:
72+
- id: prettier
73+
types_or: [yaml, markdown, html, css, scss, javascript, json]
74+
args: [--prose-wrap=always]
7175

72-
- repo: https://github.com/kynan/nbstripout
73-
rev: "0.6.1"
74-
hooks:
75-
- id: nbstripout
76-
args: ["--drop-empty-cells",
77-
"--extra-keys", "metadata.kernelspec metadata.language_info"]
76+
- repo: https://github.com/abravalheri/validate-pyproject
77+
rev: v0.15
78+
hooks:
79+
- id: validate-pyproject
7880

79-
- repo: https://github.com/mgedmin/check-manifest
80-
rev: "0.49"
81-
hooks:
82-
- id: check-manifest
83-
stages: [manual]
84-
85-
- repo: https://github.com/codespell-project/codespell
86-
rev: "v2.2.6"
87-
hooks:
88-
- id: codespell
89-
args: ["-L", "nd,unparseable,compiletime"]
90-
91-
- repo: https://github.com/shellcheck-py/shellcheck-py
92-
rev: "v0.9.0.6"
93-
hooks:
94-
- id: shellcheck
95-
96-
- repo: https://github.com/pre-commit/pygrep-hooks
97-
rev: "v1.10.0"
98-
hooks:
99-
- id: python-no-log-warn
100-
- id: rst-backticks
101-
- id: rst-directive-colons
102-
- id: rst-inline-touching-normal
103-
104-
- repo: https://github.com/pre-commit/mirrors-prettier
105-
rev: "v4.0.0-alpha.8"
106-
hooks:
107-
- id: prettier
108-
types_or: [json]
81+
- repo: https://github.com/python-jsonschema/check-jsonschema
82+
rev: 0.27.3
83+
hooks:
84+
- id: check-dependabot
85+
- id: check-github-workflows
86+
- id: check-readthedocs

.readthedocs.yaml

+2-7
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,8 @@ build:
1616
jobs:
1717
pre_build:
1818
- rm -rf docs/source/api
19-
- sphinx-apidoc
20-
--private
21-
--module-first
22-
--force
23-
--output-dir docs/source/api
24-
src/lgdo
25-
src/lgdo/_version.py
19+
- sphinx-apidoc --private --module-first --force --output-dir
20+
docs/source/api src/lgdo src/lgdo/_version.py
2621

2722
python:
2823
install:

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
![License](https://img.shields.io/github/license/legend-exp/legend-pydataobj)
1212
[![Read the Docs](https://img.shields.io/readthedocs/legend-pydataobj?logo=readthedocs)](https://legend-pydataobj.readthedocs.io)
1313

14-
This package provides a Python implementation of the LEGEND Data Objects (LGDO) and I/O
15-
to HDF5, including [Numba](https://numba.pydata.org/)-accelerated custom compression
16-
algorithms for particle detector signals. More documentation is available in the
14+
This package provides a Python implementation of the LEGEND Data Objects (LGDO)
15+
and I/O to HDF5, including [Numba](https://numba.pydata.org/)-accelerated custom
16+
compression algorithms for particle detector signals. More documentation is
17+
available in the
1718
[LEGEND data format specification](https://legend-exp.github.io/legend-data-format-specs).

codecov.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ coverage:
99
patch: false
1010

1111
github_checks:
12-
annotations: false
12+
annotations: false
1313

1414
ignore:
1515
- tests

docs/source/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Configuration file for the Sphinx documentation builder.
2+
from __future__ import annotations
23

34
import sys
45
from pathlib import Path

0 commit comments

Comments
 (0)