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

support Python3.10 over & Django4.2 #21

Merged
merged 1 commit into from
Feb 7, 2024
Merged

support Python3.10 over & Django4.2 #21

merged 1 commit into from
Feb 7, 2024

Conversation

kashewnuts
Copy link
Collaborator

@kashewnuts kashewnuts commented Feb 2, 2024

具体的な変更内容

  • Support Django4.2 & Python3.10〜3.12
  • Drop Django2.2
  • setup.pyを廃止し、pyproject.tomlに移行
  • Git管理されているので、.hgignoreは削除
  • pytest test.pyからpytestにテストランナーを移行
  • mockを標準ライブラリに移行

python -m build && twine check時のログ

python -m build .
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools>=61.0.0, wheel)
* Getting build dependencies for sdist...
running egg_info
writing bpmailer.egg-info/PKG-INFO
writing dependency_links to bpmailer.egg-info/dependency_links.txt
writing requirements to bpmailer.egg-info/requires.txt
writing top-level names to bpmailer.egg-info/top_level.txt
reading manifest file 'bpmailer.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'bpmailer.egg-info/SOURCES.txt'
* Building sdist...
running sdist
running egg_info
writing bpmailer.egg-info/PKG-INFO
writing dependency_links to bpmailer.egg-info/dependency_links.txt
writing requirements to bpmailer.egg-info/requires.txt
writing top-level names to bpmailer.egg-info/top_level.txt
reading manifest file 'bpmailer.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'bpmailer.egg-info/SOURCES.txt'
running check
creating bpmailer-1.3
creating bpmailer-1.3/beproud
creating bpmailer-1.3/beproud/django
creating bpmailer-1.3/beproud/django/mailer
creating bpmailer-1.3/beproud/django/mailer/backends
creating bpmailer-1.3/beproud/django/mailer/templates
creating bpmailer-1.3/beproud/django/mailer/templates/mailer
creating bpmailer-1.3/beproud/django/mailer/templatetags
creating bpmailer-1.3/bpmailer.egg-info
creating bpmailer-1.3/docs
creating bpmailer-1.3/docs/ja
creating bpmailer-1.3/docs/ja/source
creating bpmailer-1.3/tests
copying files to bpmailer-1.3...
copying MANIFEST.in -> bpmailer-1.3
copying README.rst -> bpmailer-1.3
copying pyproject.toml -> bpmailer-1.3
copying beproud/__init__.py -> bpmailer-1.3/beproud
copying beproud/django/__init__.py -> bpmailer-1.3/beproud/django
copying beproud/django/mailer/__init__.py -> bpmailer-1.3/beproud/django/mailer
copying beproud/django/mailer/api.py -> bpmailer-1.3/beproud/django/mailer
copying beproud/django/mailer/models.py -> bpmailer-1.3/beproud/django/mailer
copying beproud/django/mailer/signals.py -> bpmailer-1.3/beproud/django/mailer
copying beproud/django/mailer/tasks.py -> bpmailer-1.3/beproud/django/mailer
copying beproud/django/mailer/backends/__init__.py -> bpmailer-1.3/beproud/django/mailer/backends
copying beproud/django/mailer/backends/base.py -> bpmailer-1.3/beproud/django/mailer/backends
copying beproud/django/mailer/backends/console.py -> bpmailer-1.3/beproud/django/mailer/backends
copying beproud/django/mailer/backends/dummy.py -> bpmailer-1.3/beproud/django/mailer/backends
copying beproud/django/mailer/backends/filebased.py -> bpmailer-1.3/beproud/django/mailer/backends
copying beproud/django/mailer/backends/locmem.py -> bpmailer-1.3/beproud/django/mailer/backends
copying beproud/django/mailer/backends/smtp.py -> bpmailer-1.3/beproud/django/mailer/backends
copying beproud/django/mailer/templates/mailer/html_mail.tpl -> bpmailer-1.3/beproud/django/mailer/templates/mailer
copying beproud/django/mailer/templates/mailer/mail.tpl -> bpmailer-1.3/beproud/django/mailer/templates/mailer
copying beproud/django/mailer/templatetags/__init__.py -> bpmailer-1.3/beproud/django/mailer/templatetags
copying beproud/django/mailer/templatetags/mailer_tags.py -> bpmailer-1.3/beproud/django/mailer/templatetags
copying bpmailer.egg-info/PKG-INFO -> bpmailer-1.3/bpmailer.egg-info
copying bpmailer.egg-info/SOURCES.txt -> bpmailer-1.3/bpmailer.egg-info
copying bpmailer.egg-info/dependency_links.txt -> bpmailer-1.3/bpmailer.egg-info
copying bpmailer.egg-info/requires.txt -> bpmailer-1.3/bpmailer.egg-info
copying bpmailer.egg-info/top_level.txt -> bpmailer-1.3/bpmailer.egg-info
copying docs/ja/source/conf.py -> bpmailer-1.3/docs/ja/source
copying tests/__init__.py -> bpmailer-1.3/tests
copying tests/settings.py -> bpmailer-1.3/tests
copying tests/test_mail.py -> bpmailer-1.3/tests
copying bpmailer.egg-info/SOURCES.txt -> bpmailer-1.3/bpmailer.egg-info
Writing bpmailer-1.3/setup.cfg
Creating tar archive
removing 'bpmailer-1.3' (and everything under it)
* Building wheel from sdist
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools>=61.0.0, wheel)
* Getting build dependencies for wheel...
running egg_info
writing bpmailer.egg-info/PKG-INFO
writing dependency_links to bpmailer.egg-info/dependency_links.txt
writing requirements to bpmailer.egg-info/requires.txt
writing top-level names to bpmailer.egg-info/top_level.txt
reading manifest file 'bpmailer.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'bpmailer.egg-info/SOURCES.txt'
* Installing packages in isolated environment... (wheel)
* Building wheel...
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/tests
copying tests/test_mail.py -> build/lib/tests
copying tests/__init__.py -> build/lib/tests
copying tests/settings.py -> build/lib/tests
creating build/lib/beproud
copying beproud/__init__.py -> build/lib/beproud
creating build/lib/docs
creating build/lib/docs/ja
creating build/lib/docs/ja/source
copying docs/ja/source/conf.py -> build/lib/docs/ja/source
creating build/lib/beproud/django
copying beproud/django/__init__.py -> build/lib/beproud/django
creating build/lib/beproud/django/mailer
copying beproud/django/mailer/signals.py -> build/lib/beproud/django/mailer
copying beproud/django/mailer/tasks.py -> build/lib/beproud/django/mailer
copying beproud/django/mailer/models.py -> build/lib/beproud/django/mailer
copying beproud/django/mailer/__init__.py -> build/lib/beproud/django/mailer
copying beproud/django/mailer/api.py -> build/lib/beproud/django/mailer
creating build/lib/beproud/django/mailer/templatetags
copying beproud/django/mailer/templatetags/__init__.py -> build/lib/beproud/django/mailer/templatetags
copying beproud/django/mailer/templatetags/mailer_tags.py -> build/lib/beproud/django/mailer/templatetags
creating build/lib/beproud/django/mailer/backends
copying beproud/django/mailer/backends/console.py -> build/lib/beproud/django/mailer/backends
copying beproud/django/mailer/backends/filebased.py -> build/lib/beproud/django/mailer/backends
copying beproud/django/mailer/backends/__init__.py -> build/lib/beproud/django/mailer/backends
copying beproud/django/mailer/backends/smtp.py -> build/lib/beproud/django/mailer/backends
copying beproud/django/mailer/backends/dummy.py -> build/lib/beproud/django/mailer/backends
copying beproud/django/mailer/backends/base.py -> build/lib/beproud/django/mailer/backends
copying beproud/django/mailer/backends/locmem.py -> build/lib/beproud/django/mailer/backends
running egg_info
writing bpmailer.egg-info/PKG-INFO
writing dependency_links to bpmailer.egg-info/dependency_links.txt
writing requirements to bpmailer.egg-info/requires.txt
writing top-level names to bpmailer.egg-info/top_level.txt
reading manifest file 'bpmailer.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'bpmailer.egg-info/SOURCES.txt'
creating build/lib/beproud/django/mailer/templates
creating build/lib/beproud/django/mailer/templates/mailer
copying beproud/django/mailer/templates/mailer/html_mail.tpl -> build/lib/beproud/django/mailer/templates/mailer
copying beproud/django/mailer/templates/mailer/mail.tpl -> build/lib/beproud/django/mailer/templates/mailer
warning: build_py: byte-compiling is disabled, skipping.

installing to build/bdist.macosx-14-arm64/wheel
running install
running install_lib
creating build/bdist.macosx-14-arm64
creating build/bdist.macosx-14-arm64/wheel
creating build/bdist.macosx-14-arm64/wheel/tests
copying build/lib/tests/test_mail.py -> build/bdist.macosx-14-arm64/wheel/tests
copying build/lib/tests/__init__.py -> build/bdist.macosx-14-arm64/wheel/tests
copying build/lib/tests/settings.py -> build/bdist.macosx-14-arm64/wheel/tests
creating build/bdist.macosx-14-arm64/wheel/docs
creating build/bdist.macosx-14-arm64/wheel/docs/ja
creating build/bdist.macosx-14-arm64/wheel/docs/ja/source
copying build/lib/docs/ja/source/conf.py -> build/bdist.macosx-14-arm64/wheel/docs/ja/source
creating build/bdist.macosx-14-arm64/wheel/beproud
copying build/lib/beproud/__init__.py -> build/bdist.macosx-14-arm64/wheel/beproud
creating build/bdist.macosx-14-arm64/wheel/beproud/django
copying build/lib/beproud/django/__init__.py -> build/bdist.macosx-14-arm64/wheel/beproud/django
creating build/bdist.macosx-14-arm64/wheel/beproud/django/mailer
creating build/bdist.macosx-14-arm64/wheel/beproud/django/mailer/templatetags
copying build/lib/beproud/django/mailer/templatetags/__init__.py -> build/bdist.macosx-14-arm64/wheel/beproud/django/mailer/templatetags
copying build/lib/beproud/django/mailer/templatetags/mailer_tags.py -> build/bdist.macosx-14-arm64/wheel/beproud/django/mailer/templatetags
copying build/lib/beproud/django/mailer/signals.py -> build/bdist.macosx-14-arm64/wheel/beproud/django/mailer
copying build/lib/beproud/django/mailer/tasks.py -> build/bdist.macosx-14-arm64/wheel/beproud/django/mailer
copying build/lib/beproud/django/mailer/models.py -> build/bdist.macosx-14-arm64/wheel/beproud/django/mailer
creating build/bdist.macosx-14-arm64/wheel/beproud/django/mailer/backends
copying build/lib/beproud/django/mailer/backends/console.py -> build/bdist.macosx-14-arm64/wheel/beproud/django/mailer/backends
copying build/lib/beproud/django/mailer/backends/filebased.py -> build/bdist.macosx-14-arm64/wheel/beproud/django/mailer/backends
copying build/lib/beproud/django/mailer/backends/__init__.py -> build/bdist.macosx-14-arm64/wheel/beproud/django/mailer/backends
copying build/lib/beproud/django/mailer/backends/smtp.py -> build/bdist.macosx-14-arm64/wheel/beproud/django/mailer/backends
copying build/lib/beproud/django/mailer/backends/dummy.py -> build/bdist.macosx-14-arm64/wheel/beproud/django/mailer/backends
copying build/lib/beproud/django/mailer/backends/base.py -> build/bdist.macosx-14-arm64/wheel/beproud/django/mailer/backends
copying build/lib/beproud/django/mailer/backends/locmem.py -> build/bdist.macosx-14-arm64/wheel/beproud/django/mailer/backends
copying build/lib/beproud/django/mailer/__init__.py -> build/bdist.macosx-14-arm64/wheel/beproud/django/mailer
copying build/lib/beproud/django/mailer/api.py -> build/bdist.macosx-14-arm64/wheel/beproud/django/mailer
creating build/bdist.macosx-14-arm64/wheel/beproud/django/mailer/templates
creating build/bdist.macosx-14-arm64/wheel/beproud/django/mailer/templates/mailer
copying build/lib/beproud/django/mailer/templates/mailer/mail.tpl -> build/bdist.macosx-14-arm64/wheel/beproud/django/mailer/templates/mailer
copying build/lib/beproud/django/mailer/templates/mailer/html_mail.tpl -> build/bdist.macosx-14-arm64/wheel/beproud/django/mailer/templates/mailer
warning: install_lib: byte-compiling is disabled, skipping.

running install_egg_info
Copying bpmailer.egg-info to build/bdist.macosx-14-arm64/wheel/bpmailer-1.3-py3.9.egg-info
running install_scripts
creating build/bdist.macosx-14-arm64/wheel/bpmailer-1.3.dist-info/WHEEL
creating '/Users/kashew/projects/github.com/beproud/bpmailer/dist/.tmp-xxrk76is/bpmailer-1.3-py3-none-any.whl' and adding 'build/bdist.macosx-14-arm64/wheel' to it
adding 'beproud/__init__.py'
adding 'beproud/django/__init__.py'
adding 'beproud/django/mailer/__init__.py'
adding 'beproud/django/mailer/api.py'
adding 'beproud/django/mailer/models.py'
adding 'beproud/django/mailer/signals.py'
adding 'beproud/django/mailer/tasks.py'
adding 'beproud/django/mailer/backends/__init__.py'
adding 'beproud/django/mailer/backends/base.py'
adding 'beproud/django/mailer/backends/console.py'
adding 'beproud/django/mailer/backends/dummy.py'
adding 'beproud/django/mailer/backends/filebased.py'
adding 'beproud/django/mailer/backends/locmem.py'
adding 'beproud/django/mailer/backends/smtp.py'
adding 'beproud/django/mailer/templates/mailer/html_mail.tpl'
adding 'beproud/django/mailer/templates/mailer/mail.tpl'
adding 'beproud/django/mailer/templatetags/__init__.py'
adding 'beproud/django/mailer/templatetags/mailer_tags.py'
adding 'docs/ja/source/conf.py'
adding 'tests/__init__.py'
adding 'tests/settings.py'
adding 'tests/test_mail.py'
adding 'bpmailer-1.3.dist-info/METADATA'
adding 'bpmailer-1.3.dist-info/WHEEL'
adding 'bpmailer-1.3.dist-info/top_level.txt'
adding 'bpmailer-1.3.dist-info/RECORD'
removing build/bdist.macosx-14-arm64/wheel
Successfully built bpmailer-1.3.tar.gz and bpmailer-1.3-py3-none-any.whl
(.venv) kashew@mbp14:bpmailer (feature/dj42)$
twine check --strict dist/*
Checking dist/bpmailer-1.3-py3-none-any.whl: PASSED
Checking dist/bpmailer-1.3.tar.gz: PASSED

@kashewnuts kashewnuts force-pushed the feature/dj42 branch 3 times, most recently from 5a40420 to 995b8b1 Compare February 2, 2024 03:59
@@ -1,2 +1 @@
recursive-include beproud/django/mailer/templates *
README.md
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

前のPRで削除されているのでこちらも削除

Comment on lines +4 to +5
mail_pre_send = Signal()
mail_post_send = Signal()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

4.0でSignalのコンストラクタの引数に、providing_argsが廃止。


[project]
name = "bpmailer"
version = "1.3"
Copy link
Collaborator Author

@kashewnuts kashewnuts Feb 2, 2024

Choose a reason for hiding this comment

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

python setup.pyで実行するコマンドは非推奨になりつつあるので、pyproject.tomlに移植。



手順
--------------------
1. 次バージョンのパッケージをビルド

* ``python setup.py sdist bdist_wheel``
* ``python -m build .``
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

現在はbuildを使うようになっているので記述を更新
refs: Python のプロジェクトをパッケージングする - Python Packaging User Guide

@@ -1,5 +0,0 @@
# toxを使用せず、直接 python tests.py で単体テスト実行する際に pip installするパッケージ一覧です。
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

python tests.pyは実行できなくなったので削除

@@ -0,0 +1,40 @@
SECRET_KEY = "SECRET"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

もとはtests.pyに一緒に記述していたものだが、pytestで実行するために切り出した。

@@ -1,34 +1,31 @@
#:coding=utf-8:

import logging
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

テストコードなのでアプリケーションコードには影響なし。
mockをunittestのものにしたり、 DeprecationWarning: Please use assertEqual instead. が出ていたのでごそっと置き換えたののついでにRuffでフォーマットをかけました。

Copy link
Member

Choose a reason for hiding this comment

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

ウワー差分がー(内容は流し読み

dj42: Django>=4.2,<5.0
celery52: celery>=5.2,<5.3
celery53: celery>=5.3,<5.4
commands=pytest {posargs}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

python setup.py test は非推奨になったのでpytestに置き換え

@kashewnuts kashewnuts marked this pull request as ready for review February 5, 2024 07:24
Copy link
Member

@shimizukawa shimizukawa left a comment

Choose a reason for hiding this comment

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

LGTM!!

@@ -1,34 +1,31 @@
#:coding=utf-8:

import logging
Copy link
Member

Choose a reason for hiding this comment

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

ウワー差分がー(内容は流し読み

"Environment :: Plugins",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = ["Django>=3.2", "six", "Celery"]
Copy link
Member

Choose a reason for hiding this comment

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

お、sixがまだ残ってますね。この機に削除でもよいかと思う(余力があれば)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

six消そうかなと思ったのですが、既存プロジェクトの他のパッケージで依存があったので、強いモチベーションがなくそのままにしました()

@ytakashima-1500 ytakashima-1500 self-requested a review February 6, 2024 04:39
Copy link
Contributor

@ae35bp ae35bp left a comment

Choose a reason for hiding this comment

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

LGTM

いろいろ勉強になった!

Copy link

@ytakashima-1500 ytakashima-1500 left a comment

Choose a reason for hiding this comment

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

@kashewnuts

LGTM!!

ありがとうございます。
知らないことだらけで、勉強になりましたー 😃

Comment on lines -42 to -71
setup(
name='bpmailer',
version='1.2',
description='Mailing utility for Django',
long_description=read_file('README.rst'),
long_description_content_type="text/x-rst",
author='BeProud Inc.',
author_email='project@beproud.jp',
url='https://github.com/beproud/bpmailer/',
python_requires='>=3.9',
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'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>=2.2', 'six', 'Celery'],
test_suite='tests.main',
zip_safe=False,
keywords=['django', 'mail']
)

Choose a reason for hiding this comment

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

[memo]

いくつかの引数が pyproject.toml になかったため、気になったので調べてみました。

@@ -1,19 +1,41 @@
# Requires tox > 1.8

[tox]
envlist = py39-django22
envlist = py{39,310,311}-dj{32,42}-celery{52,53},py312-dj42-celery53
skipsdist = True

Choose a reason for hiding this comment

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

[memo]

テスト結果を出力しないように指定しているらしい。

https://tox.wiki/en/latest/config.html#skipsdist
https://dev.classmethod.jp/articles/tox-without-dist/

@kashewnuts kashewnuts merged commit a589969 into master Feb 7, 2024
18 checks passed
@kashewnuts kashewnuts deleted the feature/dj42 branch February 7, 2024 01:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants