               (add-to-list 'company-transformers 'company-sort-prefer-same-case-prefix t))))
 
 ;; Linting
-(defun python-poetry-config-path ()
-  (concat (locate-dominating-file default-directory "pyproject.toml")
-          "pyproject.toml"))
-
 (defun python-pre-commit-config-path ()
-  (concat (locate-dominating-file default-directory ".pre-commit-config.yaml")
-          ".pre-commit-config.yaml"))
+  (when-let ((dir (locate-dominating-file default-directory ".pre-commit-config.yaml")))
+    (concat dir ".pre-commit-config.yaml")))
 
 (defvar python-pre-commit-config-cache nil)
 (defun python-pre-commit-config ()

          (lambda ()
            (use-package python-docstring
              :delight
              :config (python-docstring-mode))

            (when (python-use-poetry-p)
              (make-local-variable 'python-shell-interpreter)

            (with-eval-after-load 'reformatter
              (let ((requirements (python-project-requirements)))
                (when (cond ((and (python-use-pre-commit-p requirements)
                                  (python-pre-commit-config-has-hook-p "isort"))
                             (setf python-isort-executable
                                   (concat (python-pre-commit-virtualenv-path "isort") "/bin/isort")))
                            ((and (python-use-poetry-p)
                                  (member "isort" requirements))
                             (setf python-isort-executable "poetry"
                                   python-isort-arguments
                                   (append '("run" "isort") python-isort-arguments)))
                            ((executable-find python-isort-executable)
                             (when (and python-black-command
                                        (executable-find python-black-command))
                               (setf python-isort-arguments
                                     (append '("--profile" "black") python-isort-arguments)))))
                  (python-isort-on-save-mode 1))))

            (use-package importmagic
