Skip to content

Commit 0402e74

Browse files
committed
CI: repository configuration
1 parent f077c73 commit 0402e74

File tree

4 files changed

+208
-253
lines changed

4 files changed

+208
-253
lines changed

.pre-commit-config.yaml

Lines changed: 14 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,23 @@
1-
ci:
2-
autoupdate_commit_msg: "chore: update pre-commit hooks"
3-
autofix_commit_msg: "style: pre-commit fixes"
4-
5-
exclude: ^.cruft.json|.copier-answers.yml$
6-
71
repos:
8-
- repo: https://github.com/adamchainz/blacken-docs
9-
rev: "1.19.1"
10-
hooks:
11-
- id: blacken-docs
12-
additional_dependencies: [black==24.*]
13-
142
- repo: https://github.com/pre-commit/pre-commit-hooks
15-
rev: "v6.0.0"
3+
rev: v5.0.0
164
hooks:
175
- id: check-added-large-files
18-
- id: check-case-conflict
19-
- id: check-merge-conflict
20-
- id: check-symlinks
216
- id: check-yaml
22-
- id: debug-statements
23-
- id: end-of-file-fixer
24-
- id: mixed-line-ending
25-
- id: name-tests-test
26-
args: ["--pytest-test-first"]
27-
- id: requirements-txt-fixer
28-
- id: trailing-whitespace
29-
30-
- repo: https://github.com/pre-commit/pygrep-hooks
31-
rev: "v1.10.0"
32-
hooks:
33-
- id: rst-backticks
34-
- id: rst-directive-colons
35-
- id: rst-inline-touching-normal
36-
37-
- repo: https://github.com/rbubley/mirrors-prettier
38-
rev: "v3.6.2"
39-
hooks:
40-
- id: prettier
41-
types_or: [yaml, markdown, html, css, scss, javascript, json]
42-
args: [--prose-wrap=always]
43-
44-
- repo: https://github.com/astral-sh/ruff-pre-commit
45-
rev: "v0.12.12"
46-
hooks:
47-
- id: ruff-check
48-
args: ["--fix", "--show-fixes"]
49-
- id: ruff-format
50-
51-
- repo: https://github.com/pre-commit/mirrors-mypy
52-
rev: "v1.17.1"
53-
hooks:
54-
- id: mypy
55-
files: src|tests
56-
args: []
57-
additional_dependencies:
58-
- pytest
59-
60-
- repo: https://github.com/codespell-project/codespell
61-
rev: "v2.4.1"
62-
hooks:
63-
- id: codespell
64-
additional_dependencies:
65-
- tomli; python_version<'3.11'
66-
67-
- repo: https://github.com/shellcheck-py/shellcheck-py
68-
rev: "v0.11.0.1"
69-
hooks:
70-
- id: shellcheck
7+
- id: check-merge-conflict
718

729
- repo: local
7310
hooks:
74-
- id: disallow-caps
75-
name: Disallow improper capitalization
76-
language: pygrep
77-
entry: PyBind|Numpy|Cmake|CCache|Github|PyTest
78-
exclude: .pre-commit-config.yaml
79-
80-
- repo: https://github.com/abravalheri/validate-pyproject
81-
rev: "v0.24.1"
82-
hooks:
83-
- id: validate-pyproject
84-
additional_dependencies: ["validate-pyproject-schema-store[all]"]
11+
- id: ruff
12+
name: lint with ruff
13+
language: system
14+
entry: ruff check --force-exclude --fix
15+
types: [python]
16+
require_serial: true
8517

86-
- repo: https://github.com/python-jsonschema/check-jsonschema
87-
rev: "0.33.3"
88-
hooks:
89-
- id: check-dependabot
90-
- id: check-github-workflows
91-
- id: check-readthedocs
18+
- id: ruff-format
19+
name: format with ruff
20+
language: system
21+
entry: ruff format --force-exclude
22+
types: [python]
23+
require_serial: true

noxfile.py

Lines changed: 0 additions & 109 deletions
This file was deleted.

pyproject.toml

Lines changed: 38 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
[build-system]
2-
requires = ["setuptools>=77", "setuptools_scm[toml]>=7"]
2+
requires = ["setuptools>=77", "setuptools_scm[toml]>=8"]
33
build-backend = "setuptools.build_meta"
44

55

66
[project]
77
name = "save-and-restore-api"
8-
authors = [
9-
{ name = "My Name", email = "[email protected]" },
10-
]
118
description = "Python package for communication with CS Studio save-and-restore service"
129
readme = "README.md"
1310
license = "BSD-3-Clause"
@@ -18,9 +15,6 @@ classifiers = [
1815
"Intended Audience :: Science/Research",
1916
"Intended Audience :: Developers",
2017
"Operating System :: OS Independent",
21-
"Programming Language :: Python",
22-
"Programming Language :: Python :: 3",
23-
"Programming Language :: Python :: 3 :: Only",
2418
"Programming Language :: Python :: 3.9",
2519
"Programming Language :: Python :: 3.10",
2620
"Programming Language :: Python :: 3.11",
@@ -30,14 +24,16 @@ classifiers = [
3024
"Typing :: Typed",
3125
]
3226
dynamic = ["version"]
33-
dependencies = []
27+
28+
[project.scripts]
29+
save-and-restore-upload = "save_and_restore_api.tools.upload:main"
3430

3531
[project.urls]
3632
Homepage = "https://github.com/dmgav/save-and-restore-api"
37-
"Bug Tracker" = "https://github.com/dmgav/save-and-restore-api/issues"
38-
Discussions = "https://github.com/dmgav/save-and-restore-api/discussions"
39-
Changelog = "https://github.com/dmgav/save-and-restore-api/releases"
4033

34+
dependencies = [
35+
"httpx",
36+
]
4137

4238
[dependency-groups]
4339
test = [
@@ -62,15 +58,20 @@ write_to = "src/save_and_restore_api/_version.py"
6258

6359
[tool.pytest.ini_options]
6460
minversion = "6.0"
65-
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
66-
xfail_strict = true
61+
# Run pytest with all our checkers, and don't spam us with massive tracebacks on error
62+
# Don't collect the interactive directory which is intended for manual execution
63+
addopts = """
64+
--tb=native -vv --doctest-modules --doctest-glob="*.rst" --ignore src/bluesky/tests/interactive
65+
"""
66+
# https://iscinumpy.gitlab.io/post/bound-version-constraints/#watch-for-warnings
6767
filterwarnings = [
68-
"error",
69-
]
70-
log_cli_level = "INFO"
71-
testpaths = [
72-
"tests",
68+
"error",
69+
"ignore::PendingDeprecationWarning",
70+
"ignore::UserWarning",
71+
"ignore::DeprecationWarning",
7372
]
73+
# Doctest python code in docs, python code in src docstrings, test functions in tests
74+
testpaths = "src/save_and_restore_api/tests"
7475

7576

7677
[tool.coverage]
@@ -95,56 +96,31 @@ module = "save_and_restore_api.*"
9596
disallow_untyped_defs = true
9697
disallow_incomplete_defs = true
9798

98-
9999
[tool.ruff]
100+
src = ["src", "tests"]
101+
line-length = 115
102+
exclude = [
103+
"docs/source/conf.py",
104+
"docs/source/examples",
105+
]
100106

101107
[tool.ruff.lint]
102108
extend-select = [
103-
"ARG", # flake8-unused-arguments
104-
"B", # flake8-bugbear
105-
"C4", # flake8-comprehensions
106-
"EM", # flake8-errmsg
107-
"EXE", # flake8-executable
108-
"G", # flake8-logging-format
109-
"I", # isort
110-
"ICN", # flake8-import-conventions
111-
"NPY", # NumPy specific rules
112-
"PD", # pandas-vet
113-
"PGH", # pygrep-hooks
114-
"PIE", # flake8-pie
115-
"PL", # pylint
116-
"PT", # flake8-pytest-style
117-
"PTH", # flake8-use-pathlib
118-
"RET", # flake8-return
119-
"RUF", # Ruff-specific
120-
"SIM", # flake8-simplify
121-
"T20", # flake8-print
122-
"UP", # pyupgrade
123-
"YTT", # flake8-2020
109+
"B", # flake8-bugbear - https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
110+
"C4", # flake8-comprehensions - https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
111+
"E", # pycodestyle errors - https://docs.astral.sh/ruff/rules/#error-e
112+
"F", # pyflakes rules - https://docs.astral.sh/ruff/rules/#pyflakes-f
113+
"W", # pycodestyle warnings - https://docs.astral.sh/ruff/rules/#warning-w
114+
"I", # isort - https://docs.astral.sh/ruff/rules/#isort-i
115+
"UP", # pyupgrade - https://docs.astral.sh/ruff/rules/#pyupgrade-up
124116
]
125117
ignore = [
126-
"PLR09", # Too many <...>
127-
"PLR2004", # Magic value used in comparison
128118
]
129-
isort.required-imports = ["from __future__ import annotations"]
130-
# Uncomment if using a _compat.typing backport
131-
# typing-modules = ["save_and_restore_api._compat.typing"]
119+
isort.required-imports = [
120+
]
132121

133122
[tool.ruff.lint.per-file-ignores]
134-
"tests/**" = ["T20"]
135-
"noxfile.py" = ["T20"]
136-
137-
138-
[tool.pylint]
139-
py-version = "3.9"
140-
ignore-paths = [".*/_version.py"]
141-
reports.output-format = "colorized"
142-
similarities.ignore-imports = "yes"
143-
messages_control.disable = [
144-
"design",
145-
"fixme",
146-
"line-too-long",
147-
"missing-module-docstring",
148-
"missing-function-docstring",
149-
"wrong-import-position",
150-
]
123+
# By default, private member access is allowed in tests
124+
# See https://github.com/DiamondLightSource/python-copier-template/issues/154
125+
# Remove this line to forbid private member access in tests
126+
"tests/**/*" = ["SLF001"]

0 commit comments

Comments
 (0)