diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 8026b92..0000000 --- a/.flake8 +++ /dev/null @@ -1,4 +0,0 @@ -[flake8] -max-line-length = 88 -ignore = W291,W293,W503,W504,E123,E126,E203,E402,E701,E731,F722 -per-file-ignores = __init__.py: F401 diff --git a/.isort.cfg b/.isort.cfg deleted file mode 100644 index f9e6dd4..0000000 --- a/.isort.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[settings] -force_alphabetical_sort_within_sections=true -lines_after_imports=2 -profile=black -combine_as_imports=True -treat_comments_as_code=true -extra_standard_library=typing_extensions diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3309a43..4a0b6d9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,17 +22,7 @@ repos: rev: 22.3.0 hooks: - id: black - - repo: https://github.com/nbQA-dev/nbQA - rev: 1.6.3 + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: 'v0.0.255' hooks: - - id: nbqa-black - - id: nbqa-isort - - id: nbqa-flake8 - - repo: https://github.com/PyCQA/isort - rev: 5.12.0 - hooks: - - id: isort - - repo: https://github.com/pycqa/flake8 - rev: 4.0.1 - hooks: - - id: flake8 + - id: ruff diff --git a/jaxtyping/__init__.py b/jaxtyping/__init__.py index 3d84054..87c285d 100644 --- a/jaxtyping/__init__.py +++ b/jaxtyping/__init__.py @@ -110,7 +110,7 @@ if typing.TYPE_CHECKING: # anything. (I believe this is sometimes called `Unknown`.) Thus, this odd-looking # annotation, which static type checkers aren't smart enough to resolve. elif has_jax: - from .pytree_type import PyTree + from .pytree_type import PyTree as PyTree # noqa: F401 del has_jax diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..88f3f59 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,10 @@ +[tool.ruff] +select = ["E", "F", "I001"] +ignore = ["E721", "E731", "F722"] +ignore-init-module-imports = true + +[tool.ruff.isort] +combine-as-imports = true +lines-after-imports = 2 +extra-standard-library = ["typing_extensions"] +order-by-type = false diff --git a/test/import_hook_tester_transitive/__init__.py b/test/import_hook_tester_transitive/__init__.py index 1bb4722..3501c8a 100644 --- a/test/import_hook_tester_transitive/__init__.py +++ b/test/import_hook_tester_transitive/__init__.py @@ -17,4 +17,4 @@ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -from . import another_file +from . import another_file # noqa: F401