diff --git a/.gitattributes b/.gitattributes index 4024b250..f4c7e5f0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1 @@ *.ipynb linguist-language=Python -spopt/_version.py export-subst diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 68ef4864..dcd9508d 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -5,7 +5,5 @@ Thank you for your interest in contributing! We work primarily on Github. Please ## Style and format -This project utilizes: -* [`black`](https://black.readthedocs.io/en/stable/) for formatting; -* [`ruff`](https://docs.astral.sh/ruff/) for linting; and -* [`pre-commit`](https://pre-commit.com) to check format and lint on commits prior to pull requests being made. \ No newline at end of file +1. At the time of this writing, Python 3.10, 3.11, and 3.12 are the officially supported versions. +2. This project implements the linting and formatting conventions of [`ruff`](https://docs.astral.sh/ruff/) on all incoming Pull Requests. To ensure a PR is properly linted and formatted prior to creating a Pull Request, [install `pre-commit`](https://pre-commit.com/#installation) in your development environment and then [set up the configuration of pre-commit hooks](https://pre-commit.com/#3-install-the-git-hook-scripts). diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e6bc8774..4360d0a2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,14 +1,10 @@ files: "spopt\/" repos: - - repo: https://github.com/psf/black - rev: "23.11.0" - hooks: - - id: black - language_version: python3 - repo: https://github.com/astral-sh/ruff-pre-commit rev: "v0.1.6" hooks: - id: ruff + - id: ruff-format ci: autofix_prs: false diff --git a/README.md b/README.md index 485022c9..4949a175 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ [![codecov](https://codecov.io/gh/pysal/spopt/branch/main/graph/badge.svg)](https://codecov.io/gh/pysal/spopt) [![Documentation](https://img.shields.io/static/v1.svg?label=docs&message=current&color=9cf)](http://pysal.org/spopt/) [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) -[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +[![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) [![status](https://joss.theoj.org/papers/1413cf2c0cf3c561386949f2e1208563/status.svg)](https://joss.theoj.org/papers/1413cf2c0cf3c561386949f2e1208563) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4444156.svg)](https://doi.org/10.5281/zenodo.4444156) diff --git a/pyproject.toml b/pyproject.toml index 55394578..f07c3166 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,7 +54,7 @@ tests = [ "pytest-cov", "pytest-xdist", ] -dev = ["pre-commit"] +dev = ["pre-commit", "ruff"] docs = [ "nbsphinx", "numpydoc", @@ -79,13 +79,9 @@ notebooks = [ [tool.setuptools.packages.find] include = ["spopt", "spopt.*"] -[tool.black] -line-length = 88 - [tool.ruff] line-length = 88 select = ["E", "F", "W", "I", "UP", "N", "B", "A", "C4", "SIM", "ARG"] -target-version = "py310" exclude = ["spopt/tests/*", "docs/*"] [tool.ruff.per-file-ignores] diff --git a/spopt/region/azp_util.py b/spopt/region/azp_util.py index 25ae01a8..a270119b 100755 --- a/spopt/region/azp_util.py +++ b/spopt/region/azp_util.py @@ -8,7 +8,11 @@ class AllowMoveStrategy(abc.ABC): def start_new_component( - self, initial_labels, attr, objective_func, comp_idx # noqa: ARG002 + self, + initial_labels, + attr, + objective_func, + comp_idx, # noqa: ARG002 ): """ This method should be called whenever a new connected component is