diff --git a/.circleci/config.yml b/.circleci/config.yml
index f2e42e9..83e63b4 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,5 +1,32 @@
version: 2
jobs:
+ test-python36:
+ docker:
+ - image: python:3.6-alpine
+ - image: postgres:11.0
+ environment:
+ POSTGRES_DB: 'localizedfields'
+ POSTGRES_USER: 'localizedfields'
+ POSTGRES_PASSWORD: 'localizedfields'
+ steps:
+ - checkout
+ - run:
+ name: Install packages
+ command: apk add postgresql-libs gcc musl-dev postgresql-dev git
+
+ - run:
+ name: Install Python packages
+ command: pip install --progress-bar off .[test]
+
+ - run:
+ name: Run tests
+ command: tox -e 'py36-dj{20,21,22,30}'
+ environment:
+ DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields'
+
+ - store_test_results:
+ path: reports
+
test-python37:
docker:
- image: python:3.7-alpine
@@ -16,7 +43,7 @@ jobs:
- run:
name: Install Python packages
- command: pip install -r requirements/test.txt
+ command: pip install --progress-bar off .[test]
- run:
name: Run tests
@@ -43,7 +70,7 @@ jobs:
- run:
name: Install Python packages
- command: pip install -r requirements/test.txt
+ command: pip install --progress-bar off .[test]
- run:
name: Run tests
@@ -54,6 +81,33 @@ jobs:
- store_test_results:
path: reports
+ test-python39:
+ docker:
+ - image: python:3.9-rc-alpine3.10
+ - image: postgres:11.0
+ environment:
+ POSTGRES_DB: 'localizedfields'
+ POSTGRES_USER: 'localizedfields'
+ POSTGRES_PASSWORD: 'localizedfields'
+ steps:
+ - checkout
+ - run:
+ name: Install packages
+ command: apk add postgresql-libs gcc musl-dev postgresql-dev git
+
+ - run:
+ name: Install Python packages
+ command: pip install --progress-bar off .[test]
+
+ - run:
+ name: Run tests
+ command: tox -e 'py39-dj{21,22,30}'
+ environment:
+ DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields'
+
+ - store_test_results:
+ path: reports
+
analysis:
docker:
- image: python:3.7-alpine
@@ -65,7 +119,7 @@ jobs:
- run:
name: Install Python packages
- command: pip install -r requirements/analysis.txt
+ command: pip install --progress-bar off .[analysis]
- run:
name: Verify formatting / linting
@@ -76,6 +130,8 @@ workflows:
version: 2
build:
jobs:
+ - test-python36
- test-python37
- test-python38
+ - test-python39
- analysis
diff --git a/README.md b/README.md
index b8d02a2..b8fe2ab 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
| :memo: | **License** | [](http://doge.mit-license.org) |
| :package: | **PyPi** | [](https://pypi.python.org/pypi/django-localized-fields) |
|
| **Django Versions** | 2.0, 2.1, 2.2, 3.0 |
-|
| **Python Versions** | 3.7, 3.8 |
+|
| **Python Versions** | 3.6, 3.7, 3.8 |
| :book: | **Documentation** | [Read The Docs](https://django-localized-fields.readthedocs.io) |
| :warning: | **Upgrade** | [Upgrade fom v5.x](https://django-localized-fields.readthedocs.io/en/latest/releases.html#v6-0)
| :checkered_flag: | **Installation** | [Installation Guide](https://django-localized-fields.readthedocs.io/en/latest/installation.html) |
@@ -22,13 +22,13 @@
* PostgreSQL 10 or newer.
* Django 2.0 or newer.
-* Python 3.7 or newer.
+* Python 3.6 or newer.
### Getting started
1. Clone the repository:
- λ git clone https://github.com/SectorLabs/django-localized-fields.git
+ λ git clone https://github.com/SectorLabs/django-localized-fields.git
2. Create a virtual environment:
@@ -47,8 +47,7 @@
4. Install the development/test dependencies:
- λ pip install -r requirements/test.txt
- λ pip install -r requirements/analysis.txt
+ λ pip install .[test] .[analysis]
5. Run the tests:
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 980858a..80c3872 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -3,7 +3,7 @@ Welcome
``django-localized-fields`` is a Django library that provides fields to store localized content (content in various languages) in a PostgreSQL database. It does this by utilizing the PostgreSQL ``hstore`` type, which is available in Django as ``HStoreField`` since Django 1.10.
-This package requires Python 3.7 or newer, Django 2.0 or newer and PostgreSQL 10 or newer.
+This package requires Python 3.6 or newer, Django 2.0 or newer and PostgreSQL 10 or newer.
.. toctree::
:maxdepth: 2
diff --git a/localized_fields/fields/bleach_field.py b/localized_fields/fields/bleach_field.py
index 121a4a3..18fadfe 100644
--- a/localized_fields/fields/bleach_field.py
+++ b/localized_fields/fields/bleach_field.py
@@ -1,7 +1,4 @@
-import bleach
-
from django.conf import settings
-from django_bleach.utils import get_bleach_default_options
from .field import LocalizedField
@@ -22,6 +19,20 @@ class LocalizedBleachField(LocalizedField):
to the database or an update.
"""
+ # the bleach library vendors dependencies and the html5lib
+ # dependency is incompatible with python 3.9, until that's
+ # fixed, you cannot use LocalizedBleachField with python 3.9
+ # sympton:
+ # ImportError: cannot import name 'Mapping' from 'collections'
+ try:
+ import bleach
+
+ from django_bleach.utils import get_bleach_default_options
+ except ImportError:
+ raise UserWarning(
+ "LocalizedBleachField is not compatible with Python 3.9 yet."
+ )
+
localized_value = getattr(instance, self.attname)
if not localized_value:
return None
diff --git a/requirements/analysis.txt b/requirements/analysis.txt
deleted file mode 100644
index a00cadf..0000000
--- a/requirements/analysis.txt
+++ /dev/null
@@ -1,8 +0,0 @@
--r base.txt
-
-black==19.3b0
-flake8==3.7.7
-autoflake==1.3
-autopep8==1.4.4
-isort==4.3.20
-sl-docformatter==1.4
diff --git a/requirements/base.txt b/requirements/base.txt
deleted file mode 100644
index d6e1198..0000000
--- a/requirements/base.txt
+++ /dev/null
@@ -1 +0,0 @@
--e .
diff --git a/requirements/docs.txt b/requirements/docs.txt
deleted file mode 100644
index ed7aeea..0000000
--- a/requirements/docs.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-Sphinx==2.2.0
-sphinx-rtd-theme==0.4.3
diff --git a/requirements/test.txt b/requirements/test.txt
deleted file mode 100644
index 8e9dd08..0000000
--- a/requirements/test.txt
+++ /dev/null
@@ -1,14 +0,0 @@
--r base.txt
-
-# Tests
-coverage==4.4.2
-tox==2.9.1
-pytest==5.2.1
-pytest-django==3.6.0
-pytest-cov==2.8.1
-
-# Test support
-dj-database-url==0.4.2
-django-autoslug==1.9.3
-django-bleach==0.3.0
-psycopg2==2.8.4
diff --git a/setup.py b/setup.py
index 203ccfe..051ac40 100644
--- a/setup.py
+++ b/setup.py
@@ -36,7 +36,7 @@ with open(
setup(
name="django-localized-fields",
- version="6.0b1",
+ version="6.0b2",
packages=find_packages(exclude=["tests"]),
include_package_data=True,
license="MIT License",
@@ -62,16 +62,38 @@ setup(
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
- "Programming Language :: Python :: 3.5",
+ "Programming Language :: Python :: 3.6",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
],
- python_requires=">=3.7",
+ python_requires=">=3.6",
install_requires=[
"Django>=2.0",
- "django-postgres-extra>=2.0a7,<3.0",
+ "django-postgres-extra>=2.0a14,<3.0",
"deprecation==2.0.7",
],
+ extras_require={
+ ':python_version <= "3.6"': ["dataclasses"],
+ "docs": ["Sphinx==2.2.0", "sphinx-rtd-theme==0.4.3"],
+ "test": [
+ "tox==3.14.3",
+ "pytest==5.3.2",
+ "pytest-django==3.7.0",
+ "pytest-cov==2.8.1",
+ "dj-database-url==0.5.0",
+ "django-autoslug==1.9.6",
+ "django-bleach==0.6.1",
+ "psycopg2==2.8.4",
+ ],
+ "analysis": [
+ "black==19.3b0",
+ "flake8==3.7.7",
+ "autoflake==1.3",
+ "autopep8==1.4.4",
+ "isort==4.3.20",
+ "sl-docformatter==1.4",
+ ],
+ },
cmdclass={
"lint": create_command(
"Lints the code",
diff --git a/tests/test_bleach_field.py b/tests/test_bleach_field.py
index 7800158..23ba4a9 100644
--- a/tests/test_bleach_field.py
+++ b/tests/test_bleach_field.py
@@ -1,12 +1,23 @@
-import bleach
+"""isort:skip_file."""
+
+import sys
+
+import pytest
from django.conf import settings
from django.test import TestCase
-from django_bleach.utils import get_bleach_default_options
from localized_fields.fields import LocalizedBleachField
from localized_fields.value import LocalizedValue
+try:
+ import bleach
+
+ from django_bleach.utils import get_bleach_default_options
+except ImportError:
+ if sys.version_info >= (3, 9):
+ pytest.skip("feature not ready for python 3.9", allow_module_level=True)
+
class ModelTest:
"""Used to declare a bleach-able field on."""
diff --git a/tox.ini b/tox.ini
index 37c221d..7ff617f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,13 +1,13 @@
[tox]
-envlist = py37-dj{20,21,22,30}, py38-dj{20,21,22,30}
+envlist = py36-dj{20,21,22,30}, py37-dj{20,21,22,30}, py38-dj{20,21,22,30}, py39-dj{21,22,30}
[testenv]
deps =
dj20: Django>=2.0,<2.1
dj21: Django>=2.1,<2.2
dj22: Django>=2.2,<2.3
- dj30: Django>=3.0a1,<3.1
- -rrequirements/test.txt
+ dj30: Django>=3.0,<3.0.2
+ .[test]
setenv =
DJANGO_SETTINGS_MODULE=settings
passenv = DATABASE_URL