Skip to main content

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

Project description

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

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

dsn_tools-0.1.2.tar.gz (368.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dsn_tools-0.1.2-py3-none-any.whl (110.0 kB view details)

Uploaded Python 3

File details

Details for the file dsn_tools-0.1.2.tar.gz.

File metadata

  • Download URL: dsn_tools-0.1.2.tar.gz
  • Upload date:
  • Size: 368.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.8

File hashes

Hashes for dsn_tools-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d613a7fd9a97ab596985f87170294c73943151d6371c544d5c25a9967961e17c
MD5 5374f5a5dd5cee980e5ac8437dea739b
BLAKE2b-256 6697e50f0c0347abe89c547269dff6c94cfe4be30114ed3df8e8d4b66180d34e

See more details on using hashes here.

File details

Details for the file dsn_tools-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: dsn_tools-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 110.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.8

File hashes

Hashes for dsn_tools-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 73c74af89609dfadc010bf024cc6e823ea0ae0c0c48f4e01e03e3ec0ee39c15c
MD5 07e4fa57fe627b46783b93358137caba
BLAKE2b-256 d6a5026f6ff61551b77690049d06e2d7356d9b2801ae3e1aa9a09a66777885e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page