Skip to content

Commit

Permalink
Update isort with ruff #61
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludee committed Nov 27, 2024
1 parent bcc9406 commit b855f75
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/automated-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
matrix:
platform: [ubuntu-latest, windows-latest]
python-version: ['3.10']
tox-envs: [test]
tox-envs: [test, lint]
isMerge:
- ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
exclude:
Expand Down
41 changes: 41 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,44 @@ classifiers = [
dependencies = [
"stringcase ~=1.2.0",
]

lint = [
"ruff",
]

[tool.ruff]
builtins = ["ellipsis"]
target-version = "py38"

[tool.ruff.lint]
exclude = [
".eggs",
"doc",
"_typed_ops.pyi",
]
# E402: module level import not at top of file
# E501: line too long - let black worry about that
# E731: do not assign a lambda expression, use a def
# E741: ambiguous variable names
ignore = [
"E402",
"E501",
"E731",
"E741",
]
select = [
# Pyflakes
"F", # Pycodestyle
"E",
"W", # isort
"I", # Pyupgrade
"UP",
]

[tool.ruff.lint.per-file-ignores]
# F401: imported but unsued
"__init__.py" = ["F401"]

[tool.ruff.lint.isort]
known-first-party = ["pandas_indexing"]
lines-after-imports = 2
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ pytest
pytest-cov
tox
mike
ruff
54 changes: 4 additions & 50 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: MIT

[tox]
minversion = 3.25.0
minversion = 4.4.6
ignore_basepython_conflict = true
# these are the environments that will run when you
# execute `tox` in the command-line
Expand Down Expand Up @@ -57,60 +57,14 @@ commands_post =
# separates lint from build env
[testenv:lint]
deps =
flake8>=4
flake8-print>=5
flake8-docstrings
flake8-bugbear
pygments
isort
ruff
skip_install = true
commands =
flake8 {posargs:super_repo tests}
isort --verbose --check-only --diff {posargs:super_repo tests}
ruff format --check --diff {posargs:super_repo tests}
ruff check --diff {posargs:super_repo tests docs}


# my favourite configuration for flake8 styling
# https://flake8.pycqa.org/en/latest/#
[flake8]
max_line_length = 80
hang-closing = true
; D407 # Dont know what to do
; D406 # Dont know what to do
; D401 # Not suitable for example docstring names
ignore =
W293
W503
D412
D105
D407
D406
D401
per-file-ignores = setup.py:E501
docstring-convention = numpy
# normally I exclude init because it is very hard to configure init
# without breaking many rules
exclude = super_repo/__init__.py

# configuration for the isort module
# https://github.com/timothycrosley/isort
[isort]
skip = __init__.py
line_length = 80
indent = 4
multi_line_output = 8
include_trailing_comma = true
lines_after_imports = 2
sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
#known_future_library=future,pies
#known_standard_library=std,std2
known_first_party = sampleproject
# you should add here your known thirdparties, it will facilitate
# the job to isort
known_third_party =
hypothesis
matplotlib
numpy
pytest

[tool:pytest]
# If a pytest section is found in one of the possible config files
Expand Down

0 comments on commit b855f75

Please sign in to comment.