Skip to main content

Accélérateur Rust/PyO3 pour pyhocon : parseur HOCON natif iso-fonctionnel, avec fallback transparent vers pyhocon.

Project description

pulse-pyhocon

Accélérateur Rust/PyO3 pour pyhocon — un parseur HOCON natif, iso-fonctionnel, avec fallback transparent vers pyhocon. Projet Pulse by Astek.

pyhocon est bâti sur pyparsing ; son parsing est dominé par la machinerie interprétée Python (~99 % du temps, ~1 % en regex C). pulse-pyhocon réimplémente le chemin chaud en Rust et délègue à pyhocon pour le reste — on garde l'exactitude, on gagne l'ordre de grandeur.

import pulse_pyhocon
config = pulse_pyhocon.parse(text)   # un vrai pyhocon.ConfigTree (API complète), parsé en Rust
config.get_int("server.port")        # get_string/int/float/bool/list/config, accès pointé, défaut…
config.get("db.host", "localhost")
config.with_fallback(pulse_pyhocon.parse(defaults))

parse / parse_string / parse_file renvoient un vrai pyhocon.ConfigTree → toute l'API pyhocon fonctionne (getters typés, accès pointé, with_fallback, as_plain_ordered_dict, HOCONConverter.to_hocon/json/yaml/properties). ConfigFactory, ConfigTree, HOCONConverter, from_dict, parse_URL sont ré-exportés pour un import drop-in. Le cœur Rust parse vite, puis l'arbre est bâti via ConfigFactory.from_dict (les getters/converters restent ceux de pyhocon → iso, pas de réimplémentation hors chemin chaud).

Pourquoi

  • ~200–350× plus rapide que pyhocon sur parse(...).→ConfigTree (le goulot est du Python interprété, pas une C-extension — cas d'école pour Rust). Mesuré en A/B drift-immune sur des configs réalistes. (Le parsing brut seul atteint ~1000–5000× ; bâtir le ConfigTree complet ajoute un coût modéré, conservé ici pour la compatibilité d'API totale.)
  • Iso-fonctionnel : chaque sortie est validée contre pyhocon par un oracle différentiel typé (résultat et type d'exception), sur un large corpus + fuzz adversarial plein-Unicode.
  • Toujours correct : ce que le chemin rapide ne couvre pas est délégué de façon transparente à pyhocon (NotImplementedError interne → fallback). Le drop-in ne « casse » jamais sur du HOCON que pyhocon accepte.

Couverture du chemin rapide (Rust)

Objets, tableaux, scalaires (int — y compris > 64 bits →, float, bool/null insensibles à la casse), clés pointées, fusion profonde, commentaires #///, substitutions ${path}/${?path} (type préservé, concaténation, réfs avant/arrière, sub→sub, optionnel omis, fallback env), includes de fichiers, concaténation d'objets (merge) et de tableaux. Parité des exceptions pyhocon (ConfigSubstitutionException, ConfigWrongTypeException, FileNotFoundError).

Délégué au fallback pyhocon (corrects, sans gain) : += (implémentation pyhocon spécifique), clés quotées à caractères spéciaux, valeurs vides, include url(...)/classpath(...), et — point clé pour l'iso — tout échec de résolution de substitution : auto-référence (a = ${a}), self-concaténation (path = ${path}":/usr/bin"), self-append/merge, et navigation de chemin à travers une substitution (${x.host}x = ${base}). Le noyau natif ne tente que le chemin heureux ; dès qu'il ne sait pas résoudre, il délègue à pyhocon (l'oracle), qui résout ces idiomes HOCON ou lève la bonne exception. Garantie : jamais de divergence, même sur ces cas limites.

Installation

pip install pulse-pyhocon      # tire aussi pyhocon (utilisé pour le fallback)

Des wheels précompilées sont publiées pour Linux (manylinux/musllinux), macOS et Windows. À défaut de wheel, l'installation compile le cœur Rust (toolchain Rust requise) ; le module reste utilisable via le fallback pur-Python si l'extension native n'est pas disponible.

Statut

Alpha. API : parse/parse_string/parse_filepyhocon.ConfigTree ; parse_URL/from_dict ré-exportés. pulse_pyhocon.BACKEND vaut "rust" ou "python". Feuille de route (perf, l'iso est acquise via fallback) : résolution NATIVE (au lieu du fallback) de l'auto-référence et de la navigation à travers une substitution ; includes url/classpath en natif.

Licence & crédits

Apache-2.0 (alignée sur pyhocon). pulse-pyhocon s'appuie sur pyhocon (chimpler/pyhocon, Apache-2.0) comme référence d'iso-fonctionnalité et comme fallback. Merci à ses auteurs et contributeurs.

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

pulse_pyhocon-0.2.0.tar.gz (26.8 kB view details)

Uploaded Source

Built Distributions

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

pulse_pyhocon-0.2.0-cp311-abi3-win_amd64.whl (161.0 kB view details)

Uploaded CPython 3.11+Windows x86-64

pulse_pyhocon-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (267.6 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

pulse_pyhocon-0.2.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (262.5 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

pulse_pyhocon-0.2.0-cp311-abi3-macosx_11_0_arm64.whl (248.5 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

File details

Details for the file pulse_pyhocon-0.2.0.tar.gz.

File metadata

  • Download URL: pulse_pyhocon-0.2.0.tar.gz
  • Upload date:
  • Size: 26.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pulse_pyhocon-0.2.0.tar.gz
Algorithm Hash digest
SHA256 776c69ed32e68604f44642f27fea9fd75ebb540fe323405b215be9df92cbc722
MD5 909853413df1536c38f5466a058802ed
BLAKE2b-256 98cd0acf6d12921fe6e4cb20682522dbf7636b1eb549d4b45b69ba05603d7584

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulse_pyhocon-0.2.0.tar.gz:

Publisher: release.yml on AstekGroup/pulse-pyhocon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pulse_pyhocon-0.2.0-cp311-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for pulse_pyhocon-0.2.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 38ffa6214859485fbe4013845fb0ecf50ede6b00da4e0dff18f1fec851055fa1
MD5 c094232a11964aec265f40ae5fa5d02d
BLAKE2b-256 1feafad7e32ae55b7ff812662a4b41097a11ee22fd2e912a348b6027791b5756

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulse_pyhocon-0.2.0-cp311-abi3-win_amd64.whl:

Publisher: release.yml on AstekGroup/pulse-pyhocon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pulse_pyhocon-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pulse_pyhocon-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 09319bdeb62cdaba8cd4cdf390c57113b7b9029f2608ce9f1bf4245220c5fc08
MD5 0065e53ad244c27553ce24367dec9468
BLAKE2b-256 3c1885a4b913ecc79d2641711b8ce443e90537f5ef61facd3f68506ecf241a69

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulse_pyhocon-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on AstekGroup/pulse-pyhocon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pulse_pyhocon-0.2.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pulse_pyhocon-0.2.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 972f18241139449f83666acc11c9ccc03e36be2574f489ef09784ce7123b2d98
MD5 61de1eb97e0704aeb15c2b6613027914
BLAKE2b-256 1f391aa05913bc970dc0388b9b4ee5c2ca1285b1b40b700ae7df7df33a1bb2ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulse_pyhocon-0.2.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on AstekGroup/pulse-pyhocon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pulse_pyhocon-0.2.0-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pulse_pyhocon-0.2.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f7aadcb3b9f901c639bb0b91901b55f37e07ff9e1aa4d25ca0c6dabd49e1207c
MD5 4c8d7a3149dbc79afade88e9a77b05b7
BLAKE2b-256 2129a393e133a33ca6d31e5aba7d68efa2108b6d293fd5624d9bfcac78cc0b38

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulse_pyhocon-0.2.0-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on AstekGroup/pulse-pyhocon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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