From aa02dea9d6ae5c3511b7069eef6a79348a6c8981 Mon Sep 17 00:00:00 2001 From: Mark Walker Date: Thu, 15 Dec 2022 01:53:55 +0000 Subject: [PATCH] 3.0 (#509) --- .github/dependabot.yml | 11 ++++++++ .github/workflows/test.yml | 53 +++++++++++++++++++++++++++++++++----- HISTORY.rst | 26 +++++++++++++++++++ explorer/__init__.py | 4 +-- explorer/views/email.py | 2 +- requirements/base.txt | 1 - setup.py | 1 + tox.ini | 11 ++++---- 8 files changed, 92 insertions(+), 17 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..14f01789 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 31c49810..b925e4cb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,13 +8,16 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ 3.8] - requirements-file: [ - django-3.2.txt - ] + python-version: ['3.8', '3.9', '3.10', '3.11'] + django-version: ['3.2', '4.0', '4.1'] os: [ ubuntu-20.04, ] + exclude: + - python-version: '3.11' + django-version: '3.2' + - python-version: '3.11' + django-version: '4.0' steps: - uses: actions/checkout@v1 @@ -25,11 +28,47 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip + pip install -r requirements/base.txt pip install -r requirements/optional.txt - pip install -r requirements/${{ matrix.requirements-file }} + pip install Django==${{ matrix.django-version }} python setup.py install - name: Run tests + run: coverage run --source=explorer manage.py test + + - name: Upload Coverage to Codecov + uses: codecov/codecov-action@v3 + + unit-tests-future-versions: + # Runs for all Django/Python versions which are not yet supported + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ['3.8', '3.9', '3.10', '3.11'] + django-version: [ + 'https://github.com/django/django/archive/main.tar.gz' + ] + os: [ + ubuntu-20.04, + ] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies run: | - coverage run --source=explorer manage.py test - coverage report + python -m pip install --upgrade pip + pip install ${{ matrix.django-version }} coverage + python setup.py install + + - name: Run coverage + run: coverage run --source=explorer manage.py test + continue-on-error: true + + - name: Upload Coverage to Codecov + uses: codecov/codecov-action@v3 diff --git a/HISTORY.rst b/HISTORY.rst index 28a49eb7..6459d14a 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -9,6 +9,20 @@ This project adheres to `Semantic Versioning `_. --------------------- +`3.0.0`_ (2022-12-15) +--------------------- +* Add support for Django >3.2 and drop support for <3.2 +* Add support for Python 3.9, 3.10 and 3.11 and drop support for <3.8 +* `#496`_: Document breakage of "Format" button due to ``CSRF_COOKIE_HTTPONLY`` (`#492`_) +* `#497`_: Avoid execution of parameterised queries when viewing query +* `#498`_: Change sql blacklist functionality from regex to sqlparse +* `#500`_: Form display in popup now requires sanitize: false flag +* `#501`_: Updated celery support +* `#504`_: Added pre-commit hooks +* `#505`_: Feature/more s3 providers +* `#506`_: Check sql blacklist on execution as well as save +* `#508`_: Conditionally import optional packages + `2.5.0`_ (2022-10-09) --------------------- * `#494`_: Fixes Security hole in blacklist for MySQL (`#490`_) @@ -360,6 +374,8 @@ Initial Release .. _2.4.0: https://github.com/groveco/django-sql-explorer/compare/2.3.0...2.4.0 .. _2.4.1: https://github.com/groveco/django-sql-explorer/compare/2.4.0...2.4.1 .. _2.4.2: https://github.com/groveco/django-sql-explorer/compare/2.4.1...2.4.2 +.. _2.5.0: https://github.com/groveco/django-sql-explorer/compare/2.4.2...2.5.0 +.. _3.0.0: https://github.com/groveco/django-sql-explorer/compare/2.5.0...3.0.0 .. _unreleased: https://github.com/groveco/django-sql-explorer/compare/2.4.2...master .. _#254: https://github.com/groveco/django-sql-explorer/pull/254 @@ -410,6 +426,15 @@ Initial Release .. _#484: https://github.com/groveco/django-sql-explorer/pull/484 .. _#488: https://github.com/groveco/django-sql-explorer/pull/488 .. _#494: https://github.com/groveco/django-sql-explorer/pull/494 +.. _#496: https://github.com/groveco/django-sql-explorer/pull/496 +.. _#497: https://github.com/groveco/django-sql-explorer/pull/497 +.. _#498: https://github.com/groveco/django-sql-explorer/pull/498 +.. _#500: https://github.com/groveco/django-sql-explorer/pull/500 +.. _#501: https://github.com/groveco/django-sql-explorer/pull/501 +.. _#504: https://github.com/groveco/django-sql-explorer/pull/504 +.. _#505: https://github.com/groveco/django-sql-explorer/pull/505 +.. _#506: https://github.com/groveco/django-sql-explorer/pull/506 +.. _#508: https://github.com/groveco/django-sql-explorer/pull/508 .. _#269: https://github.com/groveco/django-sql-explorer/issues/269 .. _#288: https://github.com/groveco/django-sql-explorer/issues/288 @@ -425,5 +450,6 @@ Initial Release .. _#477: https://github.com/groveco/django-sql-explorer/issues/477 .. _#483: https://github.com/groveco/django-sql-explorer/issues/483 .. _#490: https://github.com/groveco/django-sql-explorer/issues/490 +.. _#492: https://github.com/groveco/django-sql-explorer/issues/492 .. _furo: https://github.com/pradyunsg/furo diff --git a/explorer/__init__.py b/explorer/__init__.py index 51908cbe..499cde23 100644 --- a/explorer/__init__.py +++ b/explorer/__init__.py @@ -1,6 +1,6 @@ __version_info__ = { - 'major': 2, - 'minor': 5, + 'major': 3, + 'minor': 0, 'micro': 0, 'releaselevel': 'final', 'serial': 0 diff --git a/explorer/views/email.py b/explorer/views/email.py index 8a739f66..8b1e981a 100644 --- a/explorer/views/email.py +++ b/explorer/views/email.py @@ -10,7 +10,7 @@ class EmailCsvQueryView(PermissionRequiredMixin, View): permission_required = 'view_permission' def post(self, request, query_id, *args, **kwargs): - if request.is_ajax(): + if request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest': email = request.POST.get('email', None) if email: execute_query.delay(query_id, email) diff --git a/requirements/base.txt b/requirements/base.txt index c3fe190a..bf4129f5 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,3 +1,2 @@ -Django>=2.2.14 sqlparse>=0.4.0 coverage diff --git a/setup.py b/setup.py index 35b016b9..77327339 100644 --- a/setup.py +++ b/setup.py @@ -77,6 +77,7 @@ def read(fname): 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3 :: Only', ], python_requires='>=3.8', diff --git a/tox.ini b/tox.ini index 54498f00..70e0e9f4 100644 --- a/tox.ini +++ b/tox.ini @@ -2,9 +2,8 @@ envlist = flake8 isort - py{36}-dj{32} -; py{38,39,310}-dj{32,40,41,main} -; py{310,311}-dj{41,main} + py{38,39,310}-dj{32,40,41,main} + py{310,311}-dj{41,main} skip_missing_interpreters=True @@ -13,9 +12,9 @@ deps = -r{toxinidir}/requirements/base.txt -r{toxinidir}/requirements/optional.txt dj32: Django>=3.2,<3.3 -; dj40: Django>=4.0,<4.1 -; dj41: Django>=4.1,<4.2 -; djmain: https://github.com/django/django/archive/main.tar.gz + dj40: Django>=4.0,<4.1 + dj41: Django>=4.1,<4.2 + djmain: https://github.com/django/django/archive/main.tar.gz commands = {envpython} --version {env:COMMAND:coverage} erase