Skip to content

Commit

Permalink
Merge pull request #2 from andrewyng/change-formatter-to-black
Browse files Browse the repository at this point in the history
Updating the formatter to use Black instead of Ruff.

After a conversation with John and Ryan we felt it was better to use the more
established tool for formatting.

The PR:
- updates dependencies in the pyproject.toml
- updates the pre-commit config to use black
- adds the github action for linting checks
- adds the black badge on the README
  • Loading branch information
ksolo authored Jul 2, 2024
2 parents f761f24 + 1b7d4fc commit b7922f2
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 38 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
17 changes: 9 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.5.0
# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.2
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
- id: black
# It is recommended to specify the latest version of Python
# supported by your project here, or alternatively use
# pre-commit's default_language_version, see
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.11
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# aimodels
Simple, unified interface to multiple Generative AI providers

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
122 changes: 94 additions & 28 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
python-dotenv = "^1.0.1"


[tool.poetry.group.dev.dependencies]
pytest = "^8.2.2"
ruff = "^0.5.0"
pre-commit = "^3.7.1"
black = "^24.4.2"
python-dotenv = "^1.0.1"

[build-system]
requires = ["poetry-core"]
Expand Down

0 comments on commit b7922f2

Please sign in to comment.