Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seluj78/flask-utils
Various Flask utilities that I find useful in my projects
https://github.com/seluj78/flask-utils
flask hacktoberfest python utility
Last synced: 2 months ago
JSON representation
Various Flask utilities that I find useful in my projects
- Host: GitHub
- URL: https://github.com/seluj78/flask-utils
- Owner: Seluj78
- License: gpl-3.0
- Created: 2024-06-09T08:40:51.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-11-04T16:57:42.000Z (3 months ago)
- Last Synced: 2024-11-04T17:45:49.091Z (3 months ago)
- Topics: flask, hacktoberfest, python, utility
- Language: Python
- Homepage:
- Size: 184 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[![Documentation Status](https://readthedocs.org/projects/flask-utils/badge/?version=latest)](https://flask-utils.readthedocs.io/en/latest/?badge=latest)
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/Seluj78/flask-utils)
![GitHub commits since latest release](https://img.shields.io/github/commits-since/seluj78/flask-utils/latest)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/seluj78/flask-utils/tests.yml?label=tests)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/seluj78/flask-utils/linting.yml?label=linting)
![GitHub License](https://img.shields.io/github/license/seluj78/flask-utils)
[![All Contributors](https://img.shields.io/github/all-contributors/seluj78/flask-utils?color=ee8449&style=flat-square)](#contributors)
[![codecov](https://codecov.io/gh/Seluj78/flask-utils/graph/badge.svg?token=ChUOweAp4b)](https://codecov.io/gh/Seluj78/flask-utils)[//]: # (TODO: Uncomment when flask-utils had been freed from pypi)
[//]: # (![PyPI - Downloads](https://img.shields.io/pypi/dm/flask-utils))
[//]: # (![PyPI - Implementation](https://img.shields.io/pypi/implementation/flask-utils))
[//]: # (![PyPI - Python Version](https://img.shields.io/pypi/pyversions/flask-utils))
[//]: # (![PyPI - Versions from Framework Classifiers](https://img.shields.io/pypi/frameworkversions/:frameworkName/flask-utils))
[//]: # (![PyPI - Wheel](https://img.shields.io/pypi/wheel/flask-utils))
[//]: # (![PyPI - Version](https://img.shields.io/pypi/v/flask-utils))# Flask-Utils
A collection of useful Flask utilities I use every day in my Flask projects.
## Installation
```bash
pip install flask-utils
```## Usage
```python
from flask import Flask
from flask_utils import FlaskUtils
from flask_utils import BadRequestErrorapp = Flask(__name__)
utils = FlaskUtils(app, register_error_handlers=True)@app.route('/')
def index():
raise BadRequestError
``````python
from typing import List, Optional
from flask import Flask
from flask_utils import validate_paramsapp = Flask(__name__)
@app.post('/create-user')
@validate_params({"first_name": str, "last_name": str, "age": Optional[int], "hobbies": List[str]})
def create_user():
# ...
# This will enforce the following rules:
# - first_name and last_name must be strings and are required
# - age is optional and must be an integer
# - hobbies is a list of strings
# This is just an example, you can use any type of validation you want
return "User created"
```## Documentation
You can find the full documentation at [Read the Docs](https://flask-utils.readthedocs.io/en/latest/)
## Testing
Install uv
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```Run the tests
```bash
uv run tox
```OR
Run the tests in a multithreaded fashion
```bash
uv run tox -p
```## Contributors
Jules Lasne
💻 📖 🚇 💡 🧑🏫 📦 📆 👀 ✅
Mews
📖 ✅
Julien Palard
🤔
Add your contributions