A small reusable package that adds small commonly used functions to a project
Project description
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
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
Built Distribution
File details
Details for the file giant_utils-0.2.tar.gz
.
File metadata
- Download URL: giant_utils-0.2.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.0 CPython/3.8.10 Linux/5.15.0-75-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a41176cfc61fceae65fa32a7e56e2da11fea802f6df1e9b3e3fd98b916b5273 |
|
MD5 | 9f85b8fee123b1f72ab0f3a074afc41e |
|
BLAKE2b-256 | 183ec2f00e19d2e6d4c220fcc2ffdf5706271f8111715aa597f63f12266f9711 |
File details
Details for the file giant_utils-0.2-py3-none-any.whl
.
File metadata
- Download URL: giant_utils-0.2-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.0 CPython/3.8.10 Linux/5.15.0-75-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 783840a47eda5ca9ce7d84d29d28aa4fd8923cfaf00fd61bfc8fc284542cbc3d |
|
MD5 | d4fe2b09f3c19f6bf1077551067926b5 |
|
BLAKE2b-256 | 7c0489090f258b8af454bdd337440e2f40ee636eadcbd60e2149e02df8c764cf |