Skip to content

Feat/better compatibility and update ci cd #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
python-version: "3.12"
cache: "pip"
- run: |
python -m pip install --upgrade pip
pip install ruff
Expand Down
44 changes: 22 additions & 22 deletions .github/workflows/publish-to-live-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.

- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
48 changes: 24 additions & 24 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.

- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://test.pypi.org/legacy/
skip_existing: true
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://test.pypi.org/legacy/
skip_existing: true
52 changes: 24 additions & 28 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,33 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12"] # latest release minus two
requirements-file: [
dj42_cms311.txt,
dj42_cms41.txt,
dj50_cms41.txt,
dj51_cms41.txt
]
os: [
ubuntu-20.04,
]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
requirements-file:
[dj42_cms311.txt, dj42_cms41.txt, dj50_cms41.txt, dj51_cms41.txt]
os: [ubuntu-20.04]
exclude:
- python-version: "3.9"
requirements-file: dj50_cms41.txt
- python-version: "3.9"
requirements-file: dj51_cms41.txt
- python-version: "3.9"
requirements-file: dj50_cms41.txt
- python-version: "3.9"
requirements-file: dj51_cms41.txt

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}

uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r tests/requirements/${{ matrix.requirements-file }}
python setup.py install
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r tests/requirements/${{ matrix.requirements-file }}
python setup.py install

- name: Run coverage
run: coverage run tests/settings.py
- name: Run coverage
run: coverage run tests/settings.py

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v1
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
14 changes: 1 addition & 13 deletions djangocms_attributes_field/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,7 @@ def formfield(self, **kwargs):
defaults["excluded_keys"] = self.excluded_keys
return super().formfield(**defaults)

# This was added to keep backwards compatibility with Django 2.2 while also
# avoiding a RemovedInDjango30Warning caused by the deprecation of
# context argument
if DJANGO_2_2:
def from_db_value(self, value,
expression=None, connection=None, context=None):
self._from_db_value(value)
else:
def from_db_value(self, value,
expression=None, connection=None):
self._from_db_value(value)

def _from_db_value(self, value):
def from_db_value(self, value, expression=None, connection=None):
"""
This is a temporary workaround for #7 taken from
https://bitbucket.org/schinckel/django-jsonfield/pull-requests/32/make-from_db_value-compatible-with/diff
Expand Down
5 changes: 2 additions & 3 deletions djangocms_attributes_field/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from platform import python_version
from django import get_version

from distutils.version import LooseVersion
from platform import python_version

from django import get_version

DJANGO_VERSION = get_version()
PYTHON_VERSION = python_version()
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ ignore="H023,T003,H006,H031,D018,H021,H025"
profile="django"

[tool.ruff]
exclude = [
lint.exclude = [
".env",
".venv",
"**/migrations/**",
]
ignore = [
lint.ignore = [
"E501", # line too long
"F403", # 'from module import *' used; unable to detect undefined names
"E701", # multiple statements on one line (colon)
"F401", # module imported but unused
]
line-length = 119
select = [
lint.select = [
"I",
"E",
"F",
Expand Down