Skip to content

Commit

Permalink
v9.2.0 (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
GitRon authored Nov 17, 2023
1 parent 5a9f751 commit ebbccd1
Show file tree
Hide file tree
Showing 113 changed files with 1,509 additions and 1,060 deletions.
65 changes: 38 additions & 27 deletions .ambient-package-update/metadata.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
from ambient_package_update.metadata.author import PackageAuthor
from ambient_package_update.metadata.constants import DEV_DEPENDENCIES, LICENSE_MIT
from ambient_package_update.metadata.constants import (
DEV_DEPENDENCIES,
LICENSE_MIT,
SUPPORTED_DJANGO_VERSIONS,
SUPPORTED_PYTHON_VERSIONS,
)
from ambient_package_update.metadata.package import PackageMetadata
from ambient_package_update.metadata.readme import ReadmeContent
from ambient_package_update.metadata.ruff_ignored_inspection import RuffIgnoredInspection

METADATA = PackageMetadata(
package_name='ambient_toolbox',
company='Ambient Innovation: GmbH',
package_name="ambient_toolbox",
company="Ambient Innovation: GmbH",
authors=[
PackageAuthor(
name='Ambient Digital',
email='[email protected]',
name="Ambient Digital",
email="[email protected]",
),
],
development_status='5 - Production/Stable',
min_coverage=96.52,
development_status="5 - Production/Stable",
license=LICENSE_MIT,
license_year=2012,
readme_content=ReadmeContent(
tagline='Python toolbox of Ambient Digital containing an abundance of useful tools and gadgets.',
tagline="Python toolbox of Ambient Digital containing an abundance of useful tools and gadgets.",
content="""## Features
* Useful classes and mixins for Django admin
Expand Down Expand Up @@ -46,35 +52,40 @@
""",
),
dependencies=[
'Django>=3.2.20',
'bleach>=1.4,<6',
'python-dateutil>=2.5.3',
"Django>=3.2.20",
"bleach>=1.4,<6",
"python-dateutil>=2.5.3",
],
supported_django_versions=SUPPORTED_DJANGO_VERSIONS,
supported_python_versions=SUPPORTED_PYTHON_VERSIONS,
has_migrations=True,
optional_dependencies={
'dev': [
"dev": [
*DEV_DEPENDENCIES,
'gevent~=22.10',
"gevent~=23.9",
],
'drf': [
'djangorestframework>=3.8.2',
"drf": [
"djangorestframework>=3.8.2",
],
'graphql': [
'graphene-django>=2.2.0',
'django-graphql-jwt>=0.2.1',
"graphql": [
"graphene-django>=2.2.0",
"django-graphql-jwt>=0.2.1",
],
'sentry': [
'sentry-sdk>=1.19.1',
"sentry": [
"sentry-sdk>=1.19.1",
],
'view-layer': [
'django-crispy-forms>=1.4.0',
"view-layer": [
"django-crispy-forms>=1.4.0",
],
},
ruff_ignore_list=[
RuffIgnoredInspection(key='N999', comment="Project name contains underscore, not fixable"),
RuffIgnoredInspection(key='A003', comment="Django attributes shadow python builtins"),
RuffIgnoredInspection(key='DJ001', comment="Django model text-based fields shouldn't be nullable"),
RuffIgnoredInspection(key='B905', comment="Can be enabled when Python <=3.9 support is dropped"),
RuffIgnoredInspection(key='DTZ001', comment="TODO will affect \"tz_today()\" method"),
RuffIgnoredInspection(key='DTZ005', comment="TODO will affect \"tz_today()\" method"),
RuffIgnoredInspection(key="N999", comment="Project name contains underscore, not fixable"),
RuffIgnoredInspection(key="A003", comment="Django attributes shadow python builtins"),
RuffIgnoredInspection(key="DJ001", comment="Django model text-based fields shouldn't be nullable"),
RuffIgnoredInspection(key="B905", comment="Can be enabled when Python <=3.9 support is dropped"),
RuffIgnoredInspection(key="DTZ001", comment='TODO will affect "tz_today()" method'),
RuffIgnoredInspection(key="DTZ005", comment='TODO will affect "tz_today()" method'),
RuffIgnoredInspection(key="TD002", comment="Missing author in TODO"),
RuffIgnoredInspection(key="TD003", comment="Missing issue link on the line following this TODO"),
],
)
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:
61 changes: 54 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,31 @@ jobs:
- name: Run pre-commit hooks
run: pre-commit run --all-files --hook-stage push

build:

validate_migrations:
name: Validate migrations
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

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

- name: Install dependencies
run: python -m pip install -U pip-tools && pip-compile --extra dev,drf,graphql,sentry,view-layer, -o requirements.txt pyproject.toml --resolver=backtracking && pip-sync

- name: Validate migration integrity
run: python manage.py makemigrations --check --dry-run


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 +56,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 +67,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=96.62
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.4
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.

15 changes: 12 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

**9.2.0** (2023-11-17)
* Added migration docs to Readme
* Added migration check to GitHub actions
* Switched formatter from `black` to `ruff`
* Enforcing minimum coverage in CI/CD pipeline
* Further updates from ambient updater package
* Updated GitHub action versions
* Fixes typos

**9.1.5** (2023-10-31)
* Coverage service fixed crash on zero pipelines
* Added default `develop` for `GITLAB_CI_COVERAGE_TARGET_BRANCH` in GitLab coverage service
Expand Down Expand Up @@ -134,7 +143,7 @@
* Set version border for dependency "bleach" because of breaking changes

**6.9.0** (2023-01-18)
* Added "GITLAB_CI_DISABLE_COVERAGE" flag to coverage script for Gitlab pipeline
* Added "GITLAB_CI_DISABLE_COVERAGE" flag to coverage script for GitLab pipeline
* Fixed typo in the docs

**6.8.4** (2023-01-11)
Expand Down Expand Up @@ -263,10 +272,10 @@
* Added a view which allows logging errors to Sentry normally while using Graphene.

**5.12.1** (2022-01-31)
* Fixed bug in Gitlab code coverage compare service documentation
* Fixed bug in GitLab code coverage compare service documentation

**5.12.0** (2022-01-28)
* Added Gitlab code coverage compare service `CoverageService` with documentation
* Added GitLab code coverage compare service `CoverageService` with documentation

**5.11.1** (2022-01-24)
* Added docs for `ToggleView`
Expand Down
19 changes: 17 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/ambient-toolbox.svg)](https://pypi.org/project/ambient-toolbox/)
[![Downloads](https://static.pepy.tech/badge/ambient-toolbox)](https://pepy.tech/project/ambient-toolbox)
[![Coverage](https://img.shields.io/badge/Coverage-96.62%25-success)](https://github.com/ambient-innovation/ambient-toolbox/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/ambient-toolbox/badge/?version=latest)](https://ambient-toolbox.readthedocs.io/en/latest/?badge=latest)

Python toolbox of Ambient Digital containing an abundance of useful tools and gadgets.
Expand Down Expand Up @@ -59,12 +60,20 @@ The migration is really simple, just:
````
- Apply migrations by running:
`python ./manage.py migrate`
## Contribute
### Setup package for development
- Create a Python virtualenv and activate it
- Install "pip-tools" with `pip install pip-tools`
- Install "pip-tools" with `pip install -U pip-tools`
- Compile the requirements with `pip-compile --extra dev,drf,graphql,sentry,view-layer, -o requirements.txt pyproject.toml --resolver=backtracking`
- Sync the dependencies with your virtualenv with `pip-sync`
Expand All @@ -83,6 +92,12 @@ The migration is really simple, just:
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 ambient_toolbox/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Python toolbox of Ambient Digital containing an abundance of useful tools and gadgets."""

__version__ = '9.1.5'
__version__ = "9.2.0"
Loading

0 comments on commit ebbccd1

Please sign in to comment.