-
Notifications
You must be signed in to change notification settings - Fork 2
add Python3.9 and Django 2.2 support, drop Python2.7 and Django 1.11support #13
Conversation
test_runner = TestRunner() | ||
|
||
# set 'bpmailer unit test path' and run the unit test | ||
failures = test_runner.run_tests(['beproud.django.mailer.tests']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Djangoのバージョンが変わったためか?) toxが通らなくなっていたので、Djangoのrun_tests()メソッドのドキュメントを参考に、テストモジュールへのPathを修正しました。
Test labels should be dotted Python paths to test modules, test classes, or test methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
原因はsetuptoolsの更新のためのようです。 変更自体はまずはこれでよさそう。
- Avoid deprecated load_module() in pkg_resources namespace delaration pypa/setuptools#2523
- https://setuptools.pypa.io/en/latest/history.html#v51-2-0 →同様のエラーが発生する
- https://setuptools.pypa.io/en/latest/history.html#v51-1-2 →発生しない
このPRで対応するかは任せますが、 python setup.py test
コマンド自体が非推奨になっているのでpytestに置き換えた方がよさそうです。 https://setuptools.pypa.io/en/latest/userguide/commands.html?highlight=test_suite#test-build-package-and-run-a-unittest-suite
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MUST: レビューのために、この修正の妥当性の説明が欲しいです。
(Djangoのバージョンが変わったためか?)
確信はないけどこうしたら動いた、ということでしょうか。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
現在 bpmailerのtoxがfailする原因について
- 頂いたコメントに関して、py36, py39共に、bpmailerのtox.iniの
testenv - deps
の項目に、次の行を追加することでtoxから実行する単体テストがpassすることを確認しました。
setuptools<=51.1.2
※ この改修がsetuptoolsの51.1.2の次のバージョンである51.2.0でマージされたことも確認しました
このことから、今回の作業でbpmailerのtoxがfailしている原因は、setuptoolsが、bpmailerをpy36対応した時の作業の時と比べてバージョンアップしていて、動作が変わっていたことが原因と思いました。
python setup.py test
コマンドが非推奨の件
#14 でissueにしました。別PRで対応できればと思います。
今回の改修方法の妥当性について
(Djangoのバージョンが変わったためか?)
最初上記のようにコメントしたのですが、上述のsetuptoolsの調査結果から、Djnagoのバージョンは関係なさそうです。
setuptoolsの改修で使われているメソッドの差分について調べられたらベストなのですが、まだ調べられていません。
改修方法の妥当性について、確信は無いのですが、bpmailerが使用するバージョンのDjnagoのrun_tests()のコメントに
Test labels should be dotted Python paths to test modules, test classes, or test methods.
意訳: ラベルは「テストモジュールか、テストクラスか、テストメソッド」にすべき
と書かれているのに対して、テストモジュールの上位のパッケージ名(mailer)を指定していることから、Djangoが想定するパラメータ仕様に近づける意味で、適切ではと考えました。
# before
test_runner.run_tests(['beproud.django.mailer'])
# after
test_runner.run_tests(['beproud.django.mailer.tests'])
あと、tox.iniのdeps項目に、setuptoolsのバージョンを指定すべきか?を考えました。
現在の改修方法だと、setuptoolsのバージョンが51.2.0未満でも51.2.0以上でもtoxがpassしました。
なので、tox.iniにsetuptoolsのバージョン指定を記述する必要ないと考えました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OKです。別PRでtest.pyを削除するのであれば、問題ないです。
README.md
Outdated
@@ -2,6 +2,6 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SHOULD: travisの結果を見ているのでGitHub Action版に変更してください。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- アイコンをGithub Actionsの結果を表示するように修正しました。
- アイコンを選択した際に、https://github.com/beproud/bpmailer/actions に遷移させたかったので、rst形式に変更しました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
補足
Markdownだとsvg画像へリンクする記述方法しか見当たりませんでした。
バッチアイコンを選択して、バッチの画像をダウンロードするよりか、より情報が多いWebページに遷移した方が良いと考え、rstに変更してみました
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: ['3.6', '3.9'] |
There was a problem hiding this comment.
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に修正して良さそう
There was a problem hiding this comment.
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対応は残したい感じです。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
レビューしました
.github/workflows/tests.yml
Outdated
|
||
# 並列して実行する各ジョブのPythonバージョン | ||
strategy: | ||
max-parallel: 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ASK: これ要りますか?(制限しているのを初めて見た)
無指定にして、実行環境で使えるだけ使えばよいのでは。
requirements.txt
Outdated
@@ -0,0 +1,5 @@ | |||
# toxを使用せず、直接 python tests.py で単体テスト実行する際に pip installするパッケージ一覧です。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SHOULD: ファイル名を requirements-test.txt
等にして、テストでのみ必要という意味を持たせて欲しい。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ファイル名を修正しました。
test_runner = TestRunner() | ||
|
||
# set 'bpmailer unit test path' and run the unit test | ||
failures = test_runner.run_tests(['beproud.django.mailer.tests']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OKです。別PRでtest.pyを削除するのであれば、問題ないです。
|
||
[travis:env] | ||
DJANGO = | ||
1.11: django111 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MUST: 1.11をドロップしたのであれば、setup.pyも更新してください。
Line 63 in e44f6b4
install_requires=['Django>=1.11', 'six'], |
以下、ついでに依頼です。
classifiers も更新お願いします。
Lines 51 to 59 in e44f6b4
classifiers=[ | |
'Development Status :: 3 - Alpha', | |
'Environment :: Plugins', | |
'Framework :: Django', | |
'Intended Audience :: Developers', | |
'License :: OSI Approved :: BSD License', | |
'Programming Language :: Python', | |
'Topic :: Software Development :: Libraries :: Python Modules', | |
], |
参考記述
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setup.pyの記述内容を修正しました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM + 1つ「できれば」依頼
setup.py
Outdated
'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'], |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
追記しました
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nits. 直近の作業には影響しないレベルだと思います。
.github/workflows/tests.yml
Outdated
# Github Actionsからtoxを実行 | ||
- name: Test with tox | ||
run: | | ||
tox -l |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
マトリクス対応したので -l
は不要な認識です。削除してください。 https://github.com/beproud/bpmailer/pull/13/files#r824402013
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
削除しました
@@ -0,0 +1,5 @@ | |||
# toxを使用せず、直接 python tests.py で単体テスト実行する際に pip installするパッケージ一覧です。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO: この後Django3.2対応もあると思うので、Django2.2固定のこのファイルは削除することになると思います。なのでこのPRでは一旦よいかもしれませんが、後々は削除したほうが第三者が混乱しなくてよさそうです。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
なるほどです。ryです。今回は残しておきます。
tox.ini
Outdated
@@ -1,29 +1,21 @@ | |||
# Requires tox > 1.8 | |||
|
|||
[tox] | |||
envlist = py27-django111, py36-django{111,22} | |||
envlist = py36-django22, py39-django22 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits: 書き方を省略できます #13 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestionを見落としていました。
修正しました。
Co-authored-by: Kashun YOSHIDA <1122795+kashewnuts@users.noreply.github.com>
目的
作業内容
レビューしてほしいところ