-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: optimize the development environment configuration guidance
- Loading branch information
Showing
3 changed files
with
209 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
;;; Directory Local Variables -*- no-byte-compile: t -*- | ||
;;; For more information see (info "(emacs) Directory Variables") | ||
|
||
((nil . ((eval . (progn | ||
;; install or activate the development environment | ||
;; (requires pyvenv-tracking-mode) | ||
(set (make-local-variable 'my-project) | ||
(locate-dominating-file default-directory ".dir-locals.el")) | ||
(set (make-local-variable 'my-project-venv) | ||
(concat my-project ".venv")) | ||
(if (not (file-exists-p my-project-venv)) | ||
(let ((cwd default-directory)) | ||
(cd my-project) | ||
(async-shell-command "make dev-infra") | ||
(cd cwd) | ||
(message "Please re-open this file/directory after the \"make dev-infra\" command finishes.")) | ||
;; must be set project-wide to pre-commit work | ||
(set (make-local-variable 'pyvenv-activate) | ||
my-project-venv)))))) | ||
(python-mode . ((eval . (progn | ||
;; sort imports, then style code | ||
(add-hook 'before-save-hook #'py-isort-before-save nil t) | ||
(add-hook 'before-save-hook #'elpy-black-fix-code nil t)))))) | ||
((nil | ||
(eval progn | ||
;; install or activate the development environment | ||
;; (requires pyvenv-tracking-mode) | ||
(set (make-local-variable 'my-project) | ||
(locate-dominating-file default-directory ".dir-locals.el")) | ||
(set (make-local-variable 'my-project-venv) | ||
(concat my-project ".venv")) | ||
(if (not (file-exists-p my-project-venv)) | ||
(let ((cwd default-directory) | ||
(cmd "make setup")) | ||
(cd my-project) | ||
(async-shell-command cmd) | ||
(cd cwd) | ||
(message | ||
(format "Please re-open this file/directory after the \"%s\" command finishes." cmd))) | ||
;; must be set project-wide for pre-commit to work | ||
(set (make-local-variable 'pyvenv-activate) | ||
my-project-venv)))) | ||
(python-mode | ||
(eval progn | ||
;; sort imports, then style code | ||
(add-hook 'before-save-hook #'py-isort-before-save nil t) | ||
(add-hook 'before-save-hook #'elpy-black-fix-code nil t)))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters