Skip to content

Commit 9d6ff6f

Browse files
author
Maxime Mangel
committed
Write first pass of Python features
1 parent 502298f commit 9d6ff6f

File tree

6 files changed

+1038
-8
lines changed

6 files changed

+1038
-8
lines changed

docs/docs/getting-started/python.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ title: Python
33
layout: standard
44
---
55

6+
:::warning
7+
Python target is in beta meaning that breaking changes can happen between minor versions.
8+
:::
69

710
This section is specific to Python targetting, it will guide you through the process of setting up your project and using Fable with Python.
811

docs/docs/javascript/features.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ Deconstruct a tuple of arguments and generate a JavaScript expression.
333333
> Expressions are values or execute to values, they can be assigned or used as operands
334334
335335
```fs
336-
open Fable.Core
336+
open Fable.Core.JsInterop
337337
338338
let two : int =
339339
emitJsExpr (1, 1) "$0 + $1"
@@ -361,7 +361,7 @@ Deconstruct a tuple of arguments and generate a JavaScript statement.
361361
> Statements are the whole structure, while expressions are the building blocks. For example, a line or a block of code is a statement.
362362
363363
```fs
364-
open Fable.Core
364+
open Fable.Core.JsInterop
365365
366366
let add (a : int) (b : int) =
367367
emitJsStatement (a, b) "return $0 + $1;"
@@ -499,7 +499,7 @@ let test(arg: U3<string, int, float[]>) =
499499

500500
### Erased types
501501

502-
Decoring a type with `[<Erased>]` allows you to instruct Fable to not generate any code for that type. This is useful when you want to use a type from a JS library that you don't want to generate bindings for.
502+
Decoring a type with `[<Erase>]` allows you to instruct Fable to not generate any code for that type. This is useful when you want to use a type from a JS library that you don't want to generate bindings for.
503503

504504
```fs
505505
open Fable.Core
@@ -537,7 +537,7 @@ export function User_$ctor() {
537537
export const x = Avatar("123");
538538
```
539539

540-
As you can see, there are some reflection information generated for the type `User`. However, if you decorate the type with `[<Erased>]`:
540+
As you can see, there are some reflection information generated for the type `User`. However, if you decorate the type with `[<Erase>]`:
541541

542542
```fs
543543
open Fable.Core
@@ -961,7 +961,7 @@ search("foo", {
961961

962962
Because JavaScript doesn't support overloading or multiple modules in a single file, Fable needs to mangle the name of some members, functions to avoid clashes.
963963

964-
However, Fable will changes the names of:
964+
However, Fable will never changes the names of:
965965

966966
- Record fields
967967
- Interface and abstract members
@@ -1129,7 +1129,7 @@ let execute (f: int->int->int) x y =
11291129
```
11301130

11311131
```js
1132-
import { execute } from "./TestFunctions.fs"
1132+
import { execute } from "./TestFunctions.fs.js"
11331133

11341134
export function execute(f, x, y) {
11351135
return f(x, y);

docs/docs/menu.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
"label": "JavaScript",
4242
"items": [
4343
"docs/javascript/build-and-run",
44-
"docs/javascript/testing",
4544
"docs/javascript/features",
4645
"docs/javascript/compatibility"
4746
]
@@ -51,11 +50,20 @@
5150
"label": "TypeScript",
5251
"items": [
5352
"docs/typescript/build-and-run",
54-
"docs/typescript/testing",
5553
"docs/typescript/features",
5654
"docs/typescript/compatibility"
5755
]
5856
},
57+
58+
{
59+
"type": "section",
60+
"label": "Python",
61+
"items": [
62+
"docs/python/build-and-run",
63+
"docs/python/features",
64+
"docs/python/compatibility"
65+
]
66+
},
5967
{
6068
"type": "section",
6169
"label": "Miscellaneous",

docs/docs/python/build-and-run.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: Build and Run
3+
layout: standard
4+
---
5+
6+
When targetting python, you can use the output of Fable directly by running it with the python interpreter.
7+
8+
For example:
9+
10+
```bash
11+
python3 Program.py
12+
```

docs/docs/python/compatibility.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: .NET and F# compatibility
3+
layout: standard
4+
---
5+
6+
:::warning
7+
Python target is in beta meaning that breaking changes can happen between minor versions.
8+
:::
9+
10+
:::warning
11+
This section is still under construction.
12+
:::

0 commit comments

Comments
 (0)