Fsdk 0.6.0--date20230318-0620.git-e0cbd25

This is a prerelease version of Fsdk.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Fsdk --version 0.6.0--date20230318-0620.git-e0cbd25                
NuGet\Install-Package Fsdk -Version 0.6.0--date20230318-0620.git-e0cbd25                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Fsdk" Version="0.6.0--date20230318-0620.git-e0cbd25" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Fsdk --version 0.6.0--date20230318-0620.git-e0cbd25                
#r "nuget: Fsdk, 0.6.0--date20230318-0620.git-e0cbd25"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Fsdk as a Cake Addin
#addin nuget:?package=Fsdk&version=0.6.0--date20230318-0620.git-e0cbd25&prerelease

// Install Fsdk as a Cake Tool
#tool nuget:?package=Fsdk&version=0.6.0--date20230318-0620.git-e0cbd25&prerelease                

FSX

PUBLIC SERVICE ANNOUNCEMENT

THIS REPO IS FACING A COMPLETE OVERHAUL/REVAMP/RENOVATION IN ORDER TO SUPPORT .NET6.

Unfinished tasks so far:

Motivation

FSX is the ideal tool for people that use F# for their scripting needs.

The best way to describe it is to start first with some questions:

  • Have you found yourself waiting many seconds until your big script is parsed by FSI and run? This is unacceptable when doing many small changes and expecting a quick feedback loop to test them.
  • Do you have long-running F# scripts that cause too much memory usage in your server?
  • Have you found that your scripts could bitrot over time (i.e. not compile anymore) especially when using helper functions in .fs files loaded by them?

These are the main annoyances when working with F# scripting. Granted, F#+FSI is already much better than the alternatives (as many more errors are thrown much earlier than at runtime, and as strongly-typed functional languages are generally faster). However, we can do better.

To the above three questions we could even follow-up with new ones:

  • Couldn't we make FSI only compile what's changed, and reuse binaries from a previous run, to speed this up?
  • Couldn't we run our script without FSI given that FSI eats a lot of memory (for REPL features, which scripts don't need)?
  • Couldn't we have a CI approach that takes care of our scripts in a similar way as we do with (msbuild-ed) C#/F# code?

FSX answers all of these latter questions with a categorical YES!

The creation of FSX was inspired by several facts:

  • FSI is slower than the F# compiler (obviously).
  • There should be an easy and programatic way to compile an F# script without trying to run it (see https://stackoverflow.com/questions/33468298/f-how-can-i-compile-and-then-release-a-file-fsx ).
  • FSI (or the components required to run it) suffers from bugs frequently. Examples:
  • FSI stands for F Sharp Interactive, which means that it's not really suited for scripting but more for debugging:
    • It doesn't treat warnings as errors by default (you would need to remember to use the flag --warnaserror when calling fsharpi, which is not handy).
    • Because of the previous point above about warnings, it can even cancel the advantage of the promise of "statically-compiled scripts" altogether, because what should be a compilation error could be translated to a runtime error when using currified arguments, due to FSI defaulting to "interactive" needs. (More info: https://stackoverflow.com/questions/38202685/fsx-script-ignoring-a-function-call-when-i-add-a-parameter-to-it )
    • AFAIK there's no way to use flags in a shebang (so can't use #!/usr/bin/env fsharpi --warnaserror as the flag gets ignored). Note that using fsx in shebang, however, will treat warnings as errors.
    • It can consume a lot of memory, just compare it this way:
echo $'#!/usr/bin/env fsharpi\nSystem.Threading.Thread.Sleep(999999999)'>testfsi.fsx
echo $'#!/usr/bin/env fsx\nSystem.Threading.Thread.Sleep(999999999)'>testfsx.fsx
chmod u+x test*.fsx
nohup ./testfsi.fsx >/dev/null 2>&1 &
nohup ./testfsx.fsx >/dev/null 2>&1 &
ps aux | grep testfs

In my machine, the above prints:

andres   23596 16.6  0.9 254504 148268 pts/24  Sl   03:38   0:01 cli /usr/lib/cli/fsharp/fsi.exe --exename:fsharpi ./testfsi.fsx
andres   23600  0.0  0.0 129332 15936 pts/24   Sl   03:38   0:00 mono bin/./testfsx.fsx.exe

Which is a huge difference in memory footprint.

How to install/use?

Installation

In Linux/macOS, the old-fashioned way by cloning and compiling it yourself:

./configure.sh --prefix=/usr/local
make
sudo make install

(If you're using Windows, just build with "make.bat" and install with "make install".)

Usage

Execution

After installing, you can already use the #!/usr/bin/env fsx shebang in your scripts.

If you want to use fsx without having to change the shebang of all your scripts, just run fsx yourscript.fsx every time.

Compilation

For your CI needs (to compile all scripts in your repo without executing them), you could call fsxc using find in your CI step.

An example of how to do this with GitHub Actions, is this YML fragment that you could add to your workflow existing in your .github/workflows/ folder:

    - name: compile F# scripts
      shell: bash
      run: |
        dotnet new tool-manifest
        dotnet tool install fsxc
        find . -type f -name "*.fsx" | xargs -t -I {} dotnet fsxc {}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Fsdk:

Package Downloads
GWallet.Backend

Package Description

ElectrumSharp

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.6.1--date20241209-1054... 40 12/9/2024
0.6.1--date20240905-0811... 62 9/5/2024
0.6.1--date20240903-0639... 63 9/3/2024
0.6.1--date20240903-0120... 49 9/3/2024
0.6.0 135 9/2/2024
0.6.0--date20240903-1047... 56 9/3/2024
0.6.0--date20240508-0331... 87 5/8/2024
0.6.0--date20240412-0839... 65 4/12/2024
0.6.0--date20240412-0731... 56 4/12/2024
0.6.0--date20240306-1035... 430 3/6/2024
0.6.0--date20240219-0203... 64 2/19/2024
0.6.0--date20240219-0120... 57 2/19/2024
0.6.0--date20231213-0703... 14,492 12/13/2023
0.6.0--date20231031-0834... 26,092 10/31/2023
0.6.0--date20230826-0914... 188 8/26/2023
0.6.0--date20230826-0557... 70 8/26/2023
0.6.0--date20230823-0555... 75 8/23/2023
0.6.0--date20230823-0541... 76 8/23/2023
0.6.0--date20230823-0528... 73 8/23/2023
0.6.0--date20230823-0404... 72 8/23/2023
0.6.0--date20230822-0935... 75 8/22/2023
0.6.0--date20230822-0807... 75 8/22/2023
0.6.0--date20230822-0700... 72 8/22/2023
0.6.0--date20230821-0702... 643 8/21/2023
0.6.0--date20230821-0554... 78 8/21/2023
0.6.0--date20230821-0454... 70 8/21/2023
0.6.0--date20230820-0145... 80 8/20/2023
0.6.0--date20230818-1152... 31,960 8/18/2023
0.6.0--date20230818-0746... 69 8/18/2023
0.6.0--date20230818-0454... 69 8/18/2023
0.6.0--date20230818-0412... 73 8/18/2023
0.6.0--date20230818-0132... 70 8/18/2023
0.6.0--date20230816-0545... 71 8/16/2023
0.6.0--date20230812-0646... 12,007 8/12/2023
0.6.0--date20230705-0933... 683 7/5/2023
0.6.0--date20230611-0542... 80 6/11/2023
0.6.0--date20230611-0251... 92 6/11/2023
0.6.0--date20230610-0604... 82 6/10/2023
0.6.0--date20230610-0601... 78 6/10/2023
0.6.0--date20230610-0526... 84 6/10/2023
0.6.0--date20230605-0900... 80 6/5/2023
0.6.0--date20230605-0423... 75 6/5/2023
0.6.0--date20230604-0409... 84 6/4/2023
0.6.0--date20230602-0434... 236 6/2/2023
0.6.0--date20230530-1155... 54,896 5/30/2023
0.6.0--date20230530-0939... 96 5/30/2023
0.6.0--date20230530-0914... 73 5/30/2023
0.6.0--date20230502-0946... 81 5/2/2023
0.6.0--date20230502-0348... 82 5/2/2023
0.6.0--date20230326-0544... 299 3/26/2023
0.6.0--date20230319-0624... 95 3/19/2023
0.6.0--date20230318-0921... 86 3/18/2023
0.6.0--date20230318-0620... 91 3/18/2023
0.6.0--date20230318-0342... 91 3/18/2023
0.6.0--date20230318-0146... 96 3/18/2023
0.6.0--date20230316-0344... 91 3/16/2023
0.6.0--date20230316-0338... 89 3/16/2023
0.6.0--date20230316-0327... 87 3/16/2023
0.6.0--date20230307-0314... 89 3/7/2023
0.6.0--date20230306-0835... 91 3/6/2023
0.6.0--date20230214-0422... 10,114 2/14/2023
0.6.0--date20230214-0358... 95 2/14/2023
0.6.0--date20230128-0944... 101 1/28/2023
0.6.0--date20230126-1011... 106 1/26/2023
0.6.0--date20230126-0934... 102 1/26/2023
0.6.0--date20230126-0611... 93 1/26/2023
0.6.0--date20230121-0757... 102 1/21/2023
0.6.0--date20230119-0904... 93 1/19/2023
0.6.0--date20230118-0634... 13,432 1/18/2023
0.6.0--date20230117-0524... 99 1/17/2023
0.6.0--date20230116-0113... 201 1/16/2023
0.6.0--date20230115-0201... 205 1/15/2023
0.6.0--date20230107-0635... 110 1/7/2023
0.6.0--date20230104-0738... 108 1/4/2023
0.6.0--date20230104-0650... 101 1/4/2023
0.6.0--date20230104-0521... 98 1/4/2023
0.6.0--date20230104-0455... 112 1/4/2023
0.6.0--date20230103-0439... 118 1/3/2023
0.6.0--date20230103-0438... 104 1/3/2023
0.6.0--date20230101-0119... 98 1/1/2023
0.5.9.10 5,179 3/26/2023
0.5.9.8 516 3/19/2023
0.5.9.7 242 3/18/2023
0.5.9.6 220 3/18/2023
0.5.9.5 229 3/18/2023
0.5.9.1 6,902 1/4/2023