diff --git a/.fantomasignore b/.fantomasignore
new file mode 100644
index 000000000..cfdc4db2d
--- /dev/null
+++ b/.fantomasignore
@@ -0,0 +1,2 @@
+paket-files/
+tests/
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 62a9917a7..37251f12f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -32,14 +32,22 @@ Type providers consist of two components:
CSV provider, this component does the type inference and generates types
(that are mapped to runtime components by the compiler).
-We need a _runtime component_ for .NET Standard 2.0 (netstandard2.0). We also need a _design time_
-component for each, to be able to host the type provider in .NET Core-based tooling.
+We need _runtime components_ for .NET Standard 2.0 (netstandard2.0). We also need a _design time_
+component, to be able to host the type providers in .NET Core-based tooling.
-The _runtime_ components are in the following project:
+The _core_ runtime components are the following projects. No type providers are activated if you reference these:
+
+ * **FSharp.Data.Http**
+ * **FSharp.Data.Csv.Core**
+ * **FSharp.Data.Html.Core**
+ * **FSharp.Data.Json.Core**
+ * **FSharp.Data.Xml.Core**
+
+The _enhanced_ runtime component that mentions the associated the design-time component is in the following project:
* **FSharp.Data**
-The _design time_ components are in the following project:
+The design-time component is the following project:
* **FSharp.Data.DesignTime**
diff --git a/Directory.Build.props b/Directory.Build.props
index 3459447c8..03c303658 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -11,5 +11,13 @@
https://fsprojects.github.io/FSharp.Data
https://raw.githubusercontent.com/fsprojects/FSharp.Data/master/docs/img/logo.png
git
+ true
+ $(MSBuildThisFileDirectory)src\keyfile.snk
+ false
+ $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
+ true
+ true
+ true
+ Embedded
diff --git a/FSharp.Data.sln b/FSharp.Data.sln
index 3f7d10b36..019afa28d 100755
--- a/FSharp.Data.sln
+++ b/FSharp.Data.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26730.16
+# Visual Studio Version 17
+VisualStudioVersion = 17.4.32814.64
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{7E48C05A-8C42-4871-A618-180BEEF696AA}"
ProjectSection(SolutionItems) = preProject
@@ -53,17 +53,17 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ja", "ja", "{CA5C64CE-E68C-4320-A00A-E67CA883B9D2}"
ProjectSection(SolutionItems) = preProject
docs\ja\contributing.md = docs\ja\contributing.md
- docs\ja\fsharpdata.md = docs\ja\fsharpdata.md
- docs\ja\index.md = docs\ja\index.md
docs\ja\library\CsvFile.fsx = docs\ja\library\CsvFile.fsx
docs\ja\library\CsvProvider.fsx = docs\ja\library\CsvProvider.fsx
+ docs\ja\fsharpdata.md = docs\ja\fsharpdata.md
docs\ja\library\Http.fsx = docs\ja\library\Http.fsx
+ docs\ja\index.md = docs\ja\index.md
docs\ja\library\JsonProvider.fsx = docs\ja\library\JsonProvider.fsx
+ docs\ja\tutorials\JsonToXml.fsx = docs\ja\tutorials\JsonToXml.fsx
docs\ja\library\JsonValue.fsx = docs\ja\library\JsonValue.fsx
+ docs\tools\templates\ja\template.cshtml = docs\tools\templates\ja\template.cshtml
docs\ja\library\WorldBank.fsx = docs\ja\library\WorldBank.fsx
docs\ja\library\XmlProvider.fsx = docs\ja\library\XmlProvider.fsx
- docs\ja\tutorials\JsonToXml.fsx = docs\ja\tutorials\JsonToXml.fsx
- docs\tools\templates\ja\template.cshtml = docs\tools\templates\ja\template.cshtml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{36E72EB1-5847-4B38-8993-B951648CB0D9}"
@@ -77,21 +77,32 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProjectSection
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data", "src\FSharp.Data\FSharp.Data.fsproj", "{6EBFDE55-9687-40A9-8C1A-6E204ECB117F}"
- ProjectSection(ProjectDependencies) = postProject
- {B85F245B-3FB9-4253-8251-16F98F05B6EC} = {B85F245B-3FB9-4253-8251-16F98F05B6EC}
- EndProjectSection
-EndProject
-Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.DesignTime", "src\FSharp.Data.DesignTime\FSharp.Data.DesignTime.fsproj", "{B85F245B-3FB9-4253-8251-16F98F05B6EC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1F33D53A-C007-408C-AF6C-B7D62288F941}"
EndProject
-Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Data.Reference.Tests", "tests\FSharp.Data.Reference.Tests\FSharp.Data.Reference.Tests.fsproj", "{DE36F8D0-7895-4ABD-9755-921F1BEAD3C9}"
+Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.Reference.Tests", "tests\FSharp.Data.Reference.Tests\FSharp.Data.Reference.Tests.fsproj", "{DE36F8D0-7895-4ABD-9755-921F1BEAD3C9}"
+EndProject
+Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.Core.Tests", "tests\FSharp.Data.Core.Tests\FSharp.Data.Core.Tests.fsproj", "{1746A3E0-32A2-49A7-9C8A-A0BCB52683B0}"
+EndProject
+Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.DesignTime.Tests", "tests\FSharp.Data.DesignTime.Tests\FSharp.Data.DesignTime.Tests.fsproj", "{A5B31ACC-56FB-4EC2-917F-BEB3754EF9AC}"
EndProject
-Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Data.Tests", "tests\FSharp.Data.Tests\FSharp.Data.Tests.fsproj", "{1746A3E0-32A2-49A7-9C8A-A0BCB52683B0}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FSharp.Data.Core.Tests.CSharp", "tests\FSharp.Data.Core.Tests.CSharp\FSharp.Data.Core.Tests.CSharp.csproj", "{290FED0C-D7C8-486F-AACF-3D7A1304C863}"
EndProject
-Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Data.DesignTime.Tests", "tests\FSharp.Data.DesignTime.Tests\FSharp.Data.DesignTime.Tests.fsproj", "{A5B31ACC-56FB-4EC2-917F-BEB3754EF9AC}"
+Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.Json.Core", "src\FSharp.Data.Json.Core\FSharp.Data.Json.Core.fsproj", "{DAEBFBCF-84CD-40BB-B8F6-99B1A9C4641F}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FSharp.Data.Tests.CSharp", "tests\FSharp.Data.Tests.CSharp\FSharp.Data.Tests.CSharp.csproj", "{290FED0C-D7C8-486F-AACF-3D7A1304C863}"
+Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.Tests", "tests\FSharp.Data.Tests\FSharp.Data.Tests.fsproj", "{750148EC-6A05-421D-96A4-E5AC9D18AF58}"
+EndProject
+Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.DesignTime", "src\FSharp.Data.DesignTime\FSharp.Data.DesignTime.fsproj", "{44E0DF97-D8FD-4805-8A84-B888D9589C8A}"
+EndProject
+Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.Html.Core", "src\FSharp.Data.Html.Core\FSharp.Data.Html.Core.fsproj", "{E91BF68E-257C-43E6-BDE9-672D4E3BFAFA}"
+EndProject
+Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.Http", "src\FSharp.Data.Http\FSharp.Data.Http.fsproj", "{29EDED03-D2D6-415C-A17D-00806C52035A}"
+EndProject
+Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.Xml.Core", "src\FSharp.Data.Xml.Core\FSharp.Data.Xml.Core.fsproj", "{1ECEFFEE-1040-40ED-9EB5-CE720A33058D}"
+EndProject
+Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.Csv.Core", "src\FSharp.Data.Csv.Core\FSharp.Data.Csv.Core.fsproj", "{0A1B8B61-268D-4061-B567-A47141C608E4}"
+EndProject
+Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.WorldBank.Core", "src\FSharp.Data.WorldBank.Core\FSharp.Data.WorldBank.Core.fsproj", "{A69D007B-EAF0-4866-A8B4-A2EDF2614E56}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -103,10 +114,6 @@ Global
{6EBFDE55-9687-40A9-8C1A-6E204ECB117F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6EBFDE55-9687-40A9-8C1A-6E204ECB117F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6EBFDE55-9687-40A9-8C1A-6E204ECB117F}.Release|Any CPU.Build.0 = Release|Any CPU
- {B85F245B-3FB9-4253-8251-16F98F05B6EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B85F245B-3FB9-4253-8251-16F98F05B6EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B85F245B-3FB9-4253-8251-16F98F05B6EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B85F245B-3FB9-4253-8251-16F98F05B6EC}.Release|Any CPU.Build.0 = Release|Any CPU
{DE36F8D0-7895-4ABD-9755-921F1BEAD3C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE36F8D0-7895-4ABD-9755-921F1BEAD3C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE36F8D0-7895-4ABD-9755-921F1BEAD3C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -123,17 +130,50 @@ Global
{290FED0C-D7C8-486F-AACF-3D7A1304C863}.Debug|Any CPU.Build.0 = Debug|Any CPU
{290FED0C-D7C8-486F-AACF-3D7A1304C863}.Release|Any CPU.ActiveCfg = Release|Any CPU
{290FED0C-D7C8-486F-AACF-3D7A1304C863}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DAEBFBCF-84CD-40BB-B8F6-99B1A9C4641F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DAEBFBCF-84CD-40BB-B8F6-99B1A9C4641F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DAEBFBCF-84CD-40BB-B8F6-99B1A9C4641F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DAEBFBCF-84CD-40BB-B8F6-99B1A9C4641F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {750148EC-6A05-421D-96A4-E5AC9D18AF58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {750148EC-6A05-421D-96A4-E5AC9D18AF58}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {750148EC-6A05-421D-96A4-E5AC9D18AF58}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {750148EC-6A05-421D-96A4-E5AC9D18AF58}.Release|Any CPU.Build.0 = Release|Any CPU
+ {44E0DF97-D8FD-4805-8A84-B888D9589C8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {44E0DF97-D8FD-4805-8A84-B888D9589C8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {44E0DF97-D8FD-4805-8A84-B888D9589C8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {44E0DF97-D8FD-4805-8A84-B888D9589C8A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E91BF68E-257C-43E6-BDE9-672D4E3BFAFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E91BF68E-257C-43E6-BDE9-672D4E3BFAFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E91BF68E-257C-43E6-BDE9-672D4E3BFAFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E91BF68E-257C-43E6-BDE9-672D4E3BFAFA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {29EDED03-D2D6-415C-A17D-00806C52035A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {29EDED03-D2D6-415C-A17D-00806C52035A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {29EDED03-D2D6-415C-A17D-00806C52035A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {29EDED03-D2D6-415C-A17D-00806C52035A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1ECEFFEE-1040-40ED-9EB5-CE720A33058D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1ECEFFEE-1040-40ED-9EB5-CE720A33058D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1ECEFFEE-1040-40ED-9EB5-CE720A33058D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1ECEFFEE-1040-40ED-9EB5-CE720A33058D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0A1B8B61-268D-4061-B567-A47141C608E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0A1B8B61-268D-4061-B567-A47141C608E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0A1B8B61-268D-4061-B567-A47141C608E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0A1B8B61-268D-4061-B567-A47141C608E4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A69D007B-EAF0-4866-A8B4-A2EDF2614E56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A69D007B-EAF0-4866-A8B4-A2EDF2614E56}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A69D007B-EAF0-4866-A8B4-A2EDF2614E56}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A69D007B-EAF0-4866-A8B4-A2EDF2614E56}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {34E4FA16-B344-439D-A789-1E8355E5659F}
- EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{DE36F8D0-7895-4ABD-9755-921F1BEAD3C9} = {1F33D53A-C007-408C-AF6C-B7D62288F941}
{1746A3E0-32A2-49A7-9C8A-A0BCB52683B0} = {1F33D53A-C007-408C-AF6C-B7D62288F941}
{A5B31ACC-56FB-4EC2-917F-BEB3754EF9AC} = {1F33D53A-C007-408C-AF6C-B7D62288F941}
{290FED0C-D7C8-486F-AACF-3D7A1304C863} = {1F33D53A-C007-408C-AF6C-B7D62288F941}
+ {750148EC-6A05-421D-96A4-E5AC9D18AF58} = {1F33D53A-C007-408C-AF6C-B7D62288F941}
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {34E4FA16-B344-439D-A789-1E8355E5659F}
EndGlobalSection
EndGlobal
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index d09668a20..21da41fe3 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,3 +1,13 @@
+### 5.0.1 - Aug 15 2022
+
+* There are now multiple packages
+ * FSharp.Data -- includes everything
+ * FSharp.Data.Http -- http types/helpers
+ * FSharp.Data.Csv.Core -- csv types/helpers
+ * FSharp.Data.Json.Core -- json types/helpers
+ * FSharp.Data.Html.Core -- html types/helpers
+ * FSharp.Data.Xml.Core -- xml types/helpers
+
### 4.2.10 - Aug 12 2022
* Implement "inline schemas": ability to add type hints into the type providers' source documents by @mlaily in https://github.com/fsprojects/FSharp.Data/pull/1447
diff --git a/build.fsx b/build.fsx
index 0eead60f0..46d0a3f5f 100644
--- a/build.fsx
+++ b/build.fsx
@@ -36,9 +36,15 @@ let summary = "Library of F# type providers and data access tools"
let description =
"""
- The FSharp.Data package contains type providers and utilities to access
- common data formats (CSV, HTML, JSON and XML in your F# applications and scripts. It also
- contains helpers for parsing CSV, HTML and JSON files and for sending HTTP requests."""
+ The FSharp.Data packages contain type providers and utilities to access
+ common data formats (CSV, HTML, JSON and XML in your F# applications and scripts.
+
+ * FSharp.Data -- includes everything
+ * FSharp.Data.Http -- http types/helpers
+ * FSharp.Data.Csv.Core -- csv types/helpers
+ * FSharp.Data.Json.Core -- json types/helpers
+ * FSharp.Data.Html.Core -- html types/helpers
+ * FSharp.Data.Xml.Core -- xml types/helpers"""
let tags =
"F# fsharp data typeprovider WorldBank CSV HTML CSS JSON XML HTTP linqpad-samples"
@@ -120,9 +126,9 @@ Target.create "RunTests" (fun _ ->
"FSharp.Data.sln" |> DotNet.test setParams)
// --------------------------------------------------------------------------------------
-// Build a NuGet package
+// Build packages
-Target.create "NuGet" (fun _ ->
+Target.create "Pack" (fun _ ->
// Format the release notes
let releaseNotes = release.Notes |> String.concat "\n"
@@ -136,12 +142,7 @@ Target.create "NuGet" (fun _ ->
("PackageLicenseExpression", license)
("PackageReleaseNotes", releaseNotes)
("Summary", summary)
- ("PackageDescription", description)
- ("EnableSourceLink", "true")
- ("PublishRepositoryUrl", "true")
- ("EmbedUntrackedSources", "true")
- ("IncludeSymbols", "true")
- ("SymbolPackageFormat", "snupkg") ]
+ ("PackageDescription", description) ]
DotNet.pack
(fun p ->
@@ -149,7 +150,7 @@ Target.create "NuGet" (fun _ ->
Configuration = DotNet.BuildConfiguration.Release
OutputPath = Some "bin"
MSBuildParams = { p.MSBuildParams with Properties = properties } })
- "src/FSharp.Data/FSharp.Data.fsproj")
+ "FSharp.Data.sln")
// --------------------------------------------------------------------------------------
// Generate the documentation
@@ -178,7 +179,7 @@ Target.create "Help" (fun _ ->
printfn " * Build"
printfn " * RunTests"
printfn " * GenerateDocs"
- printfn " * NuGet (creates package only, doesn't publish)"
+ printfn " * Pack (creates package only, doesn't publish)"
printfn " * All (calls previous 5)"
printfn ""
printfn " Other targets:"
@@ -228,7 +229,7 @@ Target.create "All" ignore
==> "GenerateDocs"
==> "All"
-"Build" ==> "NuGet" ==> "All"
+"Build" ==> "Pack" ==> "All"
"Build" ==> "All"
"Build" ==> "RunTests" ==> "All"
diff --git a/docs/library/CsvFile.fsx b/docs/library/CsvFile.fsx
index ef3316694..70bc22bf1 100644
--- a/docs/library/CsvFile.fsx
+++ b/docs/library/CsvFile.fsx
@@ -6,18 +6,20 @@ index: 2
---
*)
(*** condition: prepare ***)
+#r "../../src/FSharp.Data/bin/Release/netstandard2.0/FSharp.Data.Http.dll"
+#r "../../src/FSharp.Data/bin/Release/netstandard2.0/FSharp.Data.Csv.Core.dll"
#r "../../src/FSharp.Data/bin/Release/netstandard2.0/FSharp.Data.dll"
(*** condition: fsx ***)
#if FSX
#r "nuget: FSharp.Data,{{fsdocs-package-version}}"
-#endif // FSX
+#endif
(*** condition: ipynb ***)
#if IPYNB
#r "nuget: FSharp.Data,{{fsdocs-package-version}}"
Formatter.SetPreferredMimeTypesFor(typeof, "text/plain")
-Formatter.Register(fun (x:obj) (writer: TextWriter) -> fprintfn writer "%120A" x )
-#endif // IPYNB
+Formatter.Register(fun (x: obj) (writer: TextWriter) -> fprintfn writer "%120A" x)
+#endif
(**
[](https://mybinder.org/v2/gh/fsprojects/FSharp.Data/gh-pages?filepath={{fsdocs-source-basename}}.ipynb)
[]({{root}}/{{fsdocs-source-basename}}.fsx)
@@ -48,12 +50,14 @@ points to a live CSV file on the Yahoo finance web site:
*)
// Download the stock prices
-let msft = CsvFile.Load(__SOURCE_DIRECTORY__ + "/../data/MSFT.csv").Cache()
+let msft =
+ CsvFile
+ .Load(__SOURCE_DIRECTORY__ + "/../data/MSFT.csv")
+ .Cache()
// Print the prices in the HLOC format
for row in msft.Rows |> Seq.truncate 10 do
- printfn "HLOC: (%s, %s, %s)"
- (row.GetColumn "High") (row.GetColumn "Low") (row.GetColumn "Date")
+ printfn "HLOC: (%s, %s, %s)" (row.GetColumn "High") (row.GetColumn "Low") (row.GetColumn "Date")
(*** include-fsi-merged-output ***)
(**
@@ -92,8 +96,7 @@ The following example shows how to process the sample previous CSV sample using
open FSharp.Data.CsvExtensions
for row in msft.Rows |> Seq.truncate 10 do
- printfn "HLOC: (%f, %M, %O)"
- (row.["High"].AsFloat()) (row?Low.AsDecimal()) (row?Date.AsDateTime())
+ printfn "HLOC: (%f, %M, %O)" (row.["High"].AsFloat()) (row?Low.AsDecimal()) (row?Date.AsDateTime())
(*** include-fsi-merged-output ***)
@@ -108,7 +111,8 @@ separator and quote characters when saving.
*)
// Saving the first 10 stock prices where the closing price is higher than the opening price in TSV format:
-msft.Filter(fun row -> row?Close.AsFloat() > row?Open.AsFloat())
+msft
+ .Filter(fun row -> row?Close.AsFloat() > row?Open.AsFloat())
.Truncate(10)
.SaveToString('\t')
diff --git a/docs/library/CsvProvider.fsx b/docs/library/CsvProvider.fsx
index 059fff799..d62078e90 100644
--- a/docs/library/CsvProvider.fsx
+++ b/docs/library/CsvProvider.fsx
@@ -6,18 +6,20 @@ index: 1
---
*)
(*** condition: prepare ***)
+#r "../../src/FSharp.Data/bin/Release/netstandard2.0/FSharp.Data.Http.dll"
+#r "../../src/FSharp.Data/bin/Release/netstandard2.0/FSharp.Data.Csv.Core.dll"
#r "../../src/FSharp.Data/bin/Release/netstandard2.0/FSharp.Data.dll"
(*** condition: fsx ***)
#if FSX
#r "nuget: FSharp.Data,{{fsdocs-package-version}}"
-#endif // FSX
+#endif
(*** condition: ipynb ***)
#if IPYNB
#r "nuget: FSharp.Data,{{fsdocs-package-version}}"
Formatter.SetPreferredMimeTypesFor(typeof, "text/plain")
-Formatter.Register(fun (x:obj) (writer: TextWriter) -> fprintfn writer "%120A" x )
-#endif // IPYNB
+Formatter.Register(fun (x: obj) (writer: TextWriter) -> fprintfn writer "%120A" x)
+#endif
(**
[](https://mybinder.org/v2/gh/fsprojects/FSharp.Data/gh-pages?filepath={{fsdocs-source-basename}}.ipynb)
@@ -84,7 +86,10 @@ The following sample calls the `Load` method with an URL that points to a live C
*)
// Download the stock prices
-let msft = Stocks.Load(__SOURCE_DIRECTORY__ + "/../data/MSFT.csv").Cache()
+let msft =
+ Stocks
+ .Load(__SOURCE_DIRECTORY__ + "/../data/MSFT.csv")
+ .Cache()
// Look at the most recent row. Note the 'Date' property
// is of type 'DateTime' and 'Open' has a type 'decimal'
@@ -94,7 +99,7 @@ let lastOpen = firstRow.Open
// Print the first 10 prices in the HLOC format
for row in msft.Rows |> Seq.truncate 10 do
- printfn "HLOC: (%A, %A, %A, %A)" row.High row.Low row.Open row.Close
+ printfn "HLOC: (%A, %A, %A, %A)" row.High row.Low row.Open row.Close
(*** include-fsi-merged-output ***)
@@ -127,7 +132,8 @@ a static argument. Also note that in this case we're using the same data at runt
so we use the `GetSample` method instead of calling `Load` and passing the same parameter again.
*)
-let small = CsvProvider<"../data/SmallTest.csv", ResolutionFolder=ResolutionFolder>.GetSample()
+let small =
+ CsvProvider<"../data/SmallTest.csv", ResolutionFolder=ResolutionFolder>.GetSample ()
(*** include-fsi-merged-output ***)
@@ -135,7 +141,8 @@ let small = CsvProvider<"../data/SmallTest.csv", ResolutionFolder=ResolutionFold
We can also use the default constructor instead of the `GetSample` static method:
*)
-let small2 = new CsvProvider<"../data/SmallTest.csv", ResolutionFolder=ResolutionFolder>()
+let small2 =
+ new CsvProvider<"../data/SmallTest.csv", ResolutionFolder=ResolutionFolder>()
(*** include-fsi-merged-output ***)
@@ -151,9 +158,10 @@ following simple calculation:
open FSharp.Data.UnitSystems.SI.UnitNames
for row in small.Rows do
- let speed = row.Distance / row.Time
- if speed > 15.0M then
- printfn "%s (%A m/s)" row.Name speed
+ let speed = row.Distance / row.Time
+
+ if speed > 15.0M then
+ printfn "%s (%A m/s)" row.Name speed
(*** include-fsi-merged-output ***)
@@ -178,8 +186,8 @@ type AirQuality = CsvProvider<"../data/AirQuality.csv", ";", ResolutionFolder=Re
let airQuality = new AirQuality()
for row in airQuality.Rows |> Seq.truncate 10 do
- if row.Month > 6 then
- printfn "Temp: %i Ozone: %f " row.Temp row.Ozone
+ if row.Month > 6 then
+ printfn "Temp: %i Ozone: %f " row.Temp row.Ozone
(*** include-fsi-merged-output ***)
@@ -195,18 +203,21 @@ we also set `IgnoreErrors` static parameter to `true` so that lines with incorre
are automatically skipped (the sample file ([`data/MortalityNY.csv`](../data/MortalityNY.tsv)) contains additional unstructured data at the end):
*)
-let mortalityNy = CsvProvider<"../data/MortalityNY.tsv", IgnoreErrors=true, ResolutionFolder=ResolutionFolder>.GetSample()
+let mortalityNy =
+ CsvProvider<"../data/MortalityNY.tsv", IgnoreErrors=true, ResolutionFolder=ResolutionFolder>.GetSample ()
// Find the name of a cause based on code
// (Pedal cyclist injured in an accident)
-let cause = mortalityNy.Rows |> Seq.find (fun r ->
- r.``Cause of death Code`` = "V13.4")
+let cause =
+ mortalityNy.Rows
+ |> Seq.find (fun r -> r.``Cause of death Code`` = "V13.4")
// Print the number of injured cyclists
printfn "CAUSE: %s" cause.``Cause of death``
+
for r in mortalityNy.Rows do
- if r.``Cause of death Code`` = "V13.4" then
- printfn "%s (%d cases)" r.County r.Count
+ if r.``Cause of death Code`` = "V13.4" then
+ printfn "%s (%d cases)" r.County r.Count
(*** include-fsi-merged-output ***)
@@ -229,8 +240,9 @@ the `MissingValues` static parameter of `CsvProvider` as a comma-separated strin
For example, to ignore `this` and `that` we could do:
*)
-CsvProvider<"X,Y,Z\nthis,that,1.0",
- MissingValues="this,that">.GetSample().Rows
+CsvProvider<"X,Y,Z\nthis,that,1.0", MissingValues="this,that">
+ .GetSample()
+ .Rows
(*** include-fsi-merged-output ***)
(**
@@ -241,11 +253,11 @@ each row, then remove missing values and then use the standard `Seq.average` fun
open System
let mean =
- airQuality.Rows
- |> Seq.toArray
- |> Array.map (fun row -> row.Ozone)
- |> Array.filter (fun elem -> not (Double.IsNaN elem))
- |> Array.average
+ airQuality.Rows
+ |> Seq.toArray
+ |> Array.map (fun row -> row.Ozone)
+ |> Array.filter (fun elem -> not (Double.IsNaN elem))
+ |> Array.average
(*** include-fsi-merged-output ***)
@@ -320,15 +332,12 @@ consider that row as a data row. In that case, the columns will be named `Column
names are overridden using the `Schema` parameter. Note that you can override only the name in the `Schema` parameter
and still have the provider infer the type for you. Example:
*)
-type OneTwoThree =
- CsvProvider<"1,2,3", HasHeaders = false, Schema = "Duration (float),foo,float option">
+type OneTwoThree = CsvProvider<"1,2,3", HasHeaders=false, Schema="Duration (float),foo,float option">
let csv = OneTwoThree.GetSample()
+
for row in csv.Rows do
- printfn "%f %d %f"
- (row.Duration/1.0)
- row.Foo
- (defaultArg row.Column3 1.0)
+ printfn "%f %d %f" (row.Duration / 1.0) row.Foo (defaultArg row.Column3 1.0)
(*** include-fsi-merged-output ***)
@@ -342,14 +351,12 @@ the other columns blank in the schema (you also don't need to add all the traili
*)
type Titanic1 =
- CsvProvider<"../data/Titanic.csv",
- Schema=",,Passenger Class,,,float",
- ResolutionFolder=ResolutionFolder>
+ CsvProvider<"../data/Titanic.csv", Schema=",,Passenger Class,,,float", ResolutionFolder=ResolutionFolder>
let titanic1 = Titanic1.GetSample()
+
for row in titanic1.Rows |> Seq.truncate 10 do
- printfn "%s Class = %d Fare = %g"
- row.Name row.``Passenger Class`` row.Fare
+ printfn "%s Class = %d Fare = %g" row.Name row.``Passenger Class`` row.Fare
(*** include-fsi-merged-output ***)
@@ -359,14 +366,12 @@ Alternatively, you can rename and override the type of any column by name instea
*)
type Titanic2 =
- CsvProvider<"../data/Titanic.csv",
- Schema="Fare=float,PClass->Passenger Class",
- ResolutionFolder=ResolutionFolder>
+ CsvProvider<"../data/Titanic.csv", Schema="Fare=float,PClass->Passenger Class", ResolutionFolder=ResolutionFolder>
let titanic2 = Titanic2.GetSample()
+
for row in titanic2.Rows |> Seq.truncate 10 do
- printfn "%s Class = %d Fare = %g"
- row.Name row.``Passenger Class`` row.Fare
+ printfn "%s Class = %d Fare = %g" row.Name row.``Passenger Class`` row.Fare
(*** include-fsi-merged-output ***)
@@ -385,11 +390,11 @@ the `Save` method. You can also use the `SaveToString()` to get the output direc
// Saving the first 10 rows that don't have missing values to a new csv file
airQuality
- .Filter(fun row ->
- not (Double.IsNaN row.Ozone) &&
- not (Double.IsNaN row.``Solar.R``))
- .Truncate(10)
- .SaveToString()
+ .Filter(fun row ->
+ not (Double.IsNaN row.Ozone)
+ && not (Double.IsNaN row.``Solar.R``))
+ .Truncate(10)
+ .SaveToString()
(*** include-fsi-merged-output ***)
@@ -400,10 +405,7 @@ It's also possible to transform the columns themselves by using `Map` and the co
*)
let doubleOzone =
- airQuality.Map(fun row ->
- AirQuality.Row
- ( row.Ozone * 2.0, row.``Solar.R``,
- row.Wind, row.Temp, row.Month, row.Day))
+ airQuality.Map(fun row -> AirQuality.Row(row.Ozone * 2.0, row.``Solar.R``, row.Wind, row.Temp, row.Month, row.Day))
(*** include-fsi-merged-output ***)
@@ -414,12 +416,12 @@ You can also append new rows, either by creating them directly as in the previou
*)
let newRows =
- AirQuality.ParseRows
- ("""41;190;7.4;67;5;1
- 36;118;8;72;5;2""")
+ AirQuality.ParseRows(
+ """41;190;7.4;67;5;1
+ 36;118;8;72;5;2"""
+ )
-let airQualityWithExtraRows =
- airQuality.Append newRows
+let airQualityWithExtraRows = airQuality.Append newRows
(*** include-fsi-merged-output ***)
@@ -429,13 +431,11 @@ It's even possible to create csv files without parsing at all:
*)
-type MyCsvType =
- CsvProvider
+type MyCsvType = CsvProvider
let myRows =
- [ MyCsvType.Row(1, "a", None)
- MyCsvType.Row(2, "B", Some System.DateTime.Now) ]
+ [ MyCsvType.Row(1, "a", None)
+ MyCsvType.Row(2, "B", Some System.DateTime.Now) ]
let myCsv = new MyCsvType(myRows)
myCsv.SaveToString()
diff --git a/docs/library/HtmlCssSelectors.fsx b/docs/library/HtmlCssSelectors.fsx
index 06c68177e..a93bb1450 100644
--- a/docs/library/HtmlCssSelectors.fsx
+++ b/docs/library/HtmlCssSelectors.fsx
@@ -6,18 +6,20 @@ index: 4
---
*)
(*** condition: prepare ***)
-#r "../../src/FSharp.Data/bin/Release/netstandard2.0/FSharp.Data.dll"
+#r "../../src/FSharp.Data/bin/Release/netstandard2.0/FSharp.Data.Http.dll"
+#r "../../src/FSharp.Data/bin/Release/netstandard2.0/FSharp.Data.Csv.Core.dll"
+#r "../../src/FSharp.Data/bin/Release/netstandard2.0/FSharp.Data.Html.Core.dll"
(*** condition: fsx ***)
#if FSX
#r "nuget: FSharp.Data,{{fsdocs-package-version}}"
-#endif // FSX
+#endif
(*** condition: ipynb ***)
#if IPYNB
#r "nuget: FSharp.Data,{{fsdocs-package-version}}"
Formatter.SetPreferredMimeTypesFor(typeof, "text/plain")
-Formatter.Register(fun (x:obj) (writer: TextWriter) -> fprintfn writer "%120A" x )
-#endif // IPYNB
+Formatter.Register(fun (x: obj) (writer: TextWriter) -> fprintfn writer "%120A" x)
+#endif
(**
[](https://mybinder.org/v2/gh/fsprojects/FSharp.Data/gh-pages?filepath={{fsdocs-source-basename}}.ipynb)
[]({{root}}/{{fsdocs-source-basename}}.fsx)
@@ -52,11 +54,15 @@ Then we can , for example, use the direct descendants selector to select another
id `ires`. The CSS selector to do so is `div#search > div#ires`:
*)
let links =
- doc.CssSelect("div#search > div#ires div.g > div.s div.kv cite")
- |> List.map (fun n ->
- match n.InnerText() with
- | t when (t.StartsWith("https://") || t.StartsWith("http://"))-> t
- | t -> "http://" + t )
+ doc.CssSelect("div#search > div#ires div.g > div.s div.kv cite")
+ |> List.map (fun n ->
+ match n.InnerText() with
+ | t when
+ (t.StartsWith("https://")
+ || t.StartsWith("http://"))
+ ->
+ t
+ | t -> "http://" + t)
(*** include-fsi-merged-output ***)
@@ -87,8 +93,8 @@ let doc2 = HtmlDocument.Load(fsys)
let books =
doc2.CssSelect("div.g h3.r a")
- |> List.map(fun a -> a.InnerText().Trim(), a.AttributeValue("href"))
- |> List.filter(fun (title, href) -> title.Contains("F#"))
+ |> List.map (fun a -> a.InnerText().Trim(), a.AttributeValue("href"))
+ |> List.filter (fun (title, href) -> title.Contains("F#"))
(*** include-fsi-merged-output ***)
@@ -103,7 +109,9 @@ You can also refer to the table below for a complete list of supported selectors
Finds all links with an english hreflang attribute.
*)
-let englishDoc = HtmlDocument.Parse("""
+let englishDoc =
+ HtmlDocument.Parse(
+ """
@@ -111,10 +119,10 @@ let englishDoc = HtmlDocument.Parse("""
Some other text
will not be outlined
- """)
+