From 376a577b2a1ef694d92d4b97bb165f0ddc2e6417 Mon Sep 17 00:00:00 2001 From: "KimSia, Sim" <245021+simkimsia@users.noreply.github.com> Date: Sun, 2 Apr 2023 11:17:36 +0800 Subject: [PATCH] Update tox.ini and pyproject.toml because tox upgraded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In tox.ini: - Replace whitelist_externals with allowlist_externals because whitelist_externals is deprecated - Added isolated_build = True - Remove install_command where it calls tox_install.sh - Drop tool.poetry.dev-dependencies and switch to using tool.poetry.extras in order for tox to detect them In ci.yml - Because now use tool.poetry.extras so when call `poetry install` need to incldue `—extras ‘test’` as argument The last 2 points about dropping dev-dependencies and using extras are from https://github.com/orgs/python-poetry/discussions/4307#discussioncomment-1041658 Fixes #212, #214, #215, #216, #218 --- .github/workflows/ci.yml | 16 ++++++++++------ CHANGELOG.md | 2 +- pyproject.toml | 38 ++++++++++++++++++++++++-------------- tox.ini | 21 +++++++++++++-------- 4 files changed, 48 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 810d9e8..2b98651 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,12 +29,12 @@ jobs: - python: "3.7" toxenv: py37-dj32 - python: "3.8" - toxenv: py38-dj32,py38-dj40,py38-dj41 + toxenv: py38-dj32,py38-dj40,py38-dj41,py38-dj42 - python: "3.9" - toxenv: py39-dj32,py39-dj40,py39-dj41 + toxenv: py39-dj32,py39-dj40,py39-dj41,py38-dj42 - python: "3.10" # Skip testing Django 4.0, already tested in previous workflow job. - toxenv: py310-dj32,py310-dj41,py310-djmain + toxenv: py310-dj32,py310-dj41,py310-dj42py,py310-djmain - python: "3.11" toxenv: py311-dj41,py311-dj42,py311-djmain # Tentative support for next Python pre-release. For the correct specifier, @@ -50,8 +50,12 @@ jobs: - uses: Gr1n/setup-poetry@v7 with: poetry-version: '1.1.12' - - run: pip install tox - - run: tox -q + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox + - name: Tox Test + run: tox env: TOXENV: ${{ matrix.toxenv }} build_site: @@ -83,7 +87,7 @@ jobs: restore-keys: | ${{ runner.os }}-python-py310- - run: poetry config virtualenvs.create false - - run: poetry install + - run: poetry install --extras 'test' - run: poetry run django-admin runserver --settings=tests.settings.production --pythonpath=. & # Docs website build. - run: poetry run mkdocs build --strict diff --git a/CHANGELOG.md b/CHANGELOG.md index b6ed404..110f8eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog ## [Unreleased] - +- Tentative support for Django 4.2 ([#212](https://github.com/torchbox/django-pattern-library/issues/212),[#213](https://github.com/torchbox/django-pattern-library/pull/213)). - Disable pointer events on menu chevron to allow clicks ([#202](https://github.com/torchbox/django-pattern-library/issues/202), [#205](https://github.com/torchbox/django-pattern-library/pull/205)) ## [1.0.0](https://github.com/torchbox/django-pattern-library/releases/tag/v1.0.0) - 2022-06-10 diff --git a/pyproject.toml b/pyproject.toml index 39029e1..ddbe356 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,7 @@ classifiers = [ "Framework :: Django :: 3.2", "Framework :: Django :: 4.0", "Framework :: Django :: 4.1", + "Framework :: Django :: 4.2", ] packages = [ { include = "pattern_library" }, @@ -44,21 +45,30 @@ exclude = [ [tool.poetry.dependencies] python = "^3.7" -Django = ">=3.2,<4.2" +Django = ">=3.2,<4.3" PyYAML = ">=5.1,<7.0" Markdown = "^3.1" -[tool.poetry.dev-dependencies] -beautifulsoup4 = "^4.8" -coverage = "^6.2" -flake8 = "^3.7" -isort = "^5.10.1" -mkdocs = "^1.1.2" -mkdocs-material = "^5.5.14" -pymdown-extensions = "^8.0" -mkdocs-git-revision-date-plugin = "^0.3.1" -mkdocs-redirects = "^1.0.3" -black = "^22.3.0" +# A list of all of the dev dependencies, some of which are included in the +# below `extras`. They can be opted into by apps. +beautifulsoup4 = { version = "^4.8", optional = true } +coverage = { version = "^6.2", optional = true } +flake8 = { version = "^3.7", optional = true } +isort = { version = "^5.10.1", optional = true} +mkdocs = { version = "^1.1.2", optional = true} +mkdocs-material = { version = "^5.5.14", optional = true} +pymdown-extensions = { version = "^8.0", optional = true} +mkdocs-git-revision-date-plugin = { version = "^0.3.1", optional = true} +mkdocs-redirects = { version = "^1.0.3", optional = true} +black = { version = "^22.3.0", optional = true} + +[tool.poetry.extras] +test = [ + "beautifulsoup4", "coverage", "flake8", + "isort", "mkdocs", "mkdocs-material", + "pymdown-extensions", "mkdocs-git-revision-date-plugin", + "mkdocs-redirects", "black" +] [tool.isort] known_first_party = "pattern_library" @@ -70,5 +80,5 @@ default_section = "THIRDPARTY" profile = "black" [build-system] -requires = ["poetry>=1.1.12"] -build-backend = "poetry.masonry.api" +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" diff --git a/tox.ini b/tox.ini index 78fc714..894840e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,18 @@ [tox] -envlist = py{37,38,39,310,311}-dj{32,40,41,42,main}, lint -skipsdist = true +envlist = + py{37,38,39,310}-dj32 + py{38,39,310,311}-dj40 + py{38,39,310,311}-dj41 + py{38,39,310,311}-dj42 + py{310,311}-djmain + lint +isolated_build = True [testenv] -whitelist_externals = +allowlist_externals = poetry -install_command = - ./tox_install.sh {packages} +extras = + test commands = poetry run python -X dev -W error runtests.py poetry run django-admin render_patterns --settings=tests.settings.dev --pythonpath=. --dry-run @@ -17,13 +23,12 @@ deps = ; Use pre-releases until stable releases are available. ; Switch to version range upon stable release. ; dj42: Django>=4.2,<4.3 - dj42: Django==4.2rc1 - + dj42: Django>=4.2rc1,<4.3 djmain: https://github.com/django/django/archive/main.zip + [testenv:lint] commands = - poetry install -q poetry run flake8 poetry run isort --check --diff . poetry run black --check --diff .