Skip to content

Commit

Permalink
ruff format, support numpy 2, remove Python 3.8 (#56)
Browse files Browse the repository at this point in the history
* Use ruff formatter as pre-commit

* Add missing pyproject.toml settings

* Support numpy 2.0

* Update docstrings

* Fix remaining numpy2 issues

* Require numpy>=2.0.0 for tests

* Remove support for Python 3.8
  • Loading branch information
hagenw authored Jun 18, 2024
1 parent 33be05c commit 387e573
Show file tree
Hide file tree
Showing 21 changed files with 646 additions and 669 deletions.
10 changes: 0 additions & 10 deletions .flake8

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.10'

- name: Install pre-commit hooks
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macOS-latest]
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
python-version: [ '3.9', '3.10', '3.11', '3.12' ]

steps:

Expand Down
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
#
#
default_language_version:
python: python3.8
python: python3.10

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.276
rev: v0.1.8
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
Expand Down
9 changes: 5 additions & 4 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Coding Convention
-----------------

We follow the PEP8_ convention for Python code
and check for correct syntax with ruff_.
and use ruff_ as a linter and code formatter.
In addition,
we check for common spelling errors with codespell_.
Both tools and possible exceptions
Expand All @@ -61,13 +61,14 @@ You can also install ruff_ and codespell_
and call it directly::

pip install ruff codespell # consider system wide installation
ruff check .
ruff check --fix . # lint all Python files, and fix any fixable errors
ruff format . # format code of all Python files
codespell

It can be restricted to specific folders::

ruff check audfoo/ tests/
codespell audfoo/ tests/
ruff check audmath/ tests/
codespell audmath/ tests/


.. _codespell: https://github.com/codespell-project/codespell/
Expand Down
1 change: 1 addition & 0 deletions audmath/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# Dynamically get the version of the installed module
try:
import importlib.metadata

__version__ = importlib.metadata.version(__name__)
except Exception: # pragma: no cover
importlib = None # pragma: no cover
Expand Down
Loading

0 comments on commit 387e573

Please sign in to comment.