Une bibliothèque Python pour gérer simplement les fichiers JSONs, les créer, les charger et écrire dedans facilement, en vérifiant que leur structure est correcte.
Project description
📂 filemanager
Une bibliothèque Python ultra-légère et robuste pour gérer simplement vos fichiers JSON sans vous soucier des fichiers manquants ou corrompus.
✨ Fonctionnalités
- Auto-Réparation : Si un fichier JSON est corrompu ou mal formé, la bibliothèque le détecte et le réinitialise proprement pour éviter le crash de votre application.
- Sécurité : Création automatique des fichiers s'ils n'existent pas lors d'une tentative de lecture ou d'écriture.
- Simplicité : Enregistrez une clé et une valeur en une seule ligne de code sans charger tout le fichier manuellement.
🚀 Installation
Installez directement depuis PyPI:
pip install filemanager
🛠️ Utilisation
from filemanager import load_data, save_data, save_key, exist, create_json
filename = "config.json"
# 1. Vérifier si le fichier existe
print(exist(filename)) # Retourne False ou True
# 2. Sauvegarder des données complètes (Crée le fichier automatiquement s'il n'existe pas)
data_utilisateurs = {
"pseudo": "Valk",
"premium": True
}
save_data(filename, data_utilisateurs)
# 3. Ajouter ou modifier une clé spécifique facilement
save_key(filename, "version", "1.0.2")
# 4. Charger les données du fichier
config = load_data(filename)
print(config)
# Résultat : {'pseudo': 'Valk', 'premium': True, 'version': '1.0.2'}
# 5. Créer un json avec un dictionnaire initial ou non
create_json(filename)
# Créer un JSON avec un dictionnaire vide: {}
create_json(filename, {"valeur_de_base": True})
# Créer un JSON avec un dictionnaire: {"valeur_de_base": True}
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file valk_filemanager-0.3.2.tar.gz.
File metadata
- Download URL: valk_filemanager-0.3.2.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13bd089f1901e6e91ae580e0ae99a0a82ea22eee1816f44309f7ba6f5b431258
|
|
| MD5 |
947a71fb00680908520b845a60164bc1
|
|
| BLAKE2b-256 |
e75d4a7af286da05f7f67642a7960641e12b0023eecdd478c4518a2a3039dcbc
|
Provenance
The following attestation bundles were made for valk_filemanager-0.3.2.tar.gz:
Publisher:
publish.yml on ValkPyDev/filemanager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
valk_filemanager-0.3.2.tar.gz -
Subject digest:
13bd089f1901e6e91ae580e0ae99a0a82ea22eee1816f44309f7ba6f5b431258 - Sigstore transparency entry: 1621320030
- Sigstore integration time:
-
Permalink:
ValkPyDev/filemanager@cfa1307db8c50b49b5b074b0f375da88cb53a4bb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ValkPyDev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cfa1307db8c50b49b5b074b0f375da88cb53a4bb -
Trigger Event:
push
-
Statement type:
File details
Details for the file valk_filemanager-0.3.2-py3-none-any.whl.
File metadata
- Download URL: valk_filemanager-0.3.2-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
846605989763836181bea288e3c2308a1abf09a93460ed6424520e8b5526b38a
|
|
| MD5 |
5afd6dcd6f49b4b00a72310d935c5e4e
|
|
| BLAKE2b-256 |
29b7ccc4f7f72e59504d7e0caf753e4230cf506b82bf3e64c2318fbc75edb7c0
|
Provenance
The following attestation bundles were made for valk_filemanager-0.3.2-py3-none-any.whl:
Publisher:
publish.yml on ValkPyDev/filemanager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
valk_filemanager-0.3.2-py3-none-any.whl -
Subject digest:
846605989763836181bea288e3c2308a1abf09a93460ed6424520e8b5526b38a - Sigstore transparency entry: 1621320120
- Sigstore integration time:
-
Permalink:
ValkPyDev/filemanager@cfa1307db8c50b49b5b074b0f375da88cb53a4bb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ValkPyDev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cfa1307db8c50b49b5b074b0f375da88cb53a4bb -
Trigger Event:
push
-
Statement type: