Lang/Python/開発環境
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#topicpath
/////////////////////////////////////////////////////////...
* 目次 [#b4ee840e]
#contents();
/////////////////////////////////////////////////////////...
* 開発環境 [#ge17897e]
- python 開発の為の環境構築を記す。
/////////////////////////////////////////////////////////...
* emacs 環境 [#emacs]
- python コード用フォーマッタには、flake8, autopep8, pyco...
//=======================================================...
** debian 環境での追加パッケージ [#tc06b6be]
- emacs
- elpa-flycheck
- pylint
- flake8
- isort
- elpa-py-isort
- mypy
//=======================================================...
** pylint [#pylint]
- インストールすると、flycheck から使われるようになる。
- 警告の意味が分からない場合は、[[Pylint 3.1.0-dev0 docum...
//-------------------------------------------------------...
*** 設定ファイル [#bf6ef9be]
- 下記に配置する:
-- ${HOME}/.config/pylintrc
- 設定ファイルのサンプルは、以下にて出力される
$ pylint --generate-rcfile > ~/.config/pylintrc
//=======================================================...
** mypy [#s60e75da]
- 静的型チェックを行う。
- 設定ファイルの適用順などは下記を参照:
-- [[The mypy configuration file>https://mypy.readthedocs...
//-------------------------------------------------------...
*** 設定ファイル [#ca97b726]
- 環境全体で一つの設定ファイルにしたい場合は、下記何れか...
-- ${HOME}/.config/mypy/config
-- ${HOME}/.mypy.ini
//=======================================================...
** flake8 [#e0883e53]
- インストールすると、flycheck から使われるようになる。
- インストールは pip でローカルに行う。(debian11 のパッ...
//-------------------------------------------------------...
*** 設定ファイル [#r2d1eb50]
- 下記に配置する:
-- ${HOME}/.config/flake8
- 設定ファイル記述例
[flake8]
ignore = E226,E302,E41
max-line-length = 160
exclude = tests/*
max-complexity = 10
- 参考:[[Configuration — flake8 2.5.5 documentation>http...
//-------------------------------------------------------...
*** 警告・エラーコード [#l2e0ee38]
- エラーコード番号に対応する警告内容は、下記を参照
-- [[Flake8 Rules>https://www.flake8rules.com/]]
//=======================================================...
** isort [#isort]
- python 標準の import 順に準拠していない箇所を指摘したり...
//=======================================================...
** configure for emacs [#emacs-config]
- flycheck
(require 'flycheck)
;; checking error by compiler ...
(flycheck-define-checker c/c++
"A C/C++ checker using clang++."
:command ("clang" "-Wall" "-Wextra -std=c++20" source)
:error-patterns ((error line-start
(file-name) ":" line ":" colu...
line-end)
(warning line-start
(file-name) ":" line ":" co...
line-end))
:modes (c-mode c++-mode))
;; エラーをツールチップ表示する ...
; (with-eval-after-load 'flycheck ...
; (flycheck-pos-tip-mode)) ...
- isort
(when (executable-find "isort") ; システム上に isort が...
(require 'py-isort)
;; 保存時にバッファ全体を自動整形する ...
(add-hook 'before-save-hook 'py-isort-before-save)
) ...
//=======================================================...
** links [#ye6be695]
- [[Pythonのリンター・フォーマッターをしっかりと理解する...
/////////////////////////////////////////////////////////...
* VSCode 環境 [#VSCode]
//=======================================================...
** configure for VSCode [#VSCode-config]
/////////////////////////////////////////////////////////...
* その他のツール [#b5c74002]
//=======================================================...
** autopep8 [#autopep8]
- python のコーディングルール "PEP8" に準拠していない箇所...
- PEP8 のドキュメント(日本語訳): [[pep8-ja>https://pep...
/////////////////////////////////////////////////////////...
* 参考リンク [#k7a77266]
- [[Pythonの主要なLint(pep8, pylint, flake8)の設定方法ま...
終了行:
#topicpath
/////////////////////////////////////////////////////////...
* 目次 [#b4ee840e]
#contents();
/////////////////////////////////////////////////////////...
* 開発環境 [#ge17897e]
- python 開発の為の環境構築を記す。
/////////////////////////////////////////////////////////...
* emacs 環境 [#emacs]
- python コード用フォーマッタには、flake8, autopep8, pyco...
//=======================================================...
** debian 環境での追加パッケージ [#tc06b6be]
- emacs
- elpa-flycheck
- pylint
- flake8
- isort
- elpa-py-isort
- mypy
//=======================================================...
** pylint [#pylint]
- インストールすると、flycheck から使われるようになる。
- 警告の意味が分からない場合は、[[Pylint 3.1.0-dev0 docum...
//-------------------------------------------------------...
*** 設定ファイル [#bf6ef9be]
- 下記に配置する:
-- ${HOME}/.config/pylintrc
- 設定ファイルのサンプルは、以下にて出力される
$ pylint --generate-rcfile > ~/.config/pylintrc
//=======================================================...
** mypy [#s60e75da]
- 静的型チェックを行う。
- 設定ファイルの適用順などは下記を参照:
-- [[The mypy configuration file>https://mypy.readthedocs...
//-------------------------------------------------------...
*** 設定ファイル [#ca97b726]
- 環境全体で一つの設定ファイルにしたい場合は、下記何れか...
-- ${HOME}/.config/mypy/config
-- ${HOME}/.mypy.ini
//=======================================================...
** flake8 [#e0883e53]
- インストールすると、flycheck から使われるようになる。
- インストールは pip でローカルに行う。(debian11 のパッ...
//-------------------------------------------------------...
*** 設定ファイル [#r2d1eb50]
- 下記に配置する:
-- ${HOME}/.config/flake8
- 設定ファイル記述例
[flake8]
ignore = E226,E302,E41
max-line-length = 160
exclude = tests/*
max-complexity = 10
- 参考:[[Configuration — flake8 2.5.5 documentation>http...
//-------------------------------------------------------...
*** 警告・エラーコード [#l2e0ee38]
- エラーコード番号に対応する警告内容は、下記を参照
-- [[Flake8 Rules>https://www.flake8rules.com/]]
//=======================================================...
** isort [#isort]
- python 標準の import 順に準拠していない箇所を指摘したり...
//=======================================================...
** configure for emacs [#emacs-config]
- flycheck
(require 'flycheck)
;; checking error by compiler ...
(flycheck-define-checker c/c++
"A C/C++ checker using clang++."
:command ("clang" "-Wall" "-Wextra -std=c++20" source)
:error-patterns ((error line-start
(file-name) ":" line ":" colu...
line-end)
(warning line-start
(file-name) ":" line ":" co...
line-end))
:modes (c-mode c++-mode))
;; エラーをツールチップ表示する ...
; (with-eval-after-load 'flycheck ...
; (flycheck-pos-tip-mode)) ...
- isort
(when (executable-find "isort") ; システム上に isort が...
(require 'py-isort)
;; 保存時にバッファ全体を自動整形する ...
(add-hook 'before-save-hook 'py-isort-before-save)
) ...
//=======================================================...
** links [#ye6be695]
- [[Pythonのリンター・フォーマッターをしっかりと理解する...
/////////////////////////////////////////////////////////...
* VSCode 環境 [#VSCode]
//=======================================================...
** configure for VSCode [#VSCode-config]
/////////////////////////////////////////////////////////...
* その他のツール [#b5c74002]
//=======================================================...
** autopep8 [#autopep8]
- python のコーディングルール "PEP8" に準拠していない箇所...
- PEP8 のドキュメント(日本語訳): [[pep8-ja>https://pep...
/////////////////////////////////////////////////////////...
* 参考リンク [#k7a77266]
- [[Pythonの主要なLint(pep8, pylint, flake8)の設定方法ま...
ページ名: