From cd66ec89d8a356074d96c662a21cfa6f0a5a313f Mon Sep 17 00:00:00 2001 From: Marco Bonetti Date: Wed, 13 Dec 2023 13:06:10 +0100 Subject: [PATCH] 0.6.0: test and support django 4.2 and 5.0 --- .github/workflows/test.yml | 4 +- .readthedocs.yaml | 16 +++++ docs/changes.rst | 5 ++ docs/conf.py | 56 +++++++++------ docs/installation.rst | 6 +- docs/requirements.txt | 1 + front/__init__.py | 6 ++ front/migrations/__init__.py | 21 ------ front/south_migrations/0001_initial.py | 32 --------- .../0002_auto__add_placeholderhistory.py | 41 ----------- front/south_migrations/__init__.py | 0 setup.py | 55 +++++++-------- test_project/.coveragerc | 1 - test_project/test_project/settings.py | 68 +++++++++---------- tox.ini | 34 +++++----- 15 files changed, 146 insertions(+), 200 deletions(-) create mode 100644 .readthedocs.yaml create mode 100644 docs/requirements.txt delete mode 100644 front/south_migrations/0001_initial.py delete mode 100644 front/south_migrations/0002_auto__add_placeholderhistory.py delete mode 100644 front/south_migrations/__init__.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cf7ef26..05ee572 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,13 +9,13 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: [3.7, 3.8, 3.9, "3.10"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v1 - uses: niden/actions-memcached@v7 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..06c9472 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,16 @@ +version: 2 +build: + os: ubuntu-22.04 + tools: + python: "3.10" + # You can also specify other tool versions: + # nodejs: "16" + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Dependencies required to build your docs +python: + install: + - requirements: docs/requirements.txt diff --git a/docs/changes.rst b/docs/changes.rst index 2bdad48..979ca89 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -2,6 +2,11 @@ Version history ############### +Version 0.6.0 +============== +* Django 4.2 and 5.0 support + + Version 0.5.15 ============== * Django 3.2 support diff --git a/docs/conf.py b/docs/conf.py index 9db4e63..3b72e17 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -16,7 +16,6 @@ import os import sys - # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. @@ -30,30 +29,38 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['sphinx.ext.autodoc'] +extensions = ["sphinx.ext.autodoc"] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix of source filenames. -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. # source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = 'Django-Front' -copyright = '2013-2020, Marco Bonetti and contributors' +project = "Django-Front" +copyright = "2013-2023, Marco Bonetti and contributors" + + +def get_version(): + sys.path.insert(0, os.path.abspath("..")) + from front import get_version as get_version_ + + return get_version_() + # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '0.5.14' +version = get_version() # The full version, including alpha/beta/rc tags. release = version @@ -69,7 +76,7 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ['_build'] +exclude_patterns = ["_build"] # The reST default role (used for this markup: `text`) to use for all # documents. @@ -87,7 +94,7 @@ # show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] @@ -101,6 +108,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = 'sphinx_rtd_theme' +html_theme = "sphinx_book_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -129,7 +137,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied @@ -178,7 +186,7 @@ # html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = 'Django-Frontdoc' +htmlhelp_basename = "Django-Frontdoc" # -- Options for LaTeX output --------------------------------------------- @@ -196,7 +204,13 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', 'Django-Front.tex', 'Django-Front Documentation', 'Marco Bonetti', 'manual') + ( + "index", + "Django-Front.tex", + "Django-Front Documentation", + "Marco Bonetti", + "manual", + ) ] # The name of an image file (relative to this directory) to place at the top of @@ -225,7 +239,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'django-front', 'Django-Front Documentation', ['Marco Bonetti'], 1) + ("index", "django-front", "Django-Front Documentation", ["Marco Bonetti"], 1) ] # If true, show URL addresses after external links. @@ -239,13 +253,13 @@ # dir menu entry, description, category) texinfo_documents = [ ( - 'index', - 'Django-Front', - 'Django-Front Documentation', - 'Marco Bonetti', - 'Django-Front', - 'One line description of project.', - 'Miscellaneous', + "index", + "Django-Front", + "Django-Front Documentation", + "Marco Bonetti", + "Django-Front", + "One line description of project.", + "Miscellaneous", ) ] diff --git a/docs/installation.rst b/docs/installation.rst index 952647e..c99253b 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -4,9 +4,9 @@ Installation Requirements ------------ -* Django-front supports Django 1.11 through 2.2 +* Django-front supports Django 4.2 and 5.0 * django-classy-tags -* Python 2.7+ or Python 3.5+ +* Python 3.9+ * jQuery is required in your template @@ -29,4 +29,4 @@ Installing django-front Testing ------- -* ``pip install tox && tox`` +* ``pip install --upgrade tox && tox`` diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..31c781b --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1 @@ +sphinx-book-theme diff --git a/front/__init__.py b/front/__init__.py index e69de29..c16a7d6 100644 --- a/front/__init__.py +++ b/front/__init__.py @@ -0,0 +1,6 @@ +VERSION = (0, 6, 0) + + +def get_version(limit=3): + """Return the version as a human-format string.""" + return ".".join([str(i) for i in VERSION[:limit]]) diff --git a/front/migrations/__init__.py b/front/migrations/__init__.py index 1c40ee0..e69de29 100644 --- a/front/migrations/__init__.py +++ b/front/migrations/__init__.py @@ -1,21 +0,0 @@ -""" -Django migrations for django-front app - -This package does not contain South migrations. South migrations can be found -in the ``south_migrations`` package. -""" - -SOUTH_ERROR_MESSAGE = """\n -For South support, customize the SOUTH_MIGRATION_MODULES setting like so: - - SOUTH_MIGRATION_MODULES = { - 'front': 'front.south_migrations', - } -""" - -# Ensure the user is not using Django 1.6 or below with South -try: - from django.db import migrations # noqa -except ImportError: - from django.core.exceptions import ImproperlyConfigured - raise ImproperlyConfigured(SOUTH_ERROR_MESSAGE) diff --git a/front/south_migrations/0001_initial.py b/front/south_migrations/0001_initial.py deleted file mode 100644 index 333b15e..0000000 --- a/front/south_migrations/0001_initial.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding model 'Placeholder' - db.create_table(u'front_placeholder', ( - ('key', self.gf('django.db.models.fields.CharField')(max_length=40, primary_key=True, db_index=True)), - ('value', self.gf('django.db.models.fields.TextField')(blank=True)), - )) - db.send_create_signal(u'front', ['Placeholder']) - - - def backwards(self, orm): - # Deleting model 'Placeholder' - db.delete_table(u'front_placeholder') - - - models = { - u'front.placeholder': { - 'Meta': {'object_name': 'Placeholder'}, - 'key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'primary_key': 'True', 'db_index': 'True'}), - 'value': ('django.db.models.fields.TextField', [], {'blank': 'True'}) - } - } - - complete_apps = ['front'] \ No newline at end of file diff --git a/front/south_migrations/0002_auto__add_placeholderhistory.py b/front/south_migrations/0002_auto__add_placeholderhistory.py deleted file mode 100644 index 5b02672..0000000 --- a/front/south_migrations/0002_auto__add_placeholderhistory.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- -from south.utils import datetime_utils as datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding model 'PlaceholderHistory' - db.create_table(u'front_placeholderhistory', ( - (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('placeholder', self.gf('django.db.models.fields.related.ForeignKey')(related_name='history', to=orm['front.Placeholder'])), - ('value', self.gf('django.db.models.fields.TextField')(blank=True)), - ('saved', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), - )) - db.send_create_signal(u'front', ['PlaceholderHistory']) - - - def backwards(self, orm): - # Deleting model 'PlaceholderHistory' - db.delete_table(u'front_placeholderhistory') - - - models = { - u'front.placeholder': { - 'Meta': {'object_name': 'Placeholder'}, - 'key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'primary_key': 'True', 'db_index': 'True'}), - 'value': ('django.db.models.fields.TextField', [], {'blank': 'True'}) - }, - u'front.placeholderhistory': { - 'Meta': {'object_name': 'PlaceholderHistory'}, - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'placeholder': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'history'", 'to': u"orm['front.Placeholder']"}), - 'saved': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'value': ('django.db.models.fields.TextField', [], {'blank': 'True'}) - } - } - - complete_apps = ['front'] \ No newline at end of file diff --git a/front/south_migrations/__init__.py b/front/south_migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/setup.py b/setup.py index 5330e50..113c575 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ class Tox(test_command): - user_options = [('tox-args=', 'a', "Arguments to pass to tox")] + user_options = [("tox-args=", "a", "Arguments to pass to tox")] def initialize_options(self): test_command.initialize_options(self) @@ -18,9 +18,10 @@ def finalize_options(self): def run_tests(self): # import here, cause outside the eggs aren't loaded - import tox import shlex + import tox + args = self.tox_args if args: args = shlex.split(self.tox_args) @@ -28,37 +29,37 @@ def run_tests(self): sys.exit(errno) -with open('README.rst') as readme: +with open("README.rst") as readme: long_description = readme.read() setup( - name='django-front', - version='0.5.15', - description='A Django application to allow of front-end editing', + name="django-front", + version=__import__("front").get_version(limit=3), + description="A Django application to allow of front-end editing", long_description=long_description, - author='Marco Bonetti', - author_email='mbonetti@gmail.com', - url='https://github.com/mbi/django-front', - license='MIT', - packages=find_packages(exclude=['test_project', 'test_project.*']), + author="Marco Bonetti", + author_email="mbonetti@gmail.com", + url="https://github.com/mbi/django-front", + license="MIT", + packages=find_packages(exclude=["test_project", "test_project.*"]), classifiers=[ - 'Development Status :: 4 - Beta', - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Framework :: Django', - 'Framework :: Django :: 2.2', - 'Framework :: Django :: 3.0', - 'Framework :: Django :: 3.1', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', + "Development Status :: 4 - Beta", + "Environment :: Web Environment", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Framework :: Django", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ], include_package_data=True, zip_safe=False, - install_requires=['django-classy-tags >= 1.0', 'Django >= 2.2', 'six'], - tests_require=['tox'], - cmdclass={'test': Tox}, + install_requires=["django-classy-tags >= 1.0", "Django >= 4.2", "six"], + tests_require=["tox~=4.11.4"], + cmdclass={"test": Tox}, ) diff --git a/test_project/.coveragerc b/test_project/.coveragerc index e6726ff..e77a9eb 100644 --- a/test_project/.coveragerc +++ b/test_project/.coveragerc @@ -4,7 +4,6 @@ source = front omit = ../*migrations* - ../*south_migrations* ../*tests* [report] precision = 2 diff --git a/test_project/test_project/settings.py b/test_project/test_project/settings.py index ef5e82b..34ce258 100644 --- a/test_project/test_project/settings.py +++ b/test_project/test_project/settings.py @@ -3,60 +3,60 @@ DEBUG = True DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(os.path.dirname(__file__), 'test_project.db'), + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": os.path.join(os.path.dirname(__file__), "test_project.db"), } } USE_I18N = True -USE_L10N = True -SECRET_KEY = 'lol I dont even care' +SECRET_KEY = "lol I dont even care" +USE_TZ = True -DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' +DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" MIDDLEWARE = ( - 'django.middleware.common.CommonMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.locale.LocaleMiddleware', + "django.middleware.common.CommonMiddleware", + "django.contrib.sessions.middleware.SessionMiddleware", + "django.middleware.csrf.CsrfViewMiddleware", + "django.contrib.auth.middleware.AuthenticationMiddleware", + "django.contrib.messages.middleware.MessageMiddleware", + "django.middleware.locale.LocaleMiddleware", ) TEMPLATES = [ { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'APP_DIRS': True, - 'OPTIONS': { - 'context_processors': ( - 'django.contrib.auth.context_processors.auth', - 'django.template.context_processors.debug', - 'django.template.context_processors.i18n', - 'django.template.context_processors.media', - 'django.template.context_processors.static', - 'django.template.context_processors.tz', - 'django.contrib.messages.context_processors.messages', - 'django.template.context_processors.request', + "BACKEND": "django.template.backends.django.DjangoTemplates", + "APP_DIRS": True, + "OPTIONS": { + "context_processors": ( + "django.contrib.auth.context_processors.auth", + "django.template.context_processors.debug", + "django.template.context_processors.i18n", + "django.template.context_processors.media", + "django.template.context_processors.static", + "django.template.context_processors.tz", + "django.contrib.messages.context_processors.messages", + "django.template.context_processors.request", ), - 'debug': False, + "debug": False, }, } ] -STATIC_URL = '/static/' +STATIC_URL = "/static/" -ROOT_URLCONF = 'test_project.urls' +ROOT_URLCONF = "test_project.urls" # Python dotted path to the WSGI application used by Django's runserver. -WSGI_APPLICATION = 'test_project.wsgi.application' +WSGI_APPLICATION = "test_project.wsgi.application" INSTALLED_APPS = ( - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.sites', - 'django.contrib.staticfiles', - 'front', + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sessions", + "django.contrib.sites", + "django.contrib.staticfiles", + "front", ) SITE_ID = 1 diff --git a/tox.ini b/tox.ini index 3ac0a03..89d84d2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,19 +1,18 @@ [tox] envlist = - py37-django{22,30,31,32}, - py38-django{22,30,31,32}, - py39-django{22,30,31,32}, - py310-django{32,40}, - flake8,docs + py{39,310}-django42, + py{310,311,312}-django50, + flake8, + docs skipsdist = True [gh-actions] python = - 3.10: py310-django32, py310-django40 - 3.9: py39-django22, py39-django30, py39-django31, py39-django32 - 3.8: py38-django22, py38-django30, py38-django31, py38-django32 - 3.7: py37-django22, py37-django30, py37-django31, py37-django32, flake8, docs + 3.9: py310-django42, flake8, docs + 3.10: py310-django42, py310-django50 + 3.11: py311-django42, py311-django50 + 3.12: py312-django50 [testenv] @@ -25,13 +24,10 @@ setenv = PYTHONDONTWRITEBYTECODE=1 deps = - django22: Django>=2.2,<3.0 - django30: Django>=3.0,<3.1 - django31: Django>=3.1,<3.2 - django32: Django>=3.2b1,<3.3 - django40: Django>=4.0a1,<4.1 + django42: Django>=4.2a,<4.3 + django50: Django>=5.0,<5.1 - python3-memcached + pymemcache coverage django-classy-tags south @@ -40,12 +36,15 @@ deps = [testenv:flake8] basepython = python3 -deps = flake8==2.4.1 +deps = flake8==3.9.2 commands= flake8 {toxinidir}/front [testenv:docs] -deps = sphinx +deps = + sphinx + sphinx-book-theme + changedir = docs commands= sphinx-build -W -b html . _build/html @@ -53,4 +52,3 @@ commands= [flake8] ignore = E501,W503 -exclude = south_migrations