Skip to content

Commit

Permalink
Updates from package template (#261)
Browse files Browse the repository at this point in the history
Co-authored-by: Nabil Freij <[email protected]>
  • Loading branch information
Cadair and nabobalis authored Nov 11, 2024
1 parent a28532a commit 2cb2d2a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 60 deletions.
4 changes: 2 additions & 2 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/sunpy/package-template",
"commit": "4ca8e60aac805d5f736de80c45ae0aba96b4cb85",
"commit": "51fb616094a4d7577c8898445aa50effb89afa31",
"checkout": null,
"context": {
"cookiecutter": {
Expand All @@ -16,7 +16,7 @@
"enable_dynamic_dev_versions": "y",
"include_example_code": "n",
"include_cruft_update_github_workflow": "y",
"use_extended_ruff_linting": "y",
"use_extended_ruff_linting": "n",
"_sphinx_theme": "sunpy",
"_parent_project": "",
"_install_requires": "",
Expand Down
51 changes: 20 additions & 31 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,41 +1,30 @@
repos:
# This should be before any formatting hooks like isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.7.1"
rev: "v0.7.2"
hooks:
- id: ruff
args: ["--fix"]
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: autoflake
args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable']
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|__init__.py|docs/conf.py)$"
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black
exclude: ".*(.fits|.fts|.fit|.txt|.csv)$"
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
exclude: ".*(.fits|.fts|.fit|.txt|.csv)$"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: trailing-whitespace
exclude: ".*(.fits|.fts|.fit|.header|.txt)$"
- id: check-yaml
- id: debug-statements
- id: check-added-large-files
args: [ "--enforce-all", "--maxkb=1054" ]
- id: end-of-file-fixer
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|.json)$|^CITATION.rst$"
- id: mixed-line-ending
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*)$"
- id: isort
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|extern.*|{{ cookiecutter.module_name }}/extern)$"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: trailing-whitespace
exclude: ".*(.fits|.fts|.fit|.header|.txt)$"
- id: check-yaml
- id: debug-statements
- id: check-added-large-files
args: ["--enforce-all", "--maxkb=1054"]
- id: end-of-file-fixer
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|.json)$|^CITATION.rst$"
- id: mixed-line-ending
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*)$"
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
Expand Down
35 changes: 11 additions & 24 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,28 @@ select = [
"W",
"UP",
"PT",
"BLE",
"A",
"C4",
"INP",
"PIE",
"T20",
"RET",
"TID",
"PTH",
"PD",
"PLC",
"PLE",
"FLY",
"NPY",
"PERF",
"RUF",
]
extend-ignore = [
# pycodestyle (E, W)
# pycodestyle
"E501", # ignore line length will use a formatter instead
# pyupgrade (UP)
"E712", # Avoid equality comparisons to True; use if {cond}: for truth checks
"E721", # type comparison Use is and is not for type comparisons, or isinstance() for isinstance checks
# upgrades
"UP038", # Use | in isinstance - not compatible with models and is slower
# pytest (PT)
"PT001", # Always use pytest.fixture()
"PT004", # Fixtures which don't return anything should have leading _
"PT011", # except(ValueRaises) is too broad
"PT023", # Always use () on pytest decorators
# flake8-pie (PIE)
# flake8-pie
"PIE808", # Disallow passing 0 as the first argument to range
# flake8-use-pathlib (PTH)
# flake8-use-pathlib
"PTH123", # open() should be replaced by Path.open()
# Ruff (RUF)
# Ruff
"RUF003", # Ignore ambiguous quote marks, doesn't allow ' in comments
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"RUF013", # PEP 484 prohibits implicit `Optional`
"RUF015", # Prefer `next(iter(...))` over single element slice
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"RUF013", # PEP 484 prohibits implicit `Optional`
"RUF015", # Prefer `next(iter(...))` over single element slice
]

[lint.per-file-ignores]
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ docs = [
"sphinx-automodapi",
"sunpy-sphinx-theme",
"packaging",
"sphinx_automodapi",
"sphinx-changelog",
"sphinx-gallery",
"sunpy-sphinx-theme"
]

[project.urls]
repository = "https://sunpy.org"

Expand Down
2 changes: 1 addition & 1 deletion sunraster/_dev/scm_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
try:
from setuptools_scm import get_version

version = get_version(root=Path("../.."), relative_to=__file__)
version = get_version(root=Path('../..'), relative_to=__file__)
except ImportError:
raise
except Exception as e:
Expand Down

0 comments on commit 2cb2d2a

Please sign in to comment.