33![ Build and Test] ( https://github.com/dbrattli/Fable.Python/workflows/Build%20and%20Test/badge.svg )
44[ ![ Nuget] ( https://img.shields.io/nuget/vpre/Fable.Python )] ( https://www.nuget.org/packages/Fable.Python/ )
55
6- [ Fable] ( https://github.com/fable-compiler/Fable/tree/beyond ) is a compiler that
7- translates F# source files to JavaScript and Python.
6+ [ Fable] ( https://github.com/fable-compiler/Fable/tree/beyond ) is a
7+ compiler that translates F# source files to JavaScript and Python.
88
9- This Fable Python repository is a community driven project that contains the Python type bindings for Fable. The
10- library will eventually contain Python (stdlib) bindings for Fable based on Python
11- [ typeshed] ( https://github.com/python/typeshed ) . It will also contain type binding for many other 3rd party libraries
12- such as Flask, MicroBit and many more. Some bindings have already been added:
9+ This Fable Python repository is a community driven project that contains
10+ the Python type bindings for Fable. The library will eventually contain
11+ Python (stdlib) bindings for Fable based on Python
12+ [ typeshed] ( https://github.com/python/typeshed ) . It will also contain
13+ type binding for many other 3rd party libraries such as Flask, MicroBit
14+ and many more. Some bindings have already been added:
1315
1416- Python Standard Libray
1517- Jupyter
@@ -19,16 +21,17 @@ such as Flask, MicroBit and many more. Some bindings have already been added:
1921
2022## Version
2123
22- This library currently targets Python 3.9. Types bindings for other versions of Python should not be added to this
23- library until we decide how to deal with Python version handling.
24+ This library currently targets Python 3.9. Types bindings for other
25+ versions of Python should not be added to this library until we decide
26+ how to deal with Python version handling.
2427
2528## Installation
2629
2730Prerequisite for compiling F# to Python using Fable:
2831
2932``` sh
30- > dotnet tool install --global fable-py --version 4.0.0-alpha-032
31- > dotnet add package Fable.Core.Experimental --version 4.0.0-alpha-032
33+ > dotnet tool install --global fable --version 4.0.0-snake-island- alpha-006
34+ > dotnet add package Fable.Core --version 4.0.0-snake-island- alpha-006
3235```
3336
3437To use the ` Fable.Python ` library in your Fable project:
@@ -49,7 +52,7 @@ let result = json.dumps object
4952To compile an F# Fable project to Python run e.g:
5053
5154``` sh
52- > fable-py MyProject.fsproj
55+ > fable --lang Python MyProject.fsproj
5356```
5457
5558For more examples see the
@@ -74,25 +77,38 @@ It contains example code for using Fable Python with:
7477- [ TypedCssClasses] ( https://github.com/zanaptak/TypedCssClasses )
7578- [ Typed-BNF] ( https://github.com/thautwarm/Typed-BNF#readme )
7679
80+ ## Poetry
81+
82+ Fable.Python uses [ Poetry] ( https://python-poetry.org/ ) for package and
83+ dependency management. This means that packages generated within
84+ ` fable_modules ` must be referenced as [ path
85+ dependencies] ( https://python-poetry.org/docs/dependency-specification/#path-dependencies ) .
86+ It is also possible to reference
87+ [ fable-library] ( https://pypi.org/project/fable-library/ ) from PyPI to
88+ avoid bundling the code.
89+
7790## Contributing
7891
79- This project is community driven. If the type binding you are looking for is currently missing, then
80- you need to add them to the relavant files (or add new ones). Open a [ PR] ( https://github.com/dbrattli/Fable.Python/pull/3/files ) to
81- get them included.
92+ This project is community driven. If the type binding you are looking
93+ for is currently missing, then you need to add them to the relavant
94+ files (or add new ones). Open a
95+ [ PR] ( https://github.com/dbrattli/Fable.Python/pull/3/files ) to get them
96+ included.
8297
83- The ` src/stdlib ` directory contains type bindings for modules in the Python 3 standard library. We also accept type
84- bindings for 3rd party libraries as long as:
98+ The ` src/stdlib ` directory contains type bindings for modules in the
99+ Python 3 standard library. We also accept type bindings for 3rd party
100+ libraries as long as:
85101
86102- the package is publicly available on the [ Python Package Index] ( https://pypi.org/ ) ;
87103- the package supports any Python version supported by Fable Python; and
88104- the package does not ship with its own stubs or type annotations
89105
90- There's not much Python specific documentation yet, but the process of adding type bindings for Python is similar to JS:
106+ There's not much Python specific documentation yet, but the process of
107+ adding type bindings for Python is similar to JS:
91108
92109- https://fable.io/docs/communicate/js-from-fable.html
93110- https://medium.com/@zaid.naom/f-interop-with-javascript-in-fable-the-complete-guide-ccc5b896a59f
94111
95-
96112## Differences from JS
97113
98114Note that import all is different from JS. E.g:
@@ -117,3 +133,14 @@ Current plan:
1171331 . Add bindings for Python ` ast ` module (in progress)
1181342 . Use ` ast ` module to parse Python typeshed annotations
1191353 . Generate F# bindings
136+
137+ ## Road-map
138+
139+ - Use a dedicated List.fs for Python. List.fs currently depends on
140+ Array.fs that is not an efficient list implmentation for Python.
141+
142+ - Compile Fable.Library as a published library (done)
143+
144+ - Use poetry for Python references to Fable modules (done)
145+
146+ - Update docs
0 commit comments