Skip to content

Commit a48826b

Browse files
authored
Merge pull request #299 from lf-lang/python-12
Added documentation for the python-version option
2 parents bdc11d6 + e3c096b commit a48826b

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

docs/reference/target-declaration.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ A target specification may have optional parameters, the names and values of whi
4040
- [**no-compile**](#no-compile): If true, then do not invoke a target language compiler. Just generate code.
4141
- [**no-runtime-validation**](#no-runtime-validation): If true, disable runtime validation.
4242
- [**protobufs**](#protobufs): An array of .proto files that are to be compiled and included in the generated code.
43+
- [**python-version**](#python-version): (Python only) A string (with quotation marks) giving an exact Python version to use.
4344
- [**runtime-version**](#runtime-version): Specify which version of the runtime system to use.
4445
- [**rust-include**](#rust-include): (Rust only) A set of Rust modules in the generated project.
4546
- [**scheduler**](#scheduler): (C only) Specification of the scheduler to use.
@@ -514,6 +515,24 @@ included in the generated code. For an example, see
514515
</ShowIf>
515516
</ShowIfs>
516517

518+
## python-version
519+
520+
<ShowIfs>
521+
<ShowIf c rs cpp ts >
522+
This target does not support the `python-version` target option.
523+
</ShowIf>
524+
<ShowIf py>
525+
This argument takes a string (with quotation marks) containing a version number.
526+
This will specify the _version_ of the Python interpreter that the compiled binary will be linked and run with.
527+
For example, to get Python version 3.13.0:
528+
```lf-py
529+
target Python {
530+
python-version: "3.13.0"
531+
}
532+
```
533+
</ShowIf>
534+
</ShowIfs>
535+
517536
## runtime-version
518537

519538
<ShowIfs>

docs/reference/target-language-details.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ The following tools are required in order to compile the generated C++ source co
103103
</ShowIf>
104104
<ShowIf py>
105105

106-
To use this target, install Python 3 on your machine. See [downloading Python](https://wiki.python.org/moin/BeginnersGuide/Download).
106+
To use this target, install Python 3 on your machine.
107+
The target has been tested using Python 3.10, 3.11, 3.12, and 3.13; the nightly regression tests use Python version 3.10.0.
108+
See [downloading Python](https://wiki.python.org/moin/BeginnersGuide/Download).
107109

108110
**NOTE:** The Python target requires a C implementation of Python (nicknamed CPython). This is what you will get if you use the above link, or with most of the alternative Python installations such as Anaconda. See [Python download alternatives](https://www.python.org/download/alternatives/) for more details.
109111

0 commit comments

Comments
 (0)