-
Notifications
You must be signed in to change notification settings - Fork 445
Pinax 22.12 Release Plan
- Config Changes
- Update Makefile
- Create or Update CircleCI config.yml
- Update tox.ini
- Update setup.py
- Update README.md
- checkqa Updates
- Django Updates
Black is a Python code formatter.
Black has been added to tox.ini
. Upon running tox, black will reformat files in the pinax
folder.
Per Black, Flake8 E203 violates Pep8. This rule will be disabled while in discussion.
Without disabling E203, Flake8 will detect a problem in the pinax/messages/conf.py
file at line 11, character 40. Rule E203
says that Colons should not have any space before them.
.
checkqa runtests: commands[0] | flake8 pinax
pinax/messages/conf.py:11:40: E203 whitespace before ':'
ERROR: InvocationError for command '/Users/katherinemichel/pinax-messages/.tox/checkqa/bin/flake8 pinax' (exited with code 1)
This
module, attr = path[:i], path[i + 1 :]
Versus this:
module, attr = path[:i], path[i + 1:]
If Black were run afterward, it would add the space.
isort 5.0.0 is the first major release of isort in 5 years and introduces some breaking changes.
The isort CLI --recursive
flag can be removed, because isort now traverses directories by default.
/Users/katherinemichel/pinax-messages/.tox/checkqa/lib/python3.8/site-packages/isort/main.py:1261: UserWarning: W0501: The following deprecated CLI flags were used and ignored: --recursive!
warn(
The isort CLI -sp
flag can be changed to the long form --settings-path
, because isort no longer accepts 1 dash.
/Users/katherinemichel/pinax-messages/.tox/checkqa/lib/python3.8/site-packages/isort/main.py:1256: UserWarning: W0502: The following deprecated single dash CLI flags were used and translated: -sp!
warn(
/Users/katherinemichel/pinax-messages/.tox/checkqa/lib/python3.8/site-packages/isort/main.py:1265: UserWarning: W0500: Please see the 5.0.0 Upgrade guide: https://pycqa.github.io/isort/docs/upgrade_guides/5.0.0.html
warn(
This:
isort --recursive --check-only --diff pinax -sp tox.ini
Becomes this:
isort --check-only --diff pinax --settings-path tox.ini
all: init test
init:
python setup.py develop
pip install tox "coverage==6.5.0"
test:
coverage erase
tox --parallel--safe-build
coverage html
# config.yml
version: 2.1
common: &common
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v2-deps-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
- v2-deps-
- run:
name: install dependencies
command: pip install --user tox codecov "coverage==6.5.0"
- run:
name: run tox
command: ~/.local/bin/tox
- run:
name: upload coverage report
command: |
if [[ "$UPLOAD_COVERAGE" != 0 ]]; then
PATH=$HOME/.local/bin:$PATH
coverage xml
~/.local/bin/codecov --required -X search gcov pycov -f coverage.xml --flags $CIRCLE_JOB
fi
- save_cache:
paths:
- .tox
- ~/.cache/pip
- ~/.local
- ./eggs
key: v2-deps-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
jobs:
lint:
<<: *common
docker:
- image: circleci/python:3.10
environment:
- TOXENV=checkqa
- UPLOAD_COVERAGE=0
py37dj32:
<<: *common
docker:
- image: circleci/python:3.7
environment:
TOXENV=py37-dj32
py38dj32:
<<: *common
docker:
- image: circleci/python:3.8
environment:
TOXENV=py38-dj32
py38dj40:
<<: *common
docker:
- image: circleci/python:3.8
environment:
TOXENV=py38-dj40
py38dj41:
<<: *common
docker:
- image: circleci/python:3.8
environment:
TOXENV=py38-dj41
py39dj32:
<<: *common
docker:
- image: circleci/python:3.9
environment:
TOXENV=py39-dj32
py39dj40:
<<: *common
docker:
- image: circleci/python:3.9
environment:
TOXENV=py39-dj40
py39dj41:
<<: *common
docker:
- image: circleci/python:3.9
environment:
TOXENV=py39-dj41
py310dj32:
<<: *common
docker:
- image: circleci/python:3.10
environment:
TOXENV=py310-dj32
py310dj40:
<<: *common
docker:
- image: circleci/python:3.10
environment:
TOXENV=py310-dj40
py310dj41:
<<: *common
docker:
- image: circleci/python:3.10
environment:
TOXENV=py310-dj41
workflows:
version: 2
test:
jobs:
- lint
- py37dj32
- py38dj32
- py38dj40
- py38dj41
- py39dj32
- py39dj40
- py39dj41
- py310dj32
- py310dj40
- py310dj41
# tox.ini
[flake8]
ignore = E203,E265,E501,W504
max-line-length = 100
max-complexity = 10
exclude = **/*/migrations/*
inline-quotes = double
[isort]
multi_line_output=3
known_django=django
known_third_party=appconf,pinax
sections=FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
include_trailing_comma=True
skip_glob=**/*/migrations/*
[coverage:run]
source = pinax
omit = **/*/conf.py,**/*/tests/*,**/*/migrations/*,**/*/admin.py
branch = true
data_file = .coverage
[coverage:report]
omit = **/*/conf.py,**/*/tests/*,**/*/migrations/*,**/*/admin.py
exclude_lines =
coverage: omit
show_missing = True
[tox]
envlist =
checkqa,
py{37}-dj{32}
py{38, 39, 310}-dj{40, 41}
[testenv]
passenv = CI CIRCLECI CIRCLE_*
deps =
coverage==6.5.0
codecov
dj32: Django>=3.2,<4.0
dj40: Django>=4.0,<4.1
dj41: Django>=4.1,<4.2
master: https://github.com/django/django/tarball/master
usedevelop = True
commands =
coverage run setup.py test
coverage report -m --skip-covered
[testenv:checkqa]
commands =
flake8 pinax
isort --check-only --diff pinax --settings-path tox.ini
black pinax
deps =
flake8 == 5.0.4
flake8-quotes == 3.3.1
isort == 5.10.01
black == 22.8.0
Supported Django and Python Versions
------------------------------------
+-----------------+-----+-----+-----+------+
| Django / Python | 3.7 | 3.8 | 3.9 | 3.10 |
+=================+=====+=====+=====+======+
| 3.2 | * | * | * | * |
+-----------------+-----+-----+-----+-----+
| 4.0 | | * | * | * |
+-----------------+-----+-----+-----+-----+
| 4.1 | | * | * | * |
+-----------------+-----+-----+-----+-----+
Note: Development Status` is not always
Production/Stable``
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.1",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Software Development :: Libraries :: Python Modules",
],
#### Supported Django and Python Versions
Django / Python | 3.7 | 3.8 | 3.9 | 3.10
--------------- | --- | --- | --- | ---
3.2 | * | * | * | *
4.0 | | * | * | *
4.1 | | * | * | *
Refer to the Django 3.2, Django 4.0, and Django 4.1 release notes for more info about changes.
The providing_args
argument for django.dispatch.Signal
was removed in Django 4.0.
File "/Users/katherinemichel/pinax-messages/pinax/messages/models.py", line 6, in <module>
from .signals import message_sent
File "/Users/katherinemichel/pinax-messages/pinax/messages/signals.py", line 3, in <module>
message_sent = Signal(providing_args=["message", "thread", "reply"])
TypeError: __init__() got an unexpected keyword argument 'providing_args'
This:
from django.dispatch import Signal
message_sent = Signal(providing_args=["message", "thread", "reply"])
Becomes this:
from django.dispatch import Signal
message_sent = Signal()
django.conf.urls.url
was changed to django.urls.re_path
in Django 4.0. See the re_path
docs for more info about its use.
File "/Users/katherinemichel/pinax-messages/pinax/messages/tests/urls.py", line 1, in <module>
from django.conf.urls import include, url
ImportError: cannot import name 'url' from 'django.conf.urls' (/Users/katherinemichel/pinax-messages/.tox/py310-dj41/lib/python3.8/site-packages/django/conf/urls/__init__.py)
This:
# Snippet
from django.conf.urls import url
from . import views
app_name = "pinax_messages"
urlpatterns = [
url(r"^inbox/$", views.InboxView.as_view(), name="inbox"),
# More code
),
]
Becomes this:
# Snippet
from django.urls import re_path
from . import views
app_name = "pinax_messages"
urlpatterns = [
re_path(r"^inbox/$", views.InboxView.as_view(), name="inbox"),
# More code
),
]
Update test files as well
File "/Users/katherinemichel/pinax-messages/pinax/messages/tests/urls.py", line 1, in <module>
from django.conf.urls import include, url
ImportError: cannot import name 'url' from 'django.conf.urls' (/Users/katherinemichel/pinax-messages/.tox/py310-dj41/lib/python3.8/site-packages/django/conf/urls/__init__.py)
This:
from django.conf.urls import include, url
urlpatterns = [
url(r"^", include("pinax.messages.urls", namespace="pinax_messages")),
]
Becomes this:
from django.urls import include, re_path
urlpatterns = [
re_path(r"^", include("pinax.messages.urls", namespace="pinax_messages")),
]
Example error message after trying to run Python 3.7 and Django 4.0 together:
ERROR: py37-dj40: could not install deps [coverage, codecov, Django>=4.0,<4.1]; v = InvocationError('/Users/katherinemichel/pinax-messages/.tox/py37-dj40/bin/python -m pip install coverage codecov Django>=4.0,<4.1 (see /Users/katherinemichel/pinax-messages/.tox/py37-dj40/log/py37-dj40-1.log)', 1)
See Customizing type of auto-created primary keys Django 3.2 release notes
WARNINGS:
pinax_messages.Message: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
pinax_messages.Thread: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
pinax_messages.UserThread: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
System check identified 3 issues (0 silenced).
......./Users/katherinemichel/pinax-messages/.tox/py310-dj40/lib/python3.8/site-packages/django/views/generic/base.py:77: DeleteViewCustomDeleteWarning: DeleteView uses FormMixin to handle POST requests. As a consequence, any custom deletion logic in ThreadDeleteView.delete() handler should be moved to form_valid().
self = cls(**initkwargs)