fable-compiler / Fable

F# to JavaScript, TypeScript, Python, Rust and Dart Compiler
http://fable.io/
MIT License
2.93k stars 301 forks source link

python: nuget packages with hypens in their names cause import errors #3875

Closed joprice closed 1 month ago

joprice commented 3 months ago

Description

When generating python for a package like thoth-json-codec, the hypens rename in the package name, which triggers a syntax error:

 from fable_modules.thoth-json-codec.codec import (Codec_map, Codec_array, Codec_1, CodecRequireQualifiedAccess_Codec_string, CodecRequireQualifiedAccess_Codec_int)

Expected and actual results

Package names containing hyphens could be escaped as periods are:

Mapping these symbols to the same character of underscore would prevent having two dependencies that only differ in symbols, so maybe another valid character could be chosen if it is a concern.

Related information