   :hook (cmake-mode . cmake-font-lock-activate))
 
 ;; Formatting
-(defvar-local python-isort-executable "isort")
-(defvar-local python-isort-arguments '("--stdout" "-"))
 (use-package reformatter
   :quelpa (reformatter :fetcher github :repo "wyuenho/reformatter.el" :branch "post-processor")
   :config
-  (reformatter-define python-isort
-    :program python-isort-executable
-    :args python-isort-arguments)
-
   (reformatter-define yarn-eslint-format
     :program "yarn"
     :args `("--silent"

(require 'seq)
(require 'cl-lib)
(require 'subr-x)

(set-locale-environment "UTF-8")
(custom-autoload 'package-selected-packages "package")

                  (buffer-string))
                :object-type 'alist
                :sequence-type 'list))))
        (assoc-delete-all config-path python-pre-commit-config-cache)
        (push `(,config-path . ((modification-time . ,modification-time)
                                (content . ,content)))
              python-pre-commit-config-cache)
        content))))

(defun python-pyproject-path ()
  (when-let ((dir (locate-dominating-file default-directory "pyproject.toml")))
    (concat dir "pyproject.toml")))

(defun python-use-poetry-p ()
  (and (python-pyproject-path)
       (with-temp-buffer
         (insert-file-contents (python-pyproject-path))
         (goto-char (point-min))
         (re-search-forward "^\\[tool.poetry\\]$" nil t nil))
       (executable-find "poetry")))

(defvar python-pyproject-cache nil)
(defun python-parse-pyproject ()
  (let* ((pyproject-path (python-pyproject-path))
         (modification-time
          (file-attribute-modification-time (file-attributes pyproject-path)))
         (cache-value (assoc-default pyproject-path python-pyproject-cache)))
    (if (equal (alist-get 'modification-time cache-value) modification-time)
        (alist-get 'content cache-value)
      (let* ((program (if (python-use-poetry-p) "poetry" "python"))
             (args `(,@(if (python-use-poetry-p) '("run" "python")) "-c"
                     ,(format
                       "import json;import toml;import os;import sys;json.dump(toml.load('%s'), sys.stdout)"
                       (expand-file-name (python-pyproject-path)))))
             (content
              (with-temp-buffer
                (apply 'call-process program nil t nil args)
                (goto-char (point-min))
                (json-parse-buffer :object-type 'alist))))
        (assoc-delete-all pyproject-path python-pyproject-cache)
        (push `(,pyproject-path . ((modification-time . , modification-time)
                                   (content . ,content)))
              python-pyproject-cache)
        content))))

(defun python-use-pre-commit-p (requirements)
  (and (python-pre-commit-config-path)
