Skip to content

Commit

Permalink
Merge pull request #177 from hvlads/update-ckeditor-5-package
Browse files Browse the repository at this point in the history
Update CKEditor 5 package, add type annotations, and improve error ha…
  • Loading branch information
hvlads authored Jan 6, 2024
2 parents aa374b9 + 17e5647 commit 7b479bd
Show file tree
Hide file tree
Showing 16 changed files with 592 additions and 468 deletions.
65 changes: 51 additions & 14 deletions .github/workflows/lint_python.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,59 @@
name: lint_python
on: [pull_request, push]

on:
pull_request:
push:

jobs:
lint_python:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- run: pip install --upgrade pip setuptools ruff
- run: pip install -e ".[dev]"
- run: black --check .
- run: codespell --ignore-words-list="ro" --skip="*.json,*.lock,./.git"
- run: ruff --format=github .
- run: pip install --editable .
- run: mypy --non-interactive .
- run: cp -R django_ckeditor_5 example/blog
- run: cd example
- run: pip install -e ".[dev]"
- run: pytest example/blog
- run: safety check

- name: Upgrade pip and install dependencies
run: |
pip install --upgrade pip setuptools ruff
pip install -e ".[dev]"
- name: Code formatting check
run: black --check .

- name: Spell check
run: codespell --ignore-words-list="ro" --skip="*.json,*.lock,./.git"

- name: Ruff check
run: ruff check .

- name: Type checking with mypy
run: mypy --non-interactive .

- name: Copy CKEditor files
run: cp -R django_ckeditor_5 example/blog

- name: Change directory to example
run: cd example

- name: Install dependencies in example
run: pip install -e ".[dev]"

- name: Run tests with pytest
run: pytest example/blog

- name: Print Python version
run: python --version

- name: Print pip version
run: pip --version

- name: List installed pip packages
run: pip list

# - name: Check for vulnerabilities
# run: safety check

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ example/blog/pyproject.toml
django_ckeditor_5/static/django_ckeditor_5/dist/*.map
django_ckeditor_5/static/django_ckeditor_5/dist
build.sh
lint.sh
lint.sh
venv
6 changes: 3 additions & 3 deletions django_ckeditor_5/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@


class CKEditor5Field(models.Field):
def __init__(self, *args, config_name="default", **kwargs):
def __init__(self, *args, config_name="default", **kwargs) -> None:
self.config_name = config_name
super().__init__(*args, **kwargs)

def get_internal_type(self):
def get_internal_type(self) -> str:
return "TextField"

def formfield(self, **kwargs):
Expand All @@ -17,5 +17,5 @@ def formfield(self, **kwargs):
"max_length": self.max_length,
**({"widget": CKEditor5Widget(config_name=self.config_name)}),
**kwargs,
}
},
)
Loading

0 comments on commit 7b479bd

Please sign in to comment.