Python target is in beta meaning that breaking changes can happen between minor versions.
This section is specific to Python targetting, it will guide you through the process of setting up your project and using Fable with Python.
Run your code.
When targeting Python, you will want to install the
Fable.Pythonpackage. It provides a set of bindings to the Python standard library, and so others common libraries.
dotnet add package Fable.Python
Change the content of
Program.fsto the following:
open Fable.Python.Builtins let file = builtins.``open``("test.txt", OpenTextMode.Write) file.write("Hello World!") |> ignore
Run Fable in watch mode
dotnet fable watch
If you run your node script again, you should see a new file
test.txtwith the content
Try changing the content of
Hello Worldto something else and re-run your script.
You should see that Fable re-compile your code and the file content changed.