From d7f79f4439163b8e02c67cc89cba53c3e7509c3b Mon Sep 17 00:00:00 2001 From: Janosh Riebesell Date: Sat, 9 Mar 2024 08:13:47 +0100 Subject: [PATCH] `pip` to `uv` CI migration (#321) * bump ruff + auto-fixes * use uv to install deps in CI * revert to editable install * split 'dev' optional deps into dev + lint --- .github/workflows/test.yml | 5 ++++- .pre-commit-config.yaml | 2 +- custodian/__init__.py | 1 - custodian/feff/handlers.py | 1 - custodian/qchem/__init__.py | 1 - pyproject.toml | 14 +++++++++----- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 41072db6..d3459831 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,6 +34,9 @@ jobs: cache: pip cache-dependency-path: pyproject.toml + - name: Install uv + run: pip install uv + - uses: conda-incubator/setup-miniconda@v3 with: python-version: ${{ matrix.python-version }} @@ -43,7 +46,7 @@ jobs: run: conda install -c conda-forge openbabel - name: Install dependencies - run: pip install '.[dev]' + run: uv pip install -e '.[dev]' --system - name: pytest env: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 157b618f..79e5ded1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ ci: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.2.0 + rev: v0.3.2 hooks: - id: ruff args: [--fix, --ignore, D] diff --git a/custodian/__init__.py b/custodian/__init__.py index b9418536..50b2a3da 100644 --- a/custodian/__init__.py +++ b/custodian/__init__.py @@ -3,7 +3,6 @@ framework written in Python. """ - import os from .custodian import Custodian diff --git a/custodian/feff/handlers.py b/custodian/feff/handlers.py index af34899f..52397ff0 100644 --- a/custodian/feff/handlers.py +++ b/custodian/feff/handlers.py @@ -1,6 +1,5 @@ """This module implements specific error handler for FEFF runs.""" - import logging import re diff --git a/custodian/qchem/__init__.py b/custodian/qchem/__init__.py index 26aca531..99b75dc1 100644 --- a/custodian/qchem/__init__.py +++ b/custodian/qchem/__init__.py @@ -1,5 +1,4 @@ """This package implements various QChem Jobs and Error Handlers.""" - __author__ = "Samuel Blau, Brandon Wood, Shyam Dwaraknath" __credits__ = "Xiaohui Qu" diff --git a/pyproject.toml b/pyproject.toml index 2be696fc..3a9831ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,8 @@ dependencies = ["monty>=2.0.6", "psutil", "ruamel.yaml>=0.15.6"] vasp = ["pymatgen"] nwchem = ["pymatgen"] qchem = ["pymatgen"] -dev = ["mypy", "pre-commit", "pymatgen", "pytest", "pytest-cov", "ruff"] +dev = ["pymatgen", "pytest", "pytest-cov"] +lint = ["mypy", "pre-commit", "ruff"] error-statistics = ["sentry-sdk>=0.8.0"] [project.scripts] @@ -63,7 +64,9 @@ exclude = ["*.tests", "*.tests.*"] [tool.ruff] target-version = "py39" line-length = 120 -lint.select = [ + +[tool.ruff.lint] +select = [ "B", # flake8-bugbear "C4", # flake8-comprehensions "D", # pydocstyle @@ -94,7 +97,7 @@ lint.select = [ "W", # pycodestyle warning "YTT", # flake8-2020 ] -lint.ignore = [ +ignore = [ "B023", # Function definition does not bind loop variable "B028", # No explicit stacklevel keyword argument found "B904", # Within an except clause, raise exceptions with ... @@ -102,6 +105,7 @@ lint.ignore = [ "D105", # Missing docstring in magic method "D205", # 1 blank line required between summary line and description "D212", # Multi-line docstring summary should start at the first line + "ISC001", "PD011", # pandas-use-of-dot-values "PD901", # pandas-df-variable-name "PERF203", # try-except-in-loop @@ -111,8 +115,8 @@ lint.ignore = [ "RUF012", # Disable checks for mutable class args. This is a non-problem. "SIM105", # Use contextlib.suppress(OSError) instead of try-except-pass ] -lint.pydocstyle.convention = "google" -lint.isort.split-on-trailing-comma = false +pydocstyle.convention = "google" +isort.split-on-trailing-comma = false [tool.ruff.lint.per-file-ignores] "__init__.py" = ["F401"]