Skip to content

Commit

Permalink
Merge pull request #30 from pinax/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
paltman authored Nov 24, 2021
2 parents 34884d4 + 03d2690 commit 6e45597
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 206 deletions.
88 changes: 0 additions & 88 deletions .circleci/config.yml

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Lints and Tests
on: [push]
jobs:
lint:
name: Linting
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.9

- name: isort
uses: jamescurtin/isort-action@master

- name: Lints
uses: py-actions/flake8@v1
with:
ignore: "E265,E501"
max-line-length: "100"
exclude: "pinax/images/migrations,docs"
path: pinax


test:
name: Testing
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.6, 3.7, 3.8, 3.9, "3.10"]
django: [2.2.*, 3.2.*]

steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}

- name: Install Django and Testing Tools
run: |
pip install Django==${{ matrix.django }} coverage django-test-plus
pip install .
- name: Running Python Tests
run: coverage run runtests.py
- name: Upload Coverage Report
if: matrix.django == '3.2.*' && matrix.python == '3.10'
run: |
pip install codecov
coverage xml
codecov --required -X search gcov pycov -f coverage.xml
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[![](https://img.shields.io/pypi/v/pinax-images.svg)](https://pypi.python.org/pypi/pinax-images/)

[![CircleCi](https://img.shields.io/circleci/project/github/pinax/pinax-images.svg)](https://circleci.com/gh/pinax/pinax-images)
[![Build](https://github.com/pinax/pinax-images/actions/workflows/ci.yaml/badge.svg)](https://github.com/pinax/pinax-images/actions)
[![Codecov](https://img.shields.io/codecov/c/github/pinax/pinax-images.svg)](https://codecov.io/gh/pinax/pinax-images)
[![](https://img.shields.io/github/contributors/pinax/pinax-images.svg)](https://github.com/pinax/pinax-images/graphs/contributors)
[![](https://img.shields.io/github/issues-pr/pinax/pinax-images.svg)](https://github.com/pinax/pinax-images/pulls)
Expand Down Expand Up @@ -64,10 +64,10 @@ Where you can find what you need:

#### Supported Django and Python Versions

Django / Python | 3.6 | 3.7 | 3.8
--------------- | --- | --- | ---
2.2 | * | * | *
3.0 | * | * | *
Django / Python | 3.6 | 3.7 | 3.8 | 3.9 | 3.10
--------------- | --- | --- | --- | --- | ----
2.2 | * | * | * | * | *
3.2 | * | * | * | * | *


## Documentation
Expand Down Expand Up @@ -177,6 +177,13 @@ PINAX_IMAGES_THUMBNAIL_SPEC = "{{my_app}}.specs.MyCustomImageThumbnail"

## Change Log

### 5.0.0

* Add Python 3.9 and 3.10 support along with Django 3.2
* Droppped Django 3.1
* Handled deprecation and some general modernizations
* Updated packaging

### 4.0.1

* Drop Django 1.11, 2.0, and 2.1, and Python 2,7, 3.4, and 3.5 support
Expand Down
3 changes: 1 addition & 2 deletions makemigrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import sys

import django

from django.conf import settings


DEFAULT_SETTINGS = dict(
INSTALLED_APPS=[
"django.contrib.auth",
Expand All @@ -25,6 +23,7 @@
SITE_ID=1,
ROOT_URLCONF="pinax.images.tests.urls",
SECRET_KEY="notasecret",
DEFAULT_AUTO_FIELD="django.db.models.AutoField",
)


Expand Down
6 changes: 5 additions & 1 deletion pinax/images/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import django

import pkg_resources

default_app_config = "pinax.images.apps.AppConfig"
if django.__version__ < "3.2": # Deprecated in 4.1 but needed in 2.2 still
default_app_config = "pinax.images.apps.AppConfig"

__version__ = pkg_resources.get_distribution("pinax-images").version
14 changes: 14 additions & 0 deletions pinax/images/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from django.core.files.uploadedfile import SimpleUploadedFile
from django.urls import reverse

from imagekit.registry import generator_registry

from ..models import Image
from .test import TestCase

Expand Down Expand Up @@ -212,3 +214,15 @@ def test_toggle_bad_pk(self):
with self.login(self.user):
self.post(self.view_url, 555)
self.response_404()


class TestImageSpecs(TestCase):

def test_registered_specs(self):
self.assertEqual(list(generator_registry.get_ids()), [
"imagekit:thumbnail",
"pinax_images:image:thumbnail",
"pinax_images:image:list_thumbnail",
"pinax_images:image:small_thumbnail",
"pinax_images:image:medium_thumbnail"
])
4 changes: 2 additions & 2 deletions pinax/images/tests/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.conf.urls import include, url
from django.urls import include, path

urlpatterns = [
url(r"^", include("pinax.images.urls", namespace="pinax_images")),
path("", include("pinax.images.urls", namespace="pinax_images")),
]
12 changes: 6 additions & 6 deletions pinax/images/urls.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from django.conf.urls import url
from django.urls import path

from . import views

app_name = "pinax_images"

urlpatterns = [
url(r"^sets/new/upload/$", views.ImageSetUploadView.as_view(), name="imageset_new_upload"),
url(r"^sets/(?P<pk>\d+)/upload/$", views.ImageSetUploadView.as_view(), name="imageset_upload"),
url(r"^sets/(?P<pk>\d+)/$", views.ImageSetDetailView.as_view(), name="imageset_detail"),
url(r"^(?P<pk>\d+)/delete/$", views.ImageDeleteView.as_view(), name="image_delete"),
url(r"^(?P<pk>\d+)/make-primary/$", views.ImageTogglePrimaryView.as_view(), name="image_make_primary"),
path("sets/new/upload/", views.ImageSetUploadView.as_view(), name="imageset_new_upload"),
path("sets/<int:pk>/upload/", views.ImageSetUploadView.as_view(), name="imageset_upload"),
path("sets/<int:pk>/", views.ImageSetDetailView.as_view(), name="imageset_detail"),
path("<int:pk>/delete/", views.ImageDeleteView.as_view(), name="image_delete"),
path("<int:pk>/make-primary/", views.ImageTogglePrimaryView.as_view(), name="image_make_primary"),
]
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"
3 changes: 1 addition & 2 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import sys

import django

from django.conf import settings


DEFAULT_SETTINGS = dict(
INSTALLED_APPS=[
"django.contrib.auth",
Expand All @@ -29,6 +27,7 @@
SITE_ID=1,
ROOT_URLCONF="pinax.images.tests.urls",
SECRET_KEY="notasecret",
DEFAULT_AUTO_FIELD="django.db.models.AutoField",
)


Expand Down
42 changes: 42 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[metadata]
name = pinax-images
version = 5.0.0
author = Pinax Team
author_email = [email protected]
description = an app for managing collections of images associated with a content object
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/pinax/pinax-images/
license = MIT
classifiers =
Development Status :: 5 - Production/Stable
Environment :: Web Environment
Framework :: Django
Framework :: Django :: 2.2
Framework :: Django :: 3.2
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Topic :: Software Development :: Libraries :: Python Modules

[options]
package_dir =
= pinax
packages = find:
install_requires =
django>=2.2
django-imagekit>=4.0.2
pilkit>=2.0.0
pillow>=7.1.2
pytz>=2020.1
zip_safe = False

[options.packages.find]
where = pinax
Loading

0 comments on commit 6e45597

Please sign in to comment.