Skip to content

Commit

Permalink
Update ruff to latest and add formatter (#174)
Browse files Browse the repository at this point in the history
* WIP

* WIP

* fix lint and llm

* update changelog

* fix llm

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* fix verbose
  • Loading branch information
gsheni authored Dec 22, 2023
1 parent 3eca6a8 commit 61cefb0
Show file tree
Hide file tree
Showing 31 changed files with 443 additions and 572 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python_version: ["3.8", "3.11"]
python_version: ["3.8", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- name: Set up python ${{ matrix.python_version }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: Lint Check
on: [pull_request]
jobs:
lint_check:
name: 3.11 lint check
name: 3.12 lint check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'
- name: Install package with dev deps
run: |
python -m pip install -e ".[dev]"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test_without_dev_deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ on:
workflow_dispatch:
jobs:
tests:
name: 3.11 test
name: 3.12 test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up python 3.11
- name: Set up python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: 3.12
cache: 'pip'
cache-dependency-path: "pyproject.toml"
- name: Build trane and install latest requirements
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.11"]
type-of-tests: ["unit", "integration"]
exclude:
- python-version: "3.8"
type-of-tests: "integration"
python-version: ["3.8", "3.12"]
type-of-tests: ["unit"]
steps:
- uses: actions/checkout@v3
- name: Set up python ${{ matrix.python-version }}
Expand All @@ -40,12 +37,11 @@ jobs:
if: (steps.cache.outputs.cache-hit == 'true') && ( github.event.pull_request.title != 'Automated Latest Dependency Updates')
run: python -m pip install --no-dependencies .
- name: Run unit tests
if: ${{ matrix.type-of-tests != 'integration' }}
run: |
make clean
make unit-tests
- name: Upload code coverage report
if: ${{ matrix.type-of-tests == 'unit' && matrix.python-version == '3.11' }}
if: ${{ matrix.type-of-tests == 'unit' && matrix.python-version == '3.12' }}
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
15 changes: 6 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,15 @@ repos:
hooks:
- id: add-trailing-comma
name: Add trailing comma
- repo: https://github.com/python/black
rev: 23.10.1
hooks:
- id: black
additional_dependencies: [".[jupyter]"]
types_or: [python, jupyter]
args:
- --config=./pyproject.toml
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.4
rev: v0.1.8
hooks:
- id: ruff
types_or: [ python, pyi, jupyter ]
args:
- --fix
- --config=./pyproject.toml
- id: ruff-format
types_or: [ python, pyi, jupyter ]
args:
- --config=./pyproject.toml
15 changes: 6 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ clean:
find . -name '*~' -delete
find . -name '.coverage.*' -delete

LINT_CONFIG = trane/ tests/ --config=./pyproject.toml
.PHONY: lint
lint:
black trane/ tests/ --check --config=./pyproject.toml
ruff trane/ tests/ --config=./pyproject.toml
ruff check $(LINT_CONFIG)
ruff format --check $(LINT_CONFIG)

.PHONY: lint-fix
lint-fix:
black trane/ tests/ --config=./pyproject.toml
ruff trane/ tests/ --fix --config=./pyproject.toml
ruff check --fix $(LINT_CONFIG)
ruff format $(LINT_CONFIG)

.PHONY: installdeps-dev
installdeps-dev:
Expand All @@ -38,11 +39,7 @@ tests:

.PHONY: unit-tests
unit-tests:
$(PYTEST) tests/ --ignore=tests/integration_tests $(COVERAGE)

.PHONY: integration-tests
integration-tests:
$(PYTEST) tests/integration_tests
$(PYTEST) tests/ $(COVERAGE)

.PHONY: upgradepip
upgradepip:
Expand Down
11 changes: 11 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

Changelog
---------
v0.8.0 (December X, X)
=========================
* Enhancements
* Update LLM helper to support updated GPT-4 models [#174][#174]
* Update ruff to latest and remove black as a development dependency [#174][#174]
* Add Python 3.11 markers and CI testing [#174][#174]
* Fixes
*

[#174]: <https://github.com/trane-dev/Trane/pull/174>

v0.7.0 (October 21, 2023)
=========================
* Enhancements
Expand Down
23 changes: 11 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: Unix",
Expand Down Expand Up @@ -55,13 +56,12 @@ test = [
"pytest-runner >= 2.11.1",
]
dev = [
"ruff >= 0.1.0" ,
"black[jupyter] >= 22.12.0",
"pre-commit == 2.20.0",
"toml >= 0.10.2",
"ruff >= 0.1.8" ,
"pre-commit >= 3.6.0",
]
llm = [
"openai >= 0.28.1",
"openai >= 1.3.7",
"anthropic >= 0.7.7",
"tiktoken >= 0.5.1",
]

Expand Down Expand Up @@ -128,17 +128,10 @@ requires = [
]
build-backend = "setuptools.build_meta"

[tool.black]
line-length = 88
target-version = ["py311"]

[tool.ruff]
preview = true
line-length = 88
ignore = ["E501"]
exclude = [
"Examples",
]
select = [
# Pyflakes
"F",
Expand All @@ -151,9 +144,15 @@ select = [
"I001"
]
src = ["trane"]
target-version = "py312"

[tool.ruff.isort]
known-first-party = ["trane"]

[tool.ruff.per-file-ignores]
"__init__.py" = ["F401", "E402", "F403", "F405", "E501", "I001"]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
preview = true
Empty file.
29 changes: 0 additions & 29 deletions tests/integration_tests/test_examples.py

This file was deleted.

152 changes: 0 additions & 152 deletions tests/integration_tests/utils.py

This file was deleted.

Loading

0 comments on commit 61cefb0

Please sign in to comment.