Skip to content

Commit

Permalink
Merge branch 'release/3.1'
Browse files Browse the repository at this point in the history
* release/3.1:
  updates gitignore
  demoproject migrations
  lint
  lint
  updates
  drop
  • Loading branch information
saxix committed Oct 25, 2023
2 parents 92f3eba + d389da1 commit bbd8729
Show file tree
Hide file tree
Showing 45 changed files with 1,004 additions and 717 deletions.
11 changes: 11 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[flake8]
max-complexity = 20
max-line-length = 120
exclude = ~*
ignore = E401,W391,E128,E261,E731,Q000,W504,W606,W503,E203
;putty-ignore =
; tests/test_choice_as_instance.py : E501

per-file-ignores =
*/__init__.py:F401,F403
*/migrations/*:E501
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10" ]
django-version: [ "3.2", "4.0" ]
python-version: ["3.9", "3.11"]
django-version: [ "3.2", "4.2" ]
env:
PY_VER: ${{ matrix.python-version}}
DJ_VER: ${{ matrix.django-version}}
Expand Down
12 changes: 5 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
.DS_Store
*.egg-info
*.sqlite
.cache
.coverage
.idea
.tox
.*
~*
!.gitignore
!.flake8
!.bumpversion.cfg
/dist
/manage.py
/build
Expand Down
12 changes: 12 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[isort]
profile = black
;combine_as_imports = true
;default_section = THIRDPARTY
;include_trailing_comma = true
;line_length=80
;known_future_library=future,pies
;known_standard_library = six
;known_third_party = django
;known_first_party = strategy_field, demoproject.demoapp
;multi_line_output = 0
;sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

7 changes: 7 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Release 3.1
===========
* removes `display_attribute` from the Field, use Registry(label_attribute=...)
* add support for Django 4.2
* drop support python <3.8


Release 3.0
===========
* WARNING: some internal api changed. Possible backward incompatibility if some "internals" have been used
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ endif


demo:
cd tests/demo && ./manage.py syncdb
cd tests/demo && ./manage.py makemigrations
cd tests/demo && ./manage.py migrate
cd tests/demo && ./manage.py runserver
1 change: 0 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ DJANGO_SETTINGS_MODULE=demoproject.settings
django_find_project = false
norecursedirs = .tox .venv
python_files=tests/test_*.py
log_print = false
log_cli = false
addopts =
-rs
Expand Down
39 changes: 19 additions & 20 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
[isort]
combine_as_imports = true
default_section = THIRDPARTY
include_trailing_comma = true
line_length=80
known_future_library=future,pies
known_standard_library = six
known_third_party = django
known_first_party = strategy_field, demoproject.demoapp
multi_line_output = 0
sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER

[bdist_wheel]
universal=1

Expand All @@ -28,11 +16,22 @@ ignore =
*.sqlite
.tox/*

[flake8]
max-complexity = 12
max-line-length = 110
exclude = .tox,migrations,.git,docs,diff_match_patch.py, deploy/**,settings,~*
ignore = E401,W391,E128,E261,E731
putty-ignore =
; tests/test_choice_as_instance.py : E501
tests/test_multiple.py : E501
[black]
line-length = 120
include = '\.pyi?$'
exclude = .git
;/(
; \.git
; | \.hg
; | \.mypy_cache
; | \.tox
; | \.venv
; | venv
; | _build
; | buck-out
; | build
; | dist
; | migrations
; | snapshots
;)/
;'''
4 changes: 2 additions & 2 deletions src/strategy_field/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NAME = 'django-strategy-field'
VERSION = __version__ = "3.0.0"
NAME = "django-strategy-field"
VERSION = __version__ = "3.1.0"
4 changes: 3 additions & 1 deletion src/strategy_field/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from django.conf import settings

CLASSLOADER = getattr(settings, 'STRATEGY_CLASSLOADER', "strategy_field.utils.default_classloader")
CLASSLOADER = getattr(
settings, "STRATEGY_CLASSLOADER", "strategy_field.utils.default_classloader"
)
6 changes: 3 additions & 3 deletions src/strategy_field/contrib/drf.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import logging

from django.core.validators import BaseValidator
from rest_framework import serializers
from rest_framework.exceptions import ValidationError

from strategy_field.fields import ClassnameValidator
from strategy_field.utils import fqn, import_by_name
from ..fields import ClassnameValidator
from ..utils import fqn, import_by_name

logger = logging.getLogger(__name__)


class RegistryValidator(BaseValidator):

def __call__(self, value):
if not isinstance(value, (list, tuple)):
value = [value]
Expand Down
4 changes: 3 additions & 1 deletion src/strategy_field/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ class StrategyImportError(ImportError):


class StrategyAttributeError(AttributeError):
default_message = 'Unable to import %(name)s. %(module)s does not have %(class_str)s attribute'
default_message = (
"Unable to import %(name)s. %(module)s does not have %(class_str)s attribute"
)

def __init__(self, name, module, class_str, message=None):
self.name = str(name)
Expand Down
Loading

0 comments on commit bbd8729

Please sign in to comment.