facturlint 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- facturlint-0.2.0/LICENSE +21 -0
- facturlint-0.2.0/PKG-INFO +255 -0
- facturlint-0.2.0/README.md +221 -0
- facturlint-0.2.0/pyproject.toml +67 -0
- facturlint-0.2.0/setup.cfg +4 -0
- facturlint-0.2.0/src/facturlint.egg-info/PKG-INFO +255 -0
- facturlint-0.2.0/src/facturlint.egg-info/SOURCES.txt +12 -0
- facturlint-0.2.0/src/facturlint.egg-info/dependency_links.txt +1 -0
- facturlint-0.2.0/src/facturlint.egg-info/entry_points.txt +2 -0
- facturlint-0.2.0/src/facturlint.egg-info/top_level.txt +1 -0
- facturlint-0.2.0/src/facturlint_sdk/__init__.py +21 -0
- facturlint-0.2.0/src/facturlint_sdk/cli.py +347 -0
- facturlint-0.2.0/src/facturlint_sdk/client.py +413 -0
- facturlint-0.2.0/src/facturlint_sdk/py.typed +0 -0
facturlint-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 FacturLint (https://facturlint.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: facturlint
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Official Python SDK & CLI for FacturLint — Factur-X 1.09.2, EN 16931 & BR-FR-CTC validation, PDF/A-3b envelope repair & audit API.
|
|
5
|
+
Author-email: FacturLint <contact@facturlint.com>
|
|
6
|
+
Maintainer-email: FacturLint <contact@facturlint.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://facturlint.com
|
|
9
|
+
Project-URL: Documentation, https://facturlint.com/docs
|
|
10
|
+
Project-URL: Error Catalog, https://facturlint.com/erreurs
|
|
11
|
+
Project-URL: Pricing & API Keys, https://facturlint.com/#tarifs
|
|
12
|
+
Project-URL: MCP Server, https://facturlint.com/mcp
|
|
13
|
+
Project-URL: Repository, https://github.com/facturlint/facturlint-python
|
|
14
|
+
Project-URL: Bug Tracker, https://github.com/facturlint/facturlint-python/issues
|
|
15
|
+
Keywords: factur-x,en16931,br-fr-ctc,chorus-pro,facturation-electronique,pdfa3,pdfa3b,einvoicing,xml-cii,peppol,mcp,ai-agent,stateless-api
|
|
16
|
+
Classifier: Development Status :: 4 - Beta
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
26
|
+
Classifier: Topic :: Office/Business :: Financial :: Accounting
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
29
|
+
Classifier: Typing :: Typed
|
|
30
|
+
Requires-Python: >=3.9
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# FacturLint — Factur-X 1.09.2, EN 16931 & BR-FR-CTC Python SDK & CLI
|
|
36
|
+
|
|
37
|
+
[](https://pypi.org/project/facturlint/)
|
|
38
|
+
[](https://pypi.org/project/facturlint/)
|
|
39
|
+
[](https://facturlint.com)
|
|
40
|
+
[](https://facturlint.com/docs)
|
|
41
|
+
[](https://opensource.org/licenses/MIT)
|
|
42
|
+
|
|
43
|
+
**FacturLint** est le SDK Python officiel et l'outil CLI pour valider, certifier et réparer automatiquement les factures électroniques **Factur-X 1.09.2**, **EN 16931** et **BR-FR-CTC** (Réforme française 2026 de la facturation électronique, Chorus Pro et Plateformes Agréées / PDP).
|
|
44
|
+
|
|
45
|
+
Conçu sans aucune dépendance tierce (*Pure Python Standard Library*), FacturLint s'intègre en 2 minutes dans vos pipelines CI/CD, ERP, logiciels de facturation, outils comptables et agents IA via le [Serveur MCP FacturLint](https://facturlint.com/mcp).
|
|
46
|
+
|
|
47
|
+
- 🌐 Site officiel : [https://facturlint.com](https://facturlint.com)
|
|
48
|
+
- 📚 Documentation API : [https://facturlint.com/docs](https://facturlint.com/docs)
|
|
49
|
+
- 🔍 Catalogue des 110+ règles d'erreurs : [https://facturlint.com/erreurs](https://facturlint.com/erreurs)
|
|
50
|
+
- 🤖 Serveur MCP & Agent IA : [https://facturlint.com/mcp](https://facturlint.com/mcp)
|
|
51
|
+
- 💳 Tarifs & Clés API : [https://facturlint.com/#tarifs](https://facturlint.com/#tarifs)
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## ⚡ Points forts
|
|
56
|
+
|
|
57
|
+
- **100 % Déterministe & Stateless** : Aucune facture ni donnée fiscale n'est stockée en base de données (zéro rétention, conformité RGPD absolue).
|
|
58
|
+
- **Zéro dépendance d'exécution** : Fonctionne avec Python 3.9+ standard (`urllib`, `json`, `pathlib`). Aucun binaire C lourd à installer.
|
|
59
|
+
- **Validation multicouche complète** :
|
|
60
|
+
- Enveloppe physique PDF/A-3b (ISO 19005-3)
|
|
61
|
+
- Métadonnées XMP Factur-X (`fx:ConformanceLevel`, `fx:DocumentFileName`, `fx:Version`)
|
|
62
|
+
- Profil colorimétrique ICC sRGB (`OutputIntent`)
|
|
63
|
+
- Schémas XML W3C XSD officiels UN/CEFACT CII D16B
|
|
64
|
+
- Schematron européen CEN/TC 434 (Norme EN 16931-1)
|
|
65
|
+
- Règles spécifiques françaises BR-FR-CTC (DGFIP / AIFE)
|
|
66
|
+
- Audit d'intégrité arithmétique (HT + TVA = TTC)
|
|
67
|
+
- **Auto-réparation chirurgicale d'enveloppe** : Corrige les défauts techniques d'enveloppe PDF/A-3b en garantissant zéro altération des montants ni des mentions comptables.
|
|
68
|
+
- **Audit groupé par lot .ZIP** : Traitement en RAM avec rapport Excel CSV structuré pour les cabinets d'expertise comptable.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 📦 Installation
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install facturlint
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Aucun paquet tiers n'est requis. Fonctionne instantanément sous Linux, Windows et macOS.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 🚀 Utilisation en Ligne de Commande (CLI)
|
|
83
|
+
|
|
84
|
+
Une fois installé, le binaire `facturlint` est disponible dans votre terminal :
|
|
85
|
+
|
|
86
|
+
### 1. Valider une facture (Gratuit & Stateless)
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
facturlint validate facture.pdf
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Pour les pipelines CI/CD (ex: GitHub Actions), activez l'échec strict sur simple avertissement :
|
|
93
|
+
```bash
|
|
94
|
+
facturlint validate facture.pdf --fail-on-warning
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Export au format JSON pour script shell :
|
|
98
|
+
```bash
|
|
99
|
+
facturlint validate facture.pdf --json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 2. Auto-réparer l'enveloppe technique PDF/A-3b
|
|
103
|
+
|
|
104
|
+
Répare le profil ICC sRGB manquant, l'en-tête XMP Factur-X ou le dictionnaire AFRelationship sans toucher au corps de la facture :
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
facturlint repair facture_rejetee.pdf -o facture_conforme.pdf
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 3. Générer l'attestation officielle d'audit PDF
|
|
111
|
+
|
|
112
|
+
Produit une attestation infalsifiable avec empreinte SHA-256 certifiant la conformité au moment du contrôle :
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
facturlint cert facture.pdf -o attestation_audit.pdf
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 4. Traiter un lot complet de factures (.ZIP)
|
|
119
|
+
|
|
120
|
+
Idéal pour les experts-comptables et DAF traitant des centaines de factures mensuelles :
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
facturlint batch factures_mois.zip --csv rapport_excel.csv --out-zip factures_reparees.zip
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 5. Consulter le quota de votre clé API
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
export FACTURLINT_API_KEY="fl_live_votre_cle_ici"
|
|
130
|
+
facturlint quota
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 6. Consulter le catalogue des 110+ règles normatives
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
facturlint rules --category schematron_br_fr
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Chaque anomalie renvoie vers une fiche détaillée sur [https://facturlint.com/erreurs/{code}](https://facturlint.com/erreurs).
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## 💻 Utilisation comme SDK Python
|
|
144
|
+
|
|
145
|
+
### Validation simple (sans clé API)
|
|
146
|
+
|
|
147
|
+
```python
|
|
148
|
+
from facturlint_sdk import FacturLintClient
|
|
149
|
+
|
|
150
|
+
client = FacturLintClient()
|
|
151
|
+
|
|
152
|
+
# Audit d'une facture Factur-X (PDF ou XML CII)
|
|
153
|
+
report = client.validate("facture.pdf")
|
|
154
|
+
|
|
155
|
+
if report["valid"]:
|
|
156
|
+
print(f"Facture conforme ! Profil : {report['container']['detected_profile']}")
|
|
157
|
+
print(f"Total TTC : {report['invoice_summary']['grand_total']} EUR")
|
|
158
|
+
else:
|
|
159
|
+
print(f"Statut : {report['status']}")
|
|
160
|
+
for issue in report["issues"]:
|
|
161
|
+
print(f"[{issue['severity'].upper()}] {issue['code']} : {issue['message']}")
|
|
162
|
+
print(f"👉 Guide résolution : https://facturlint.com/erreurs/{issue['code']}")
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Auto-réparation PDF/A-3b & Export
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
from facturlint_sdk import FacturLintClient
|
|
169
|
+
|
|
170
|
+
client = FacturLintClient(api_key="fl_live_votre_cle")
|
|
171
|
+
|
|
172
|
+
# Répare l'enveloppe et écrit directement le fichier PDF conforme
|
|
173
|
+
result = client.repair("facture_defectueuse.pdf", output_path="facture_reparee.pdf")
|
|
174
|
+
|
|
175
|
+
if result["repaired"]:
|
|
176
|
+
print("Enveloppe PDF/A-3b réparée avec succès !")
|
|
177
|
+
for action in result["actions_applied"]:
|
|
178
|
+
print(f" - {action}")
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Audit groupé par lot .ZIP (Pour cabinets comptables)
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
from facturlint_sdk import FacturLintClient
|
|
185
|
+
|
|
186
|
+
client = FacturLintClient(api_key="fl_live_votre_cle")
|
|
187
|
+
|
|
188
|
+
batch_res = client.batch_zip(
|
|
189
|
+
"lot_novembre.zip",
|
|
190
|
+
output_csv_path="rapport_audit.csv",
|
|
191
|
+
output_zip_path="lot_novembre_repare.zip",
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
summary = batch_res["summary"]
|
|
195
|
+
print(f"Total analysé : {summary['total_files']}")
|
|
196
|
+
print(f"Conformes d'origine : {summary['compliant_initial']}")
|
|
197
|
+
print(f"Auto-réparées : {summary['auto_repaired']}")
|
|
198
|
+
print(f"Rejets métier : {summary['rejected_business']}")
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Génération d'attestation PDF certifiée
|
|
202
|
+
|
|
203
|
+
```python
|
|
204
|
+
from facturlint_sdk import FacturLintClient
|
|
205
|
+
|
|
206
|
+
client = FacturLintClient()
|
|
207
|
+
pdf_bytes = client.certificate("facture.pdf", output_path="attestation.pdf")
|
|
208
|
+
print(f"Attestation générée ({len(pdf_bytes)} octets).")
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## 🤖 Intégration Agents IA & MCP (Model Context Protocol)
|
|
214
|
+
|
|
215
|
+
FacturLint expose un serveur **Model Context Protocol** natif pour Claude Desktop, Cursor, Copilot, LangChain et AutoGen.
|
|
216
|
+
|
|
217
|
+
Configurez votre client MCP en ajoutant simplement :
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"mcpServers": {
|
|
222
|
+
"facturlint": {
|
|
223
|
+
"url": "https://facturlint.com/mcp",
|
|
224
|
+
"headers": {
|
|
225
|
+
"X-API-Key": "fl_live_votre_cle_optionnelle"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Documentation complète MCP : [https://facturlint.com/mcp](https://facturlint.com/mcp) et [Agent Card](https://facturlint.com/.well-known/agent-card.json).
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## 🛠️ Matrice des Profils Factur-X Supportés
|
|
237
|
+
|
|
238
|
+
| Profil Factur-X | Description | Usage typique |
|
|
239
|
+
| :--- | :--- | :--- |
|
|
240
|
+
| **MINIMUM** | Données d'en-tête et pied de facture | Facturation B2C / Archivage |
|
|
241
|
+
| **BASIC WL** | Données d'en-tête sans détail de lignes | Pré-comptabilité |
|
|
242
|
+
| **BASIC** | Facture avec détail de lignes standard | Facturation B2B courante |
|
|
243
|
+
| **EN 16931** | Norme européenne complète | Marchés publics, Chorus Pro, B2B FR |
|
|
244
|
+
| **EXTENDED** | Données sectorielles enrichies (BTP, négoce) | Facturation complexe |
|
|
245
|
+
|
|
246
|
+
FacturLint vérifie également les extensions françaises **BR-FR-CTC** requises par la réforme 2026 (numéros de SIRET, catégories d'opérations, options de TVA).
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## 📄 Licence & Mentions
|
|
251
|
+
|
|
252
|
+
Distribué sous licence **MIT**.
|
|
253
|
+
Édité par **FacturLint** — [https://facturlint.com](https://facturlint.com).
|
|
254
|
+
Support & Contact : `contact@facturlint.com`.
|
|
255
|
+
Consultez notre [documentation technique](https://facturlint.com/docs) et notre [catalogue de règles](https://facturlint.com/erreurs).
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# FacturLint — Factur-X 1.09.2, EN 16931 & BR-FR-CTC Python SDK & CLI
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/facturlint/)
|
|
4
|
+
[](https://pypi.org/project/facturlint/)
|
|
5
|
+
[](https://facturlint.com)
|
|
6
|
+
[](https://facturlint.com/docs)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
**FacturLint** est le SDK Python officiel et l'outil CLI pour valider, certifier et réparer automatiquement les factures électroniques **Factur-X 1.09.2**, **EN 16931** et **BR-FR-CTC** (Réforme française 2026 de la facturation électronique, Chorus Pro et Plateformes Agréées / PDP).
|
|
10
|
+
|
|
11
|
+
Conçu sans aucune dépendance tierce (*Pure Python Standard Library*), FacturLint s'intègre en 2 minutes dans vos pipelines CI/CD, ERP, logiciels de facturation, outils comptables et agents IA via le [Serveur MCP FacturLint](https://facturlint.com/mcp).
|
|
12
|
+
|
|
13
|
+
- 🌐 Site officiel : [https://facturlint.com](https://facturlint.com)
|
|
14
|
+
- 📚 Documentation API : [https://facturlint.com/docs](https://facturlint.com/docs)
|
|
15
|
+
- 🔍 Catalogue des 110+ règles d'erreurs : [https://facturlint.com/erreurs](https://facturlint.com/erreurs)
|
|
16
|
+
- 🤖 Serveur MCP & Agent IA : [https://facturlint.com/mcp](https://facturlint.com/mcp)
|
|
17
|
+
- 💳 Tarifs & Clés API : [https://facturlint.com/#tarifs](https://facturlint.com/#tarifs)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## ⚡ Points forts
|
|
22
|
+
|
|
23
|
+
- **100 % Déterministe & Stateless** : Aucune facture ni donnée fiscale n'est stockée en base de données (zéro rétention, conformité RGPD absolue).
|
|
24
|
+
- **Zéro dépendance d'exécution** : Fonctionne avec Python 3.9+ standard (`urllib`, `json`, `pathlib`). Aucun binaire C lourd à installer.
|
|
25
|
+
- **Validation multicouche complète** :
|
|
26
|
+
- Enveloppe physique PDF/A-3b (ISO 19005-3)
|
|
27
|
+
- Métadonnées XMP Factur-X (`fx:ConformanceLevel`, `fx:DocumentFileName`, `fx:Version`)
|
|
28
|
+
- Profil colorimétrique ICC sRGB (`OutputIntent`)
|
|
29
|
+
- Schémas XML W3C XSD officiels UN/CEFACT CII D16B
|
|
30
|
+
- Schematron européen CEN/TC 434 (Norme EN 16931-1)
|
|
31
|
+
- Règles spécifiques françaises BR-FR-CTC (DGFIP / AIFE)
|
|
32
|
+
- Audit d'intégrité arithmétique (HT + TVA = TTC)
|
|
33
|
+
- **Auto-réparation chirurgicale d'enveloppe** : Corrige les défauts techniques d'enveloppe PDF/A-3b en garantissant zéro altération des montants ni des mentions comptables.
|
|
34
|
+
- **Audit groupé par lot .ZIP** : Traitement en RAM avec rapport Excel CSV structuré pour les cabinets d'expertise comptable.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 📦 Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install facturlint
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Aucun paquet tiers n'est requis. Fonctionne instantanément sous Linux, Windows et macOS.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 🚀 Utilisation en Ligne de Commande (CLI)
|
|
49
|
+
|
|
50
|
+
Une fois installé, le binaire `facturlint` est disponible dans votre terminal :
|
|
51
|
+
|
|
52
|
+
### 1. Valider une facture (Gratuit & Stateless)
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
facturlint validate facture.pdf
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Pour les pipelines CI/CD (ex: GitHub Actions), activez l'échec strict sur simple avertissement :
|
|
59
|
+
```bash
|
|
60
|
+
facturlint validate facture.pdf --fail-on-warning
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Export au format JSON pour script shell :
|
|
64
|
+
```bash
|
|
65
|
+
facturlint validate facture.pdf --json
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 2. Auto-réparer l'enveloppe technique PDF/A-3b
|
|
69
|
+
|
|
70
|
+
Répare le profil ICC sRGB manquant, l'en-tête XMP Factur-X ou le dictionnaire AFRelationship sans toucher au corps de la facture :
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
facturlint repair facture_rejetee.pdf -o facture_conforme.pdf
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 3. Générer l'attestation officielle d'audit PDF
|
|
77
|
+
|
|
78
|
+
Produit une attestation infalsifiable avec empreinte SHA-256 certifiant la conformité au moment du contrôle :
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
facturlint cert facture.pdf -o attestation_audit.pdf
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 4. Traiter un lot complet de factures (.ZIP)
|
|
85
|
+
|
|
86
|
+
Idéal pour les experts-comptables et DAF traitant des centaines de factures mensuelles :
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
facturlint batch factures_mois.zip --csv rapport_excel.csv --out-zip factures_reparees.zip
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 5. Consulter le quota de votre clé API
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
export FACTURLINT_API_KEY="fl_live_votre_cle_ici"
|
|
96
|
+
facturlint quota
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 6. Consulter le catalogue des 110+ règles normatives
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
facturlint rules --category schematron_br_fr
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Chaque anomalie renvoie vers une fiche détaillée sur [https://facturlint.com/erreurs/{code}](https://facturlint.com/erreurs).
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 💻 Utilisation comme SDK Python
|
|
110
|
+
|
|
111
|
+
### Validation simple (sans clé API)
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
from facturlint_sdk import FacturLintClient
|
|
115
|
+
|
|
116
|
+
client = FacturLintClient()
|
|
117
|
+
|
|
118
|
+
# Audit d'une facture Factur-X (PDF ou XML CII)
|
|
119
|
+
report = client.validate("facture.pdf")
|
|
120
|
+
|
|
121
|
+
if report["valid"]:
|
|
122
|
+
print(f"Facture conforme ! Profil : {report['container']['detected_profile']}")
|
|
123
|
+
print(f"Total TTC : {report['invoice_summary']['grand_total']} EUR")
|
|
124
|
+
else:
|
|
125
|
+
print(f"Statut : {report['status']}")
|
|
126
|
+
for issue in report["issues"]:
|
|
127
|
+
print(f"[{issue['severity'].upper()}] {issue['code']} : {issue['message']}")
|
|
128
|
+
print(f"👉 Guide résolution : https://facturlint.com/erreurs/{issue['code']}")
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Auto-réparation PDF/A-3b & Export
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from facturlint_sdk import FacturLintClient
|
|
135
|
+
|
|
136
|
+
client = FacturLintClient(api_key="fl_live_votre_cle")
|
|
137
|
+
|
|
138
|
+
# Répare l'enveloppe et écrit directement le fichier PDF conforme
|
|
139
|
+
result = client.repair("facture_defectueuse.pdf", output_path="facture_reparee.pdf")
|
|
140
|
+
|
|
141
|
+
if result["repaired"]:
|
|
142
|
+
print("Enveloppe PDF/A-3b réparée avec succès !")
|
|
143
|
+
for action in result["actions_applied"]:
|
|
144
|
+
print(f" - {action}")
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Audit groupé par lot .ZIP (Pour cabinets comptables)
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from facturlint_sdk import FacturLintClient
|
|
151
|
+
|
|
152
|
+
client = FacturLintClient(api_key="fl_live_votre_cle")
|
|
153
|
+
|
|
154
|
+
batch_res = client.batch_zip(
|
|
155
|
+
"lot_novembre.zip",
|
|
156
|
+
output_csv_path="rapport_audit.csv",
|
|
157
|
+
output_zip_path="lot_novembre_repare.zip",
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
summary = batch_res["summary"]
|
|
161
|
+
print(f"Total analysé : {summary['total_files']}")
|
|
162
|
+
print(f"Conformes d'origine : {summary['compliant_initial']}")
|
|
163
|
+
print(f"Auto-réparées : {summary['auto_repaired']}")
|
|
164
|
+
print(f"Rejets métier : {summary['rejected_business']}")
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Génération d'attestation PDF certifiée
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
from facturlint_sdk import FacturLintClient
|
|
171
|
+
|
|
172
|
+
client = FacturLintClient()
|
|
173
|
+
pdf_bytes = client.certificate("facture.pdf", output_path="attestation.pdf")
|
|
174
|
+
print(f"Attestation générée ({len(pdf_bytes)} octets).")
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## 🤖 Intégration Agents IA & MCP (Model Context Protocol)
|
|
180
|
+
|
|
181
|
+
FacturLint expose un serveur **Model Context Protocol** natif pour Claude Desktop, Cursor, Copilot, LangChain et AutoGen.
|
|
182
|
+
|
|
183
|
+
Configurez votre client MCP en ajoutant simplement :
|
|
184
|
+
|
|
185
|
+
```json
|
|
186
|
+
{
|
|
187
|
+
"mcpServers": {
|
|
188
|
+
"facturlint": {
|
|
189
|
+
"url": "https://facturlint.com/mcp",
|
|
190
|
+
"headers": {
|
|
191
|
+
"X-API-Key": "fl_live_votre_cle_optionnelle"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Documentation complète MCP : [https://facturlint.com/mcp](https://facturlint.com/mcp) et [Agent Card](https://facturlint.com/.well-known/agent-card.json).
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## 🛠️ Matrice des Profils Factur-X Supportés
|
|
203
|
+
|
|
204
|
+
| Profil Factur-X | Description | Usage typique |
|
|
205
|
+
| :--- | :--- | :--- |
|
|
206
|
+
| **MINIMUM** | Données d'en-tête et pied de facture | Facturation B2C / Archivage |
|
|
207
|
+
| **BASIC WL** | Données d'en-tête sans détail de lignes | Pré-comptabilité |
|
|
208
|
+
| **BASIC** | Facture avec détail de lignes standard | Facturation B2B courante |
|
|
209
|
+
| **EN 16931** | Norme européenne complète | Marchés publics, Chorus Pro, B2B FR |
|
|
210
|
+
| **EXTENDED** | Données sectorielles enrichies (BTP, négoce) | Facturation complexe |
|
|
211
|
+
|
|
212
|
+
FacturLint vérifie également les extensions françaises **BR-FR-CTC** requises par la réforme 2026 (numéros de SIRET, catégories d'opérations, options de TVA).
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## 📄 Licence & Mentions
|
|
217
|
+
|
|
218
|
+
Distribué sous licence **MIT**.
|
|
219
|
+
Édité par **FacturLint** — [https://facturlint.com](https://facturlint.com).
|
|
220
|
+
Support & Contact : `contact@facturlint.com`.
|
|
221
|
+
Consultez notre [documentation technique](https://facturlint.com/docs) et notre [catalogue de règles](https://facturlint.com/erreurs).
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "facturlint"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Official Python SDK & CLI for FacturLint — Factur-X 1.09.2, EN 16931 & BR-FR-CTC validation, PDF/A-3b envelope repair & audit API."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "FacturLint", email = "contact@facturlint.com" },
|
|
14
|
+
]
|
|
15
|
+
maintainers = [
|
|
16
|
+
{ name = "FacturLint", email = "contact@facturlint.com" },
|
|
17
|
+
]
|
|
18
|
+
keywords = [
|
|
19
|
+
"factur-x",
|
|
20
|
+
"en16931",
|
|
21
|
+
"br-fr-ctc",
|
|
22
|
+
"chorus-pro",
|
|
23
|
+
"facturation-electronique",
|
|
24
|
+
"pdfa3",
|
|
25
|
+
"pdfa3b",
|
|
26
|
+
"einvoicing",
|
|
27
|
+
"xml-cii",
|
|
28
|
+
"peppol",
|
|
29
|
+
"mcp",
|
|
30
|
+
"ai-agent",
|
|
31
|
+
"stateless-api",
|
|
32
|
+
]
|
|
33
|
+
classifiers = [
|
|
34
|
+
"Development Status :: 4 - Beta",
|
|
35
|
+
"Intended Audience :: Developers",
|
|
36
|
+
"Intended Audience :: Financial and Insurance Industry",
|
|
37
|
+
"Operating System :: OS Independent",
|
|
38
|
+
"Programming Language :: Python :: 3",
|
|
39
|
+
"Programming Language :: Python :: 3.9",
|
|
40
|
+
"Programming Language :: Python :: 3.10",
|
|
41
|
+
"Programming Language :: Python :: 3.11",
|
|
42
|
+
"Programming Language :: Python :: 3.12",
|
|
43
|
+
"Programming Language :: Python :: 3.13",
|
|
44
|
+
"Topic :: Office/Business :: Financial :: Accounting",
|
|
45
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
46
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
47
|
+
"Typing :: Typed",
|
|
48
|
+
]
|
|
49
|
+
dependencies = []
|
|
50
|
+
|
|
51
|
+
[project.scripts]
|
|
52
|
+
facturlint = "facturlint_sdk.cli:main"
|
|
53
|
+
|
|
54
|
+
[project.urls]
|
|
55
|
+
Homepage = "https://facturlint.com"
|
|
56
|
+
Documentation = "https://facturlint.com/docs"
|
|
57
|
+
"Error Catalog" = "https://facturlint.com/erreurs"
|
|
58
|
+
"Pricing & API Keys" = "https://facturlint.com/#tarifs"
|
|
59
|
+
"MCP Server" = "https://facturlint.com/mcp"
|
|
60
|
+
Repository = "https://github.com/facturlint/facturlint-python"
|
|
61
|
+
"Bug Tracker" = "https://github.com/facturlint/facturlint-python/issues"
|
|
62
|
+
|
|
63
|
+
[tool.setuptools.packages.find]
|
|
64
|
+
where = ["src"]
|
|
65
|
+
|
|
66
|
+
[tool.setuptools.package-data]
|
|
67
|
+
facturlint_sdk = ["py.typed"]
|