Skip to content

Commit

Permalink
Merge pull request #69 from bckohan/1.3.x
Browse files Browse the repository at this point in the history
1.3.3
  • Loading branch information
bckohan authored Aug 26, 2024
2 parents 2a41d56 + daf1eba commit 7d306f1
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 20 deletions.
45 changes: 37 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,57 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13.0-rc.1']
django-version:
- '3.2' # LTS April 2024
- '4.2' # LTS April 2026
- '5.0' # April 2025
- '5.1' # December 2025
drf-version:
- '3.14'
- '3.15'
filter-version:
- '23.5'
- '24.0'
exclude:
- python-version: '3.7'
django-version: '5.0'
- python-version: '3.7'
django-version: '4.2'
- python-version: '3.8'
django-version: '5.0'
- python-version: '3.9'
django-version: '5.0'
- python-version: '3.11'
django-version: '3.2'
- python-version: '3.12'
- python-version: '3.11'
django-version: '3.2'
- python-version: '3.7'
- python-version: '3.12'
django-version: '5.1'
- python-version: '3.8'
django-version: '5.1'
- python-version: '3.9'
django-version: '5.1'
- python-version: '3.13.0-rc.1'
django-version: '3.2'
- python-version: '3.13.0-rc.1'
django-version: '4.2'
- python-version: '3.13.0-rc.1'
django-version: '5.0'

- django-version: '3.2'
drf-version: '3.15'
- django-version: '4.2'
drf-version: '3.14'
- django-version: '5.0'
drf-version: '3.14'
- django-version: '5.1'
drf-version: '3.14'

- django-version: '3.2'
filter-version: '24.0'
- django-version: '4.2'
filter-version: '23.5'
- django-version: '5.0'
filter-version: '23.5'
- django-version: '5.1'
filter-version: '23.5'

steps:
- uses: actions/checkout@v4
Expand All @@ -43,7 +69,6 @@ jobs:
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install Basic Dependencies
Expand All @@ -58,6 +83,7 @@ jobs:
- name: Install enum-properties
run: |
poetry install -E properties
poetry run pip install -U "Django~=${{ matrix.django-version }}"
- name: Unit Tests w/ enum-properties
run: |
poetry run pytest --cov-fail-under=30
Expand All @@ -67,18 +93,21 @@ jobs:
- name: Install djangorestframework
run: |
poetry install -E djangorestframework
poetry run pip install -U "Django~=${{ matrix.django-version }}" "djangorestframework~=${{ matrix.drf-version }}"
- name: Run Unit Tests w/ djangorestframework
run: |
poetry run pytest --cov-fail-under=30
- name: Install django-filters
run: |
poetry install -E filters
poetry run pip install -U "Django~=${{ matrix.django-version }}" "djangorestframework~=${{ matrix.drf-version }}" "django-filter~=${{ matrix.filter-version }}"
- name: Run Unit Tests w/ django-filter
run: |
poetry run pytest --cov-fail-under=30
- name: Install all deps
run: |
poetry install -E all
poetry run pip install -U "Django~=${{ matrix.django-version }}" "djangorestframework~=${{ matrix.drf-version }}" "django-filter~=${{ matrix.filter-version }}"
- name: Run Full Unit Tests
run: |
poetry run pytest
Expand Down
2 changes: 1 addition & 1 deletion django_enum/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
'EnumFilter'
]

VERSION = (1, 3, 2)
VERSION = (1, 3, 3)

__title__ = 'Django Enum'
__version__ = '.'.join(str(i) for i in VERSION)
Expand Down
12 changes: 6 additions & 6 deletions django_enum/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3628,8 +3628,8 @@ def test_benchmark(self):
no_coerce_time = no_coerce_stop - no_coerce_start
# flag if performance degrades signficantly - running about 2x for big lookups
self.assertTrue((enum_time / choice_time) < 3)
self.assertTrue((enum_direct_time / choice_time) < 2.5)
self.assertTrue((no_coerce_time / choice_time) < 2.5)
self.assertTrue((enum_direct_time / choice_time) < 2.7)
self.assertTrue((no_coerce_time / choice_time) < 2.7)
print(
f'(EnumTester) Bulk Create -> '
f'EnumField: {enum_time} '
Expand Down Expand Up @@ -3700,8 +3700,8 @@ def test_single_field_benchmark(self):
f'ChoiceField: {choice_time}'
)
# Enum tends to be about ~12% slower
self.assertTrue((enum_time / choice_time) < 1.8)
self.assertTrue((no_coerce_time / choice_time) < 1.7)
self.assertTrue((enum_time / choice_time) < 2.3)
self.assertTrue((no_coerce_time / choice_time) < 2.0)

enum_start = perf_counter()
for _ in SingleEnumPerf.objects.iterator(chunk_size=self.CHUNK_SIZE):
Expand Down Expand Up @@ -3729,8 +3729,8 @@ def test_single_field_benchmark(self):
f'ChoiceField: {choice_time}'
)
# tends to be about 1.8x slower
self.assertTrue((enum_time / choice_time) < 2.5)
self.assertTrue((no_coerce_time / choice_time) < 2.2)
self.assertTrue((enum_time / choice_time) < 2.7)
self.assertTrue((no_coerce_time / choice_time) < 2.7)


class ExampleTests(TestCase): # pragma: no cover - why is this necessary?
Expand Down
6 changes: 6 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Change Log
==========

v1.3.3
======

* Implemented `Support python 3.13 <https://github.com/bckohan/django-enum/issues/67>`_
* Implemented `Drop support for Python 3.7 <https://github.com/bckohan/django-enum/issues/68>`_

v1.3.2
======

Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "django-enum"
version = "1.3.2"
version = "1.3.3"
description = "Full and natural support for enumerations as Django model fields."
authors = ["Brian Kohan <[email protected]>"]
license = "MIT"
Expand All @@ -24,12 +24,12 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: Site Management",
"Topic :: Software Development :: Libraries",
Expand All @@ -42,10 +42,10 @@ packages = [
exclude = ["django_enum/tests"]

[tool.poetry.dependencies]
python = ">=3.7,<4.0"
python = ">=3.8,<4.0"
Django = ">=3.2,<6.0"
enum-properties = {version = "^1.7.0", optional = true}
django-filter = {version = ">=21,<24", optional = true}
enum-properties = {version = ">=1.7.0,<2.0", optional = true}
django-filter = {version = ">=21", optional = true}
djangorestframework = {version = "^3.9", optional = true}

[tool.poetry.group.dev.dependencies]
Expand Down

0 comments on commit 7d306f1

Please sign in to comment.