Skip to main content

Piuma Python library with Django support

Project description

Latest Version CI codecov License: MIT

A library to use Piuma with Python and Django

Install

pip install pypiuma

Usage

from pypiuma import piuma_url

piuma_url("http://mypiumahost", "http://myimagehost/static/img/a.png", 200, 200, 80)

Usage with Django

{% load pypiuma_tags %}

<img src="{% piuma 'http://myimagehost/static/img/a.png' width=200 convert_to="auto" %}">
<img src="{% piuma_static 'img/mylogo.png' width=200 %}">

Picture tags

{% load pypiuma_tags %}

{% piuma_picture 'http://myimagehost/static/img/a.png'%}
{% piuma_picture_static 'img/a.png' %}

Settings

PIUMA_DISABLED

Disable Piuma core, useful in development.

Default: False

PIUMA_HOST

The host of your Piuma instance.

Default: /piuma/

PIUMA_MEDIA_RULES

Media rules for picture tags.

Default: (max-width: 576px),(max-width: 768px),(max-width: 992px),(max-width: 1366px)

PIUMA_SIZES

Fast configurations for your images. These can be handy if you want to define different sizes like small, medium, full to serve the best optimized version of the image for your needs. The * size, if defined, is applied to all images imported with a tag that do not specify a size.

Default: {}

Example:

{
  "*": {
    "convert_to": "auto",
    "quality": 80
  },
  "small": {
    "width": 300,
    "convert_to": "auto",
    "quality": 80
  },
  "medium": {
    "width": 500,
    "convert_to": "auto",
    "quality": 80
  },
  "large": {
    "width": 1000,
    "convert_to": "auto",
    "quality": 80
  }
}

Run tests

pip install -r requirements-dev.txt
make test

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypiuma-1.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

pypiuma-1.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file pypiuma-1.1.0.tar.gz.

File metadata

  • Download URL: pypiuma-1.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

File hashes

Hashes for pypiuma-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f5a7d9128cee7c0214b93bcce68968e508c5182d0538dfd574d2a0c14567f8a1
MD5 ae132a9bbbe0fc238523ac3c3d1e0082
BLAKE2b-256 72908ca5b599ac87696a0fd68b18e559344c3e44e6ee1f35825ecb0511fcd9e5

See more details on using hashes here.

File details

Details for the file pypiuma-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pypiuma-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

File hashes

Hashes for pypiuma-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d453361e81a8856c33769fef8c3ebcbc9a427d191e38a649497895f35bbcc9a
MD5 352665db2e24d2b520c0809c4a754801
BLAKE2b-256 58be5fd483f8f6e50035fd9f1eca6eee68d210a17b8ee76806057eab54ed1bf6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page