Skip to main content

Giant Utils

A re-usable package which can be used in any django project that allows small common use functions such as an email with text and/or html templates to be sent.

Other functionality includes a format_bytes method that takes a byte size of file and converts it to a human-readable number with the appropriate Byte suffix (useful for download files).

Also includes a rich text field that can be used in various plugins where the admin may want to insert links or custom html.

Installation

To install with the package manager, run:

$ poetry add giant-utils

You should then add "giant_utils" to the INSTALLED_APPS in your project's settings file. Then wherever you want to implement the function you can add the following import statements...

from giant_utils.sender import send_email_from_template
from giant_utils.format_bytes import format_bytes
from giant_utils.fields import RichTextField

Rich Text Field

This field can be customised by adding your own WYSIWYG_CONFIG variable to your project's settings. Otherwise it will fallback to the default below...

DEFAULT_WYSIWYG_CONFIG = {
    "lang": "en",
    "minHeight": "300px",
    "buttons": "html | format | undo redo | bold italic | ul ol | link | sub sup".split(),
    "formatting": ["h1", "h2", "h3", "p"],
    "linkTitle": True,
    "linkNewTab": True,
    "structure": True,
    "removeNewLines": True,
    "pasteImages": False,
    "tabAsSpaces": 4,
    "plugins": ["table"],
}

Pre-requisites

The minimum package dependencies for this project are as follows...

  • Django 4.0
  • python 3.11

Preparing for release

In order to prep the package for a new release on TestPyPi and PyPi there is one key thing that you need to do. You need to update the version number in the pyproject.toml. This is so that the package can be published without running into version number conflicts. The version numbering must also follow the Semantic Version rules which can be found here https://semver.org/.

Publishing

Publishing a package with poetry is incredibly easy. Once you have checked that the version number has been updated (not the same as a previous version) then you only need to run two commands.

$ `poetry build` 

will package the project up for you into a way that can be published.

$ `poetry publish`

will publish the package to PyPi. You will need to enter the username and password for the account which can be found in the company password manager

Metadata

Release files for giant-utils 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for giant-utils 0.2
File Size Uploaded Provenance Actions
giant_utils-0.2.tar.gz 5.6 kB Without provenance Details for giant_utils-0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for giant-utils 0.2
File Interpreter ABI Platform Actions
giant_utils-0.2-py3-none-any.whl Python 3 none any Details for giant_utils-0.2-py3-none-any.whl

Total release size: 13.1 kB

Release files / giant_utils-0.2.tar.gz

Download URL giant_utils-0.2.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1a41176cfc61fceae65fa32a7e56e2da11fea802f6df1e9b3e3fd98b916b5273
BLAKE2b-256 checksum
How to use checksums
183ec2f00e19d2e6d4c220fcc2ffdf5706271f8111715aa597f63f12266f9711
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.0 CPython/3.8.10 Linux/5.15.0-75-generic

Release files / giant_utils-0.2-py3-none-any.whl

Download URL giant_utils-0.2-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
783840a47eda5ca9ce7d84d29d28aa4fd8923cfaf00fd61bfc8fc284542cbc3d
BLAKE2b-256 checksum
How to use checksums
7c0489090f258b8af454bdd337440e2f40ee636eadcbd60e2149e02df8c764cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.0 CPython/3.8.10 Linux/5.15.0-75-generic

Security for giant-utils 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page