Skip to main content

dsn-tools

Parseur et types Python pour fichiers DSN (Données Sociales Nominatives).

Installation

pip install dsn-tools
# ou avec uv
uv add dsn-tools

Utilisation rapide

En ligne de commande

# Parser un fichier DSN
dsn-tools declaration.dsn

# Sortie JSON
dsn-tools declaration.dsn --json

# Avec validation
dsn-tools declaration.dsn --validate

# Sans installer (avec uv)
uvx dsn-tools declaration.dsn --json

En Python

from dsn_tools import DSNParser

parser = DSNParser()
message = parser.parse_file("declaration.dsn")

# Accès aux données
print(message.header.nom_du_logiciel_utilise)
print(message.header.code_envoi_du_fichier_dessai_ou_reel)

# Export JSON
json_output = message.to_json()

# Conversion en dictionnaire
data = message.to_dict()

Caractéristiques

  • ✅ 59 blocs DSN supportés (CT2026)
  • ✅ Types Python fortement typés avec dataclasses
  • ✅ Validation des données avec regex
  • ✅ Export JSON natif
  • ✅ Enums avec descriptions lisibles (pas seulement les codes)
  • ✅ CLI simple et rapide

Exemple de sortie JSON

{
  "header": {
    "nom_du_logiciel_utilise": "MonLogiciel",
    "code_envoi_du_fichier_dessai_ou_reel": "envoi fichier réel",
    "type_de_lenvoi": "envoi normal"
  },
  "declarations": [...],
  "footer": {...}
}

Licence

WTFPL - Do What The Fuck You Want To Public License

Metadata

Release files for dsn-tools 0.1.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 dsn-tools 0.1.2
File Size Uploaded
dsn_tools-0.1.2.tar.gz 368.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dsn-tools 0.1.2
File Interpreter ABI Platform
dsn_tools-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 478.3 kB

Release files / dsn_tools-0.1.2.tar.gz

Download URL dsn_tools-0.1.2.tar.gz
Size 368.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d613a7fd9a97ab596985f87170294c73943151d6371c544d5c25a9967961e17c
BLAKE2b-256 checksum
How to use checksums
6697e50f0c0347abe89c547269dff6c94cfe4be30114ed3df8e8d4b66180d34e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.8

Release files / dsn_tools-0.1.2-py3-none-any.whl

Download URL dsn_tools-0.1.2-py3-none-any.whl
Size 110.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73c74af89609dfadc010bf024cc6e823ea0ae0c0c48f4e01e03e3ec0ee39c15c
BLAKE2b-256 checksum
How to use checksums
d6a5026f6ff61551b77690049d06e2d7356d9b2801ae3e1aa9a09a66777885e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.8

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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