Skip to content
This repository was archived by the owner on Nov 7, 2024. It is now read-only.

add Python3.9 and Django 2.2 support, drop Python2.7 and Django 1.11support #13

Merged
merged 35 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1c7ce2f
Python3.9対応の記述を追加
imaxyz Mar 4, 2022
d1fd47f
READMEにPython3.9を追加
imaxyz Mar 4, 2022
62b696c
Travis CIの設定を削除。Github Actionsの設定を追加。
imaxyz Mar 8, 2022
804876d
toxを使わない場合の動作確認
imaxyz Mar 8, 2022
fb40940
toxを使わない場合のgithub actions動作確認
imaxyz Mar 8, 2022
3838514
wip: github actions動作確認
imaxyz Mar 8, 2022
9897f35
wip: github actions動作確認
imaxyz Mar 8, 2022
6ce6c6b
wip: github actions動作確認
imaxyz Mar 8, 2022
f66940e
wip: toxで実行するように戻す
imaxyz Mar 8, 2022
8fcfc5f
bpmailerのユニットテストのpathの記述を修正。コメントを追加。
imaxyz Mar 9, 2022
1b33848
Readmeに記載されているパッケージをrequirements.txtに記述。各種設定ファイルにコメントを追記。
imaxyz Mar 9, 2022
ebc3d14
コメント文を日本語に変更
imaxyz Mar 9, 2022
3ea2674
コメントを修正
imaxyz Mar 10, 2022
96079fb
Github Actionsの python-version にREADMEで対応の表記がある、2.7を追加
imaxyz Mar 10, 2022
e699981
tox-gh-actionsのtox.ini設定に2.7を追加
imaxyz Mar 10, 2022
f537538
2.7でエラーになったのでコメントを一旦英語に変更
imaxyz Mar 10, 2022
7888314
python 2.7サポートを外しました
imaxyz Mar 10, 2022
a1ce88e
python 2.7サポートを外しました
imaxyz Mar 10, 2022
aa6ebde
Travis CIのビルド結果アイコンを、Github Actionsのワークフロー結果のアイコンに変更
imaxyz Mar 10, 2022
733479d
github actionsのワークフローに、これから実行するtoxの動きを確認するコマンドを追加
imaxyz Mar 10, 2022
e40af11
何のためにあるrequirements.txtファイルなのかを説明するコメントを記述しました。
imaxyz Mar 10, 2022
6979781
Githu Actionsのジョブを並列実行するように修正
imaxyz Mar 11, 2022
ed5c025
READMEにおけるgithub actionsのリンクを修正
imaxyz Mar 11, 2022
76d2427
READMEにおけるgithub actionsのリンクを修正
imaxyz Mar 11, 2022
fecf1ae
READMEにおけるgithub actionsのリンクを修正
imaxyz Mar 11, 2022
76b6b17
リンク表現の向上のためREADMEの書式をmarkdownからreStructuredTextに変更
imaxyz Mar 11, 2022
fbe6534
Django 1.11を非対応にする
imaxyz Mar 11, 2022
46d2807
Django 1.11のサポートをドロップする旨を反映
imaxyz Mar 11, 2022
848e7f6
不要と思われるジョブの制御を削除
imaxyz Mar 11, 2022
22a2dd6
ファイル名に意図を込めました
imaxyz Mar 11, 2022
411ef07
classifiersの記述を最新の内容に変更
imaxyz Mar 11, 2022
a1a425a
パッケージを使用する際に要求するPythonバージョンを指定
imaxyz Mar 11, 2022
6b9b31c
`tox -l` はmasterにマージするワークフローには入れないようにする
imaxyz Mar 11, 2022
ba0fbfe
tox.iniの書き方を推敲
imaxyz Mar 11, 2022
2063bf7
依存パッケージの記述を追記。
imaxyz Mar 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:

# 並列して実行する各ジョブのPythonバージョン
strategy:
max-parallel: 4
matrix:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ASK: djangoはmatrixにしないんですか?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ASKの回答

tox-gh-actionsパッケージの仕様と、bpmailerのtox.iniの記述内容から、bpmailerのworkflow/tests.pyには、djangoのmatrixを記述する必要はないと判断しました。

理由

作業の際、Workflowが実行したジョブのログを確認したところ、自動でtox.iniに記述した各djangoバージョンのバリエーションテストを実行してくれていたので、matrixには記述しませんでした。

この辺の挙動をよく理解できていなかったため、再調査しました。

再調査でわかったこと

tox-gh-actionsパッケージの仕様で、tox.ini の gh-actions の項目にPythonバージョンを記述すると、Github Actionのジョブから実行するtoxでは、gh-actions に記述した各Pythonバージョンに絞った状態で実行ができる仕様があるようです。

次のドキュメントの例だと、

On Python 3.9 job, tox runs py39 environment
https://github.com/ymyzk/tox-gh-actions/blob/master/README.md#basic-example

Python3.9のジョブを実行する際には、py39環境にてtoxを実行してくれるようです。

考察

試しに、workflows/tests.ymlに次のように記述して見たところ

   - name: Test with tox
      run: |
        tox -l  ← 追記
        tox

Github Actionsは、tox-gh-actionsのドキュメントの通り、そのジョブで指定されたPythonバージョンに関するテストのバリエーションを実行していることを確認しました。

Run tox -l 
py36-django  
py36-django22
GLOB sdist-make: /home/runner/work/bpmailer/bpmailer/setup.py
py36-django111 create: /home/runner/work/bpmailer/bpmailer/.tox/py36-django111
tox: py36-django111
py36-django22 create: /home/runner/work/bpmailer/bpmailer/.tox/py36-django22
tox: py36-django22
___________________________________ summary ____________________________________
  py36-django111: commands succeeded
  py36-django22: commands succeeded
  congratulations :)

https://github.com/beproud/bpmailer/runs/5492233415?check_suite_focus=true

備考

workflowに追加した、tox -lのコマンドは今後コードを確認する人が動作を把握するのに役立つと思ったので、一旦そのまま残しました。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@imaxyz matrix化することによって順次実行ではなく並列実行になります。また Python x Django の組合せ名でテスト実行記録が残るためエラー発生時に原因が追いやすくなります。この機会にそのように構成したほうが良いとおもいますが、どうでしょうか?

具体的には以下の様になります。

現在のこのPRのテスト

image

別プロジェクトでの例

https://github.com/jazzband/django-redshift-backend/runs/5347475991?check_suite_focus=true
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

並列化しました。

Python 2.7とDjango 1.11をdropしたため、このPRでは並列化の効果が高くありませんが、今後のPRで恩恵を受けられるので、workflowを並列化する記述に修正しました。

python-version: ['3.6', '3.9']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.6はすでにEOLです。3.7に修正して良さそう

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kemu3007 このbpmailerを使いたいプロジェクトがまだPython3.6を使っているため、現時点ではPython3.6対応は残したい感じです。

django-version: ['2.2']
Expand Down
File renamed without changes.
12 changes: 8 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,21 @@ def read_file(filename):
url='https://github.com/beproud/bpmailer/',
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Plugins',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.9',
'Framework:: Django',
'Framework:: Django :: 2.2',
'Intended Audience :: Developers',
'Environment :: Plugins',
'Topic :: Software Development :: Libraries :: Python Modules',
],
include_package_data=True,
packages=find_packages(),
namespace_packages=['beproud', 'beproud.django'],
install_requires=['Django>=1.11', 'six'],
install_requires=['Django>=2.2', 'six'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

すみません、もう1個思い出しました。
できれば対応お願いします。

Py2 drop するのであれば、 python_requires で3.6以上を指定して下さい。
https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#python-requires


https://github.com/jazzband/django-redshift-backend/blob/master/setup.cfg#L36

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

追記しました

test_suite='tests.main',
zip_safe=False,
keywords=['django', 'mail']
Expand Down