mirror of
https://github.com/SectorLabs/django-localized-fields.git
synced 2025-04-24 19:32:53 +03:00
Python 3.6, 3.9 and Django 3.0 compatibility
This commit is contained in:
parent
53d7cd0c66
commit
49d88af76a
@ -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
|
||||
|
@ -4,7 +4,7 @@
|
||||
| :memo: | **License** | [](http://doge.mit-license.org) |
|
||||
| :package: | **PyPi** | [](https://pypi.python.org/pypi/django-localized-fields) |
|
||||
| <img src="https://icon-library.net/images/django-icon/django-icon-0.jpg" width="22px" height="22px" align="center" /> | **Django Versions** | 2.0, 2.1, 2.2, 3.0 |
|
||||
| <img src="http://www.iconarchive.com/download/i73027/cornmanthe3rd/plex/Other-python.ico" width="22px" height="22px" align="center" /> | **Python Versions** | 3.7, 3.8 |
|
||||
| <img src="http://www.iconarchive.com/download/i73027/cornmanthe3rd/plex/Other-python.ico" width="22px" height="22px" align="center" /> | **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:
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
@ -1 +0,0 @@
|
||||
-e .
|
@ -1,2 +0,0 @@
|
||||
Sphinx==2.2.0
|
||||
sphinx-rtd-theme==0.4.3
|
@ -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
|
30
setup.py
30
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",
|
||||
|
@ -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."""
|
||||
|
6
tox.ini
6
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user