Skip to content

Commit

Permalink
v2.1.1 (#5)
Browse files Browse the repository at this point in the history
* v2.1.1

* v2.1.1

* v2.1.1

* v2.1.1

* v2.1.1

* v2.1.1

---------

Co-authored-by: Ronny Vedrilla <[email protected]>
  • Loading branch information
GitRon and Ronny Vedrilla committed Nov 3, 2023
1 parent e5663d0 commit 77effd1
Show file tree
Hide file tree
Showing 18 changed files with 338 additions and 103 deletions.
12 changes: 10 additions & 2 deletions .ambient-package-update/metadata.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from ambient_package_update.metadata.author import PackageAuthor
from ambient_package_update.metadata.constants import DEV_DEPENDENCIES
from ambient_package_update.metadata.constants import (
DEV_DEPENDENCIES,
SUPPORTED_DJANGO_VERSIONS,
SUPPORTED_PYTHON_VERSIONS,
)
from ambient_package_update.metadata.package import PackageMetadata
from ambient_package_update.metadata.readme import ReadmeContent

Expand All @@ -18,6 +22,7 @@
],
license_year=2022,
development_status="5 - Production/Stable",
has_migrations=False,
readme_content=ReadmeContent(
tagline="Add simple interactions to the otherwise static django admin.",
content="""# django-dynamic-admin-forms
Expand Down Expand Up @@ -149,7 +154,7 @@ def get_dynamic_city_field(self, data):
$ yarn cypress # or npm run cypress
```
""",
installation="""
custom_installation="""
- Install the package via pip:
```pip install django-dynamic-admin-forms```
Expand Down Expand Up @@ -186,9 +191,12 @@ def get_dynamic_city_field(self, data):
dependencies=[
"django >=3.2",
],
supported_django_versions=SUPPORTED_DJANGO_VERSIONS,
supported_python_versions=SUPPORTED_PYTHON_VERSIONS,
optional_dependencies={
"dev": [
*DEV_DEPENDENCIES,
"unittest-parametrize~=1.4",
],
},
ruff_ignore_list=[],
Expand Down
12 changes: 11 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,15 @@ omit =
setup.py,
*_test.py,
tests.py,
*tests*,
testapp/*
tests/*,
conftest.py

[report]
precision = 2
show_missing = True
exclude_lines =
# Don't complain if tests don't hit defensive assertion code:
raise NotImplementedError
# Ignore type checking conditions
if TYPE_CHECKING:
45 changes: 38 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
linting:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: "3.12"

Expand All @@ -21,13 +21,15 @@ jobs:
- name: Run pre-commit hooks
run: pre-commit run --all-files --hook-stage push

build:


tests:
name: Python ${{ matrix.python-version }}, django ${{ matrix.django-version }}
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']
django-version: [32, 41, 42]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', ]
django-version: ['32', '41', '42', ]

exclude:
- python-version: '3.12'
Expand All @@ -38,9 +40,9 @@ jobs:
django-version: 32

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
Expand All @@ -49,3 +51,32 @@ jobs:
env:
TOXENV: django${{ matrix.django-version }}
run: tox
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
name: coverage-data
path: '.coverage*'

coverage:
name: Coverage
runs-on: ubuntu-22.04
needs: tests
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install dependencies
run: python -m pip install --upgrade coverage[toml]

- name: Download data
uses: actions/download-artifact@v3
with:
name: coverage-data

- name: Combine coverage and fail if it's <100%
run: |
python -m coverage html --skip-covered --skip-empty
python -m coverage report --fail-under=100
18 changes: 7 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@
# https://pre-commit.com/

repos:
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
hooks:
- id: black
args: [ --check, --diff, --config, ./pyproject.toml ]
stages: [ push ]

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.292'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
hooks:
# Run the Ruff linter.
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
args: [--fix, --exit-non-zero-on-fix]
# Run the Ruff formatter.
- id: ruff-format

- repo: https://github.com/asottile/pyupgrade
rev: v3.14.0
rev: v3.15.0
hooks:
- id: pyupgrade
args: [ --py38-plus ]
Expand Down
31 changes: 31 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- method: pip
path: .
extra_requirements:
- dev
24 changes: 0 additions & 24 deletions .readthedocs.yml

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

**2.1.1**

- 100% coverage and bugfix in edge case
- Updates via ambient package updater

**2.1.0**

- Added Python 3.12 support
Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[![PyPI release](https://img.shields.io/pypi/v/django-dynamic-admin-forms.svg)](https://pypi.org/project/django-dynamic-admin-forms/)
[![Downloads](https://static.pepy.tech/badge/django-dynamic-admin-forms)](https://pepy.tech/project/django-dynamic-admin-forms)
[![Coverage](https://img.shields.io/badge/Coverage-100%25-success)](https://github.com/ambient-innovation/django-dynamic-admin-forms/actions?workflow=CI)
[![Linting](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Coding Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)
[![Coding Style](https://img.shields.io/badge/code%20style-Ruff-000000.svg)](https://github.com/astral-sh/ruff)
[![Documentation Status](https://readthedocs.org/projects/django-dynamic-admin-forms/badge/?version=latest)](https://django-dynamic-admin-forms.readthedocs.io/en/latest/?badge=latest)

Add simple interactions to the otherwise static django admin.
Expand Down Expand Up @@ -144,7 +145,7 @@ $ yarn cypress # or npm run cypress
## Installation



- Install the package via pip:

```pip install django-dynamic-admin-forms```
Expand Down Expand Up @@ -203,6 +204,12 @@ $ yarn cypress # or npm run cypress
pytest --ds settings tests
````

- Check coverage
````
coverage run -m pytest --ds settings tests
coverage report -m
````

### Git hooks (via pre-commit)

We use pre-push hooks to ensure that only linted code reaches our remote repository and pipelines aren't triggered in
Expand Down
2 changes: 1 addition & 1 deletion django_dynamic_admin_forms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Add simple dynamic interaction to the otherwise static django admin."""

__version__ = "2.1.0"
__version__ = "2.1.1"
2 changes: 1 addition & 1 deletion django_dynamic_admin_forms/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def render_field(request) -> HttpResponse:
field_names = request.GET.getlist("field_names")

if not (app_label and model_name and field_names):
return HttpResponse(400, "Invalid argumnets")
return HttpResponse("Invalid arguments", status=400)

model = apps.get_model(app_label, model_name)

Expand Down
50 changes: 25 additions & 25 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,69 +16,69 @@
import django
from django.conf import settings

sys.path.insert(0, os.path.abspath('..')) # so that we can access the "django_dynamic_admin_forms" package
sys.path.insert(0, os.path.abspath("..")) # so that we can access the "django_dynamic_admin_forms" package
settings.configure(
INSTALLED_APPS=[
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_dynamic_admin_forms',
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django_dynamic_admin_forms",
],
SECRET_KEY='ASDFjklö123456890',
SECRET_KEY="ASDFjklö123456890",
)
django.setup()

from django_dynamic_admin_forms import __version__ # noqa: E402

# -- Project information -----------------------------------------------------

project = 'django-dynamic-admin-forms'
copyright = '2023, Ambient Innovation: GmbH' # noqa: A001
author = 'Ambient Innovation: GmbH <[email protected]>'
project = "django-dynamic-admin-forms"
copyright = "2023, Ambient Innovation: GmbH" # noqa: A001
author = "Ambient Innovation: GmbH <[email protected]>"
version = __version__
release = __version__

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom
# ones.
extensions = [
'sphinx_rtd_theme',
'sphinx.ext.autodoc',
'm2r2',
"sphinx_rtd_theme",
"sphinx.ext.autodoc",
"m2r2",
]

source_suffix = ['.rst', '.md']
source_suffix = [".rst", ".md"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# html_theme = 'alabaster'
html_theme = 'sphinx_rtd_theme'
# html_theme = "alabaster"
html_theme = "sphinx_rtd_theme"
html_theme_options = {
'display_version': False,
'style_external_links': False,
"display_version": False,
"style_external_links": False,
}

# 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"]

# Set master doc file
master_doc = 'index'
master_doc = "index"
Loading

0 comments on commit 77effd1

Please sign in to comment.