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
49 changes: 0 additions & 49 deletions .github/workflows/code-style.yaml

This file was deleted.

18 changes: 6 additions & 12 deletions .pre-commit-config.yaml
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,26 @@
ci:
skip: [codespell, pydocstyle, yamllint]

repos:
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
files: template

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.0
hooks:
- id: black
args: [--quiet]
files: template

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.8
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
name: ruff linter
args: [--fix]
files: template
- id: ruff-format
name: ruff formatter
files: template

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args: [--check-filenames, --ignore-words=.codespellignore]
args: [--write-changes]

- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![codecov](https://codecov.io/gh/mscheltienne/template-python/branch/main/graph/badge.svg?token=KRYRRUXDYY)](https://codecov.io/gh/mscheltienne/template-python)
Expand Down
32 changes: 16 additions & 16 deletions pyproject.toml
Original file line numberDiff line numberDiff line change
Expand Up@@ -63,10 +63,14 @@ doc = [
full = [
'template[all]',
]
stubs = [
'isort',
'mypy',
'ruff',
]
style = [
'bibclean',
'black',
'codespell',
'codespell[toml]>=2.2.4',
'isort',
'pydocstyle[toml]',
'ruff',
Expand All@@ -88,20 +92,11 @@ homepage = 'https://github.com/mscheltienne/template-python'
source = 'https://github.com/mscheltienne/template-python'
tracker = 'https://github.com/mscheltienne/template-python/issues'

[tool.black]
extend-exclude = '''
(
__pycache__
| .github
| setup.py
| doc/
| examples/
| tutorials/
)
'''
include = '\.pyi?$'
line-length = 88
target-version = ['py39']
[tool.codespell]
check-filenames = true
check-hidden = true
ignore-words = '.codespellignore'
skip = 'build,.git,.mypy_cache,.pytest_cache'

[tool.coverage.report]
exclude_lines = [
Expand DownExpand Up@@ -152,6 +147,11 @@ extend-exclude = [
'setup.py',
]
line-length = 88
select = ["E", "F", "W"]
target-version = 'py39'

[tool.ruff.format]
docstring-code-format = true

[tool.ruff.per-file-ignores]
'__init__.py' = ['F401']
Expand Down
12 changes: 5 additions & 7 deletions template/utils/_docs.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,9 +16,7 @@
docdict: dict[str, str] = dict()

# ---------------------------------- verbose ---------------------------------
docdict[
"verbose"
] = """
docdict["verbose"] = """
verbose : int | str | bool | None
Sets the verbosity level. The verbosity increases gradually between ``"CRITICAL"``,
``"ERROR"``, ``"WARNING"``, ``"INFO"`` and ``"DEBUG"``. If None is provided, the
Expand DownExpand Up@@ -75,16 +73,16 @@ def fill_doc(f: Callable[..., Any]) -> Callable[..., Any]:
def _indentcount_lines(lines: list[str]) -> int:
"""Minimum indent for all lines in line list.

>>> lines = [' one', ' two', ' three']
>>> lines = [" one", " two", " three"]
>>> indentcount_lines(lines)
1
>>> lines = []
>>> indentcount_lines(lines)
0
>>> lines = [' one']
>>> lines = [" one"]
>>> indentcount_lines(lines)
1
>>> indentcount_lines([''])
>>> indentcount_lines([""])
0
"""
indent = sys.maxsize
Expand DownExpand Up@@ -125,7 +123,7 @@ def copy_doc(source: Callable[..., Any]) -> Callable[..., Any]:
>>> class B(A):
... @copy_doc(A.m1)
... def m1():
... '''this gets appended'''
... '''this gets appended'''
... pass
>>> print(B.m1.__doc__)
Docstring for m1 this gets appended
Expand Down
2 changes: 1 addition & 1 deletion template/utils/logs.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -82,7 +82,7 @@ def set_log_level(verbose: Optional[Union[bool, str, int]]) -> None:


class _LoggerFormatter(logging.Formatter):
"""Format string Syntax."""
"""Format string syntax."""

# Format string syntax for the different Log levels
_formatters = dict()
Expand Down