Pythonパッケージ開発の助け
Github Actions
GithubActionsでやってるactions@cacheって何?
https://github.com/python-poetry/poetry/blob/master/.github/workflows/main.yml#L42-L54
https://help.github.com/ja/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows
Python利用のGithubActions例
https://help.github.com/ja/actions/language-and-framework-guides/using-python-with-github-actions
https://docs.github.com/ja/free-pro-team@latest/actions/guides/building-and-testing-python
poetry
mypy
Compile-time type checking Static typing makes it easier to find bugs with less debugging.
ただ型を明言するだけでなく文法通りの型の扱い方になってるかどうかmypyでチェックする
ドキュメント化する際の型明言をするためだけかと思っていたが、静的解析をすることもできる
mypyでもチェックできるがEditor内で動的にチェックしてくれるようになるのでコンパイル前のバグ検出にも役立つ
型ヒントと typing と mypy
black
pre-commit
GithubActions + pre-commit run --all-files でLintingするのがよいのか
https://github.com/python-poetry/poetry/blob/master/.github/workflows/main.yml#L6-L18
pre-commitでインストールしてチェックするから開発用に静的解析ツールする必要ない?
flake8
code:setup.cfg
flake8
# for black https://github.com/psf/black#line-length
max-line-length = 88
select = C,E,F,W,B,B950
ignore = E203, E501, W503
# from hoge.core import Hoge -> from hoge import Hoge をするために
# __init__.py に from . import core を書く
# importされたcoreは__init__.py上でunusedのため警告(F401)がでる、それを無視する
# http://flake8.pycqa.org/en/2.5.5/warnings.html -> F401: module imported but unused
per-file-ignores = __init__.py:F401
isort
super-linter
Github Actionsで動作するLinter
Python以外も対象
faker
テスト用フェイクデータ生成
日本語サポート
名前や文章等生成してくれる