Skip to content

Commit

Permalink
Merge pull request #126 from sanders41/ruff-formatter
Browse files Browse the repository at this point in the history
Switch from black to ruff formatting
  • Loading branch information
sanders41 authored Oct 26, 2023
2 parents 84496b9 + 1ceb033 commit d9a744f
Show file tree
Hide file tree
Showing 4 changed files with 264 additions and 357 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,23 @@ For package managment choose between:

Dev packages:

- [black](https://github.com/psf/black) for code formatting
- [mypy](https://www.mypy-lang.org/) for static type checking
- [pre-commit](https://github.com/pre-commit/pre-commit) for pre-commit hooks
- [pytest](https://docs.pytest.org/en/latest/) for testing
- [pytest-cov](https://github.com/pytest-dev/pytest-cov) for test coverage reports
- [ruff](https://beta.ruff.rs/docs/) for linting
- [ruff](https://beta.ruff.rs/docs/) for linting and code formatting

## Python project with Rust modules included packages

- [maturin](https://github.com/PyO3/maturin) for package management
- [black](https://github.com/psf/black) for code formatting
- [mypy](https://www.mypy-lang.org/) for static type checking
- [pre-commit](https://github.com/pre-commit/pre-commit) for pre-commit hooks
- [pytest](https://docs.pytest.org/en/latest/) for testing
- [pytest-cov](https://github.com/pytest-dev/pytest-cov) for test coverage reports
- [ruff](https://beta.ruff.rs/docs/) for linting
- [ruff](https://beta.ruff.rs/docs/) for linting and code formatting
- [PyO3](https://github.com/PyO3/pyo3) for managing the Rust/Python FFI
- [justfile](https://github.com/casey/just) for running commands (to use this you will need to
install just)
install just)

## Installation

Expand Down
48 changes: 24 additions & 24 deletions src/github_actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ jobs:
cache: "poetry"
- name: Install Dependencies
run: poetry install
- name: Black check
run: poetry run black {source_dir} tests --check
- name: Ruff format check
run: poetry run ruff format {source_dir} tests --check
- name: Lint with ruff
run: poetry run ruff check .
- name: mypy check
Expand Down Expand Up @@ -106,8 +106,8 @@ jobs:
run: |
python -m pip install -U pip
python -m pip install -r requirements-dev.txt
- name: Black check
run: black {source_dir} tests --check
- name: Ruff format check
run: ruff format {source_dir} tests --check
- name: Lint with ruff
run: ruff check .
- name: mypy check
Expand Down Expand Up @@ -195,8 +195,8 @@ jobs:
python -m pip install -e .
maturin build --out dist
python -m pip install --no-index --find-links=dist/ prelude-parser
- name: Black check
run: black {source_dir} tests --check
- name: Ruff format check
run: ruff format {source_dir} tests --check
- name: Lint with ruff
run: ruff check .
- name: mypy check
Expand Down Expand Up @@ -287,8 +287,8 @@ jobs:
cache: "poetry"
- name: Install Dependencies
run: poetry install
- name: Black check
run: poetry run black {source_dir} tests --check
- name: Ruff format check
run: poetry run ruff format {source_dir} tests --check
- name: Lint with ruff
run: poetry run ruff check .
- name: mypy check
Expand Down Expand Up @@ -350,8 +350,8 @@ jobs:
run: |
python -m pip install -U pip
python -m pip install -r requirements-dev.txt
- name: Black check
run: black {source_dir} tests --check
- name: Ruff format check
run: ruff format {source_dir} tests --check
- name: Lint with ruff
run: ruff check .
- name: mypy check
Expand Down Expand Up @@ -440,8 +440,8 @@ jobs:
python -m pip install -e .
maturin build --out dist
python -m pip install --no-index --find-links=dist/ prelude-parser
- name: Black check
run: black {source_dir} tests --check
- name: Ruff format check
run: ruff format {source_dir} tests --check
- name: Lint with ruff
run: ruff check .
- name: mypy check
Expand Down Expand Up @@ -978,8 +978,8 @@ jobs:
cache: "poetry"
- name: Install Dependencies
run: poetry install
- name: Black check
run: poetry run black {} tests --check
- name: Ruff format check
run: poetry run ruff format {} tests --check
- name: Lint with ruff
run: poetry run ruff check .
- name: mypy check
Expand Down Expand Up @@ -1080,8 +1080,8 @@ jobs:
python -m pip install -e .
maturin build --out dist
python -m pip install --no-index --find-links=dist/ prelude-parser
- name: Black check
run: black {} tests --check
- name: Ruff format check
run: ruff format {} tests --check
- name: Lint with ruff
run: ruff check .
- name: mypy check
Expand Down Expand Up @@ -1151,8 +1151,8 @@ jobs:
run: |
python -m pip install -U pip
python -m pip install -r requirements-dev.txt
- name: Black check
run: black {} tests --check
- name: Ruff format check
run: ruff format {} tests --check
- name: Lint with ruff
run: ruff check .
- name: mypy check
Expand Down Expand Up @@ -1223,8 +1223,8 @@ jobs:
cache: "poetry"
- name: Install Dependencies
run: poetry install
- name: Black check
run: poetry run black {} tests --check
- name: Ruff format check
run: poetry run ruff format {} tests --check
- name: Lint with ruff
run: poetry run ruff check .
- name: mypy check
Expand Down Expand Up @@ -1296,8 +1296,8 @@ jobs:
run: |
python -m pip install -U pip
python -m pip install -r requirements-dev.txt
- name: Black check
run: black {} tests --check
- name: Ruff format check
run: ruff format {} tests --check
- name: Lint with ruff
run: ruff check .
- name: mypy check
Expand Down Expand Up @@ -1396,8 +1396,8 @@ jobs:
python -m pip install -e .
maturin build --out dist
python -m pip install --no-index --find-links=dist/ prelude-parser
- name: Black check
run: black {} tests --check
- name: Ruff format check
run: ruff format {} tests --check
- name: Lint with ruff
run: ruff check .
- name: mypy check
Expand Down
1 change: 0 additions & 1 deletion src/package_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use anyhow::Result;

#[derive(Debug)]
pub enum PreCommitHook {
Black,
PreCommit,
MyPy,
Ruff,
Expand Down
Loading

0 comments on commit d9a744f

Please sign in to comment.