Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove black and isort, use ruff only #517

Merged
merged 3 commits into from
Sep 24, 2024
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
38 changes: 0 additions & 38 deletions .github/workflows/black.yml

This file was deleted.

7 changes: 5 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- master
- main
paths:
- "**.go"
- "go/go.mod"
Expand All @@ -13,7 +12,11 @@ on:
pull_request:
branches:
- master
- main
paths:
- "**.go"
- "go/go.mod"
- "go/go.sum"
- ".github/workflows/go.yml"

# Cancel previous runs for PRs but not pushes to main
concurrency:
Expand Down
37 changes: 0 additions & 37 deletions .github/workflows/isort.yml

This file was deleted.

19 changes: 12 additions & 7 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: Python ruff
name: Python

# Run either when pushing directly to main/master or in a PR targeting main/master
on:
push:
branches:
- master
- main
paths:
- ".github/workflows/ruff.yml"
- "**.py"
Expand All @@ -30,9 +29,15 @@ jobs:
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"

- name: ruff
uses: chartboost/ruff-action@v1
with:
src: "./python"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff

- name: Ruff lint
run: ruff check --output-format=github ./python

- name: Ruff format
run: ruff format --check --verbose ./python
17 changes: 4 additions & 13 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,20 @@ pip-compile setup.py

## Code formatting and linting

Code formatting with [Black](https://github.com/psf/black).
Import sorting with [isort](https://github.com/PyCQA/isort).
Linting with [ruff](https://github.com/charliermarsh/ruff).
Code formatting and linting with [ruff](https://github.com/charliermarsh/ruff).

These are configured with a custom line length limit of 120.
The configs can be found in [pyproject.toml](./pyproject.toml).

Usage:

```shell
black .
isort .
ruff --fix .
ruff format
ruff check --fix
```

These can also be integrated to IDEs / editors or run as a pre-commit hook.
See the documentation for Black [here](https://black.readthedocs.io/en/stable/integrations/editors.html).
Visual Studio Code has built-in support for
[Black](https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter)
and
[isort](https://marketplace.visualstudio.com/items?itemName=ms-python.isort)
through official plugins.
There is also a [Ruff extension](https://github.com/charliermarsh/ruff-vscode) for VS Code.
See the documentation for the [Ruff extension](https://github.com/astral-sh/ruff-vscode) for VS Code.

Using with [pre-commit](https://pre-commit.com/) (run from repo root):

Expand Down
1 change: 1 addition & 0 deletions python/n_vault/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
Vault module for securely storing secrets in s3 with local encryption with data keys from AWS KMS
"""

import sys
from os import environ

Expand Down
Loading