fsprojects / IfSharp

F# for Jupyter Notebooks
Other
442 stars 71 forks source link

Generate the referencing scripts #121

Closed cgravill closed 7 years ago

cgravill commented 7 years ago

This allows the start of the notebook to be like this:

#load "Paket.fsx"
Paket.Package
  [ "MathNet.Numerics"
    "MathNet.Numerics.FSharp"
  ]
#load "Paket.Generated.Refs.fsx"

I used Paket.Generated.Refs.fsx avoiding overlap with https://github.com/fsprojects/Paket/issues/1943 alternatively all-references.fsx could also work etc.

It's less noisy and there's less magic going on but still less explicit than getting users to reference their own dlls. Thoughts? Rather than extend the Package and Version functions, we could have a separate ReferencePackages() function.

it's encapsulated a lot of the other concerns compared to the full syntax in #106

#load "Paket.fsx"

Paket.Dependencies.Install """
frameworks: net451
source https://nuget.org/api/v2
nuget MathNet.Numerics
nuget MathNet.Numerics.FSharp
"""

Paket.LoadingScripts.ScriptGeneration.generateScriptsForRootFolder Paket.LoadingScripts.ScriptGeneration.FSharp (Paket.FrameworkIdentifier.DotNetFramework Paket.FrameworkVersion.V4_5_1)  (System.IO.DirectoryInfo __SOURCE_DIRECTORY__)

then

#load "paket-files/include-scripts/net451/include.main.group.fsx"
sylvanc commented 7 years ago

Nice! What this doesn't address is the "conflicting notebooks" problem. That is, if some notebook needs version A of a package, some other notebook may need version B, and which version is actually there depends on the order in which the notebooks were executed.

cgravill commented 7 years ago

Good idea, I've factored out the common call.

Yes, this does nothing to address the issues of conflict notebook dependencies. (more detail in #112 on that issue)