Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed inconsistent namespace names according to project name unification #87

Merged
merged 4 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions FsSpreadsheet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FsSpreadsheet.Py.Tests", "t
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FsSpreadsheet.Net.Tests", "tests\FsSpreadsheet.Net.Tests\FsSpreadsheet.Net.Tests.fsproj", "{935BE8E7-FA7F-4C8F-A1D7-7CAFDC29F288}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{8E1BD3FA-2F7C-4968-AE6D-E6665CBE1675}"
ProjectSection(SolutionItems) = preProject
docs\index.md = docs\index.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ let spreadsheet = dslTree.Value.Parse()

```fsharp

#r "nuget: FsSpreadsheet.ExcelIO"
#r "nuget: FsSpreadsheet.Net"

open FsSpreadsheet.ExcelIO
open FsSpreadsheet.Net

spreadsheet.ToFile(excelFilePath)

Expand Down
19 changes: 18 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
### 5.2.0+bbba6d4 (Released 2024-2-23)
### 6.0.1+360ee6f (Released 2024-3-7)
* Additions:
* Hotfix because of erroneous namespace names
* [[#c6aa628](https://github.com/CSBiology/FsSpreadsheet/commit/c6aa6281c0adbc7436227f99db69b19aa25d8707)] bump to 6.0.0
* [[#c7b4972](https://github.com/CSBiology/FsSpreadsheet/commit/c7b4972ce5921c259d18bbc7a4ee8adc7139cdca)] updated namespace names according to project name unification
* [[#360ee6f](https://github.com/CSBiology/FsSpreadsheet/commit/360ee6f12867663c4984d8d730389a830d99bc2e)] add minimal documentation

### 6.0.0+b85ca85 (Released 2024-3-7)
* Additions:
* Added release for python
* Renamed xlsx io packages
* [[#9572480](https://github.com/CSBiology/FsSpreadsheet/commit/9572480de9ae43591714e0cff6ee92a00b0541b0)] rename excelpy folder
* [[#491ed1e](https://github.com/CSBiology/FsSpreadsheet/commit/491ed1ee1bc3cafdfc4538e98dd965aaf8a3dad0)] update CI and add Python build targets
* [[#9525665](https://github.com/CSBiology/FsSpreadsheet/commit/95256651d8930ffd7645edeacf2cd731a64ab276)] update readme with developer info
* [[#181fc70](https://github.com/CSBiology/FsSpreadsheet/commit/181fc703db651864d84295648a1db9fa3bae1e19)] unify test project names
* [[#b85ca85](https://github.com/CSBiology/FsSpreadsheet/commit/b85ca85ca290076d21ae6af01ab3aab0cd52205a)] small changes to reduce warnings

### 5.2.0+c6f526ad (Released 2024-2-23)
* Additions:
* [[#bbba6d4](https://github.com/CSBiology/FsSpreadsheet/commit/bbba6d4ab819900f5188af3b5663d4744061991a)] start setup of python package
* [[#80dd1b6](https://github.com/CSBiology/FsSpreadsheet/commit/80dd1b608e46e7cda7646ea7c39619c0c7738f8e)] add tests for python xlsx io
Expand Down
16 changes: 13 additions & 3 deletions build/ReleaseNotesTasks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

open Fake.Extensions.Release
open BlackFox.Fake
open Fake.Core

/// This might not be necessary, mostly useful for apps which want to display current version as it creates an accessible F# version script from RELEASE_NOTES.md
let createAssemblyVersion = BuildTask.create "createvfs" [] {
Expand All @@ -15,13 +16,22 @@ let updateReleaseNotes = BuildTask.createFn "ReleaseNotes" [] (fun config ->

let semVer =
Fake.Core.ReleaseNotes.load "RELEASE_NOTES.md"
|> fun x -> sprintf "%i.%i.%i" x.SemVer.Major x.SemVer.Minor x.SemVer.Patch
|> fun x -> $"{x.SemVer.Major}.{x.SemVer.Minor}.{x.SemVer.Patch}"

// Update Version in src/Nfdi4Plants.Fornax.Template/package.json
Trace.trace "Start updating package.json version"
let p = "package.json"
let t = System.IO.File.ReadAllText p
let tNew = System.Text.RegularExpressions.Regex.Replace(t, """\"version\": \".*\",""", sprintf "\"version\": \"%s\"," semVer )
let tNew = System.Text.RegularExpressions.Regex.Replace(t, """\"version\": \".*\",""", sprintf "\"version\": \"%s\"," semVer)
System.IO.File.WriteAllText(p, tNew)
Trace.trace "Finish updating package.json version"

Trace.trace "Start updating pyproject.toml version"
let p = "pyproject.toml"
let t = System.IO.File.ReadAllText p
let tNew = System.Text.RegularExpressions.Regex.Replace(t, "version = \".*\"", sprintf "version = \"%s\"" semVer)
System.IO.File.WriteAllText(p, tNew)
Trace.trace "Finish updating pyproject.toml version"

)


Expand Down
76 changes: 75 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,77 @@
# FsSpreadsheet Documentation

(soon tm)
FsSpreadsheet is a library for reading and writing spreadsheets in F#, Javascript and Python using Fable. It is a wrapper of the Python library openpyxl (https://openpyxl.readthedocs.io/en/stable/) and the Javascript library exceljs (https://www.npmjs.com/package/@nfdi4plants/exceljs).

## Installation

### F#

Project
```shell
dotnet add package FsSpreadsheet.Net
```

Script
```fsharp
#r "nuget: FsSpreadsheet.Net"

open FsSpreadsheet
open FsSpreadsheet.Net
```

### Javascript

```shell
npm install @fslab/fsspreadsheet
```

### Python

```shell
pip install fsspreadsheet
```

## Usage_IO

### F#

```fsharp
open FsSpreadsheet
open FsSpreadsheet.Net

let path = "path/to/spreadsheet.xlsx"

let wb = FsWorkbook.fromXlsxFile(path)

let newPath = "path/to/new/spreadsheet.xlsx"

wb.ToXlsxFile(newPath)
```

### Javascript

```javascript
import { Xlsx } from '@fslab/fsspreadsheet/Xlsx.js';

const path = "path/to/spreadsheet.xlsx"

const wb = Xlsx.fromXlsxFile(path)

const newPath = "path/to/new/spreadsheet.xlsx"

Xlsx.toFile(newPath,wb)
```

### Python

```python
from fsspreadsheet.xlsx import Xlsx

path = "path/to/spreadsheet.xlsx"

wb = Xlsx.fromXlsxFile(path)

newPath = "path/to/new/spreadsheet.xlsx"

Xlsx.to_file(newPath,wb)
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fslab/fsspreadsheet",
"version": "5.2.0",
"version": "6.0.1",
"description": "Minimal spreadsheet creation and manipulation using exceljs io.",
"type": "module",
"main": "Xlsx.js",
Expand Down
10 changes: 5 additions & 5 deletions playground.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ open System.IO
Directory.GetCurrentDirectory()
//File.Copy("src/FsSpreadsheet/bin/Debug/netstandard2.0/FsSpreadsheet.dll", "src/FsSpreadsheet/bin/Debug/netstandard2.0/FsSpreadsheet_Copy.dll", true)
//File.Copy("src/FsSpreadsheet.CsvIO/bin/Debug/netstandard2.0/FsSpreadsheet.CsvIO.dll", "src/FsSpreadsheet.CsvIO/bin/Debug/netstandard2.0/FsSpreadsheet.CsvIO_Copy.dll", true)
//File.Copy("src/FsSpreadsheet.ExcelIO/bin/Debug/netstandard2.0/FsSpreadsheet.ExcelIO.dll", "src/FsSpreadsheet.ExcelIO/bin/Debug/netstandard2.0/FsSpreadsheet.ExcelIO_Copy.dll", true)
//File.Copy("src/FsSpreadsheet.Net/bin/Debug/netstandard2.0/FsSpreadsheet.Net.dll", "src/FsSpreadsheet.Net/bin/Debug/netstandard2.0/FsSpreadsheet.Net_Copy.dll", true)

#I "src/FsSpreadsheet/bin/Debug/netstandard2.0/"
#r "FsSpreadsheet.dll"
#I "src/FsSpreadsheet.ExcelIO/bin/Debug/netstandard2.0/"
#r "FsSpreadsheet.ExcelIO.dll"
#I "src/FsSpreadsheet.Net/bin/Debug/netstandard2.0/"
#r "FsSpreadsheet.Net.dll"

#r "nuget: DocumentFormat.OpenXml"
#r "nuget: Fable.Core, 4.0.0"


open FsSpreadsheet
open FsSpreadsheet.ExcelIO
open FsSpreadsheet.Net
open FsSpreadsheet.DSL

open DocumentFormat.OpenXml
Expand Down Expand Up @@ -243,7 +243,7 @@ ws.CellCollection.RemoveCellAt(1, 1)

//// inb4 unit tests

//let unitTestFilePath = @"C:\Repos\CSBiology\FsSpreadsheet\tests\FsSpreadsheet.ExcelIO.Tests\data\testUnit.xlsx"
//let unitTestFilePath = @"C:\Repos\CSBiology\FsSpreadsheet\tests\FsSpreadsheet.Net.Tests\data\testUnit.xlsx"
//let sr = new StreamReader(unitTestFilePath)
//let fsWorkbookFromStream = FsWorkbook.fromXlsxStream sr.BaseStream
//sr.Close()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "fsspreadsheet"
version = "5.2.0"
version = "6.0.1"
description = "Fable library for Spreadsheet creation and manipulation"
authors = ["Heinrich Lukas Weil <hlweil@outlook.de>", "Kevin Frey <freymaurer@gmx.de>"]
maintainers = ["Oliver Maus"]
Expand Down
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Net/Cell.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelIO
namespace FsSpreadsheet.Net

open DocumentFormat.OpenXml
open DocumentFormat.OpenXml.Spreadsheet
Expand Down
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Net/CellData.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelIO
namespace FsSpreadsheet.Net

open DocumentFormat.OpenXml.Spreadsheet

Expand Down
10 changes: 5 additions & 5 deletions src/FsSpreadsheet.Net/FsExtensions.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelIO
namespace FsSpreadsheet.Net

open DocumentFormat.OpenXml
open DocumentFormat.OpenXml.Spreadsheet
Expand Down Expand Up @@ -368,15 +368,15 @@ module FsExtensions =
/// <summary>
/// Writes the FsWorkbook into a binary file at the given path.
/// </summary>
member self.ToFile(path) =
member self.ToXlsxFile(path) =
self.ToBytes()
|> fun bytes -> File.WriteAllBytes (path, bytes)

/// <summary>
/// Writes an FsWorkbook into a binary file at the given path.
/// </summary>
static member toFile path (workbook : FsWorkbook) =
workbook.ToFile(path)
static member toXlsxFile path (workbook : FsWorkbook) =
workbook.ToXlsxFile(path)


type Writer =
Expand All @@ -399,4 +399,4 @@ type Writer =
/// Writes an FsWorkbook into a binary file at the given path.
/// </summary>
static member toFile(path,workbook: FsWorkbook) =
workbook.ToFile(path)
workbook.ToXlsxFile(path)
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Net/Package.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelIO
namespace FsSpreadsheet.Net

open DocumentFormat.OpenXml
open System.IO
Expand Down
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Net/Row.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelIO
namespace FsSpreadsheet.Net

open DocumentFormat.OpenXml.Spreadsheet
open DocumentFormat.OpenXml
Expand Down
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Net/SharedStringTable.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelIO
namespace FsSpreadsheet.Net

open DocumentFormat.OpenXml.Spreadsheet
open DocumentFormat.OpenXml.Packaging
Expand Down
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Net/Sheet.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelIO
namespace FsSpreadsheet.Net

open DocumentFormat.OpenXml
open DocumentFormat.OpenXml.Spreadsheet
Expand Down
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Net/SheetData.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelIO
namespace FsSpreadsheet.Net

open DocumentFormat.OpenXml.Spreadsheet

Expand Down
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Net/Spreadsheet.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelIO
namespace FsSpreadsheet.Net

open DocumentFormat.OpenXml
open DocumentFormat.OpenXml.Packaging
Expand Down
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Net/Stylesheet.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelIO
namespace FsSpreadsheet.Net

open DocumentFormat.OpenXml.Spreadsheet
open DocumentFormat.OpenXml.Packaging
Expand Down
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Net/Table.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelIO
namespace FsSpreadsheet.Net

open DocumentFormat.OpenXml.Spreadsheet
open DocumentFormat.OpenXml.Packaging
Expand Down
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Net/Workbook.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelIO
namespace FsSpreadsheet.Net


open DocumentFormat.OpenXml.Spreadsheet
Expand Down
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Net/Worksheet.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelIO
namespace FsSpreadsheet.Net

open DocumentFormat.OpenXml.Spreadsheet
open DocumentFormat.OpenXml.Packaging
Expand Down
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Net/ZipArchiveReader.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module FsSpreadsheet.ExcelIO.ZipArchiveReader
module FsSpreadsheet.Net.ZipArchiveReader

open System.IO.Compression
open System.Xml
Expand Down
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Py/Cell.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelPy
namespace FsSpreadsheet.Py

module PyCell =

Expand Down
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Py/CellType.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelPy
namespace FsSpreadsheet.Py

module PyCellType =

Expand Down
4 changes: 2 additions & 2 deletions src/FsSpreadsheet.Py/FsExtension.fs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[<AutoOpenAttribute>]
module FsSpreadsheet.ExcelPy.FsSpreadsheet
module FsSpreadsheet.Py.FsSpreadsheet

open FsSpreadsheet
open FsSpreadsheet.ExcelPy
open FsSpreadsheet.Py
open Fable.Core

// This is mainly used for fsharp based access in a fable environment.
Expand Down
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Py/Table.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelPy
namespace FsSpreadsheet.Py

module PyTable =

Expand Down
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Py/Workbook.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelPy
namespace FsSpreadsheet.Py

module PyWorkbook =

Expand Down
2 changes: 1 addition & 1 deletion src/FsSpreadsheet.Py/Worksheet.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FsSpreadsheet.ExcelPy
namespace FsSpreadsheet.Py

module PyWorksheet =

Expand Down
4 changes: 2 additions & 2 deletions src/FsSpreadsheet.Py/Xlsx.fs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace FsSpreadsheet.ExcelPy
namespace FsSpreadsheet.Py


open FsSpreadsheet
open FsSpreadsheet.ExcelPy
open FsSpreadsheet.Py
open Fable.Core
open Fable.Openpyxl

Expand Down
4 changes: 2 additions & 2 deletions tests/FsSpreadsheet.Net.Tests/DefaultIO.Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
open Expecto
open TestingUtils
open FsSpreadsheet
open FsSpreadsheet.ExcelIO
open FsSpreadsheet.Net

let tests_Read = testList "Read" [
let readFromTestFile (testFile: DefaultTestObject.TestFiles) =
Expand Down Expand Up @@ -39,7 +39,7 @@ let private tests_Write = testList "Write" [
testCase "default" <| fun _ ->
let wb = DefaultTestObject.defaultTestObject()
let p = DefaultTestObject.WriteTestFiles.FsSpreadsheetNET.asRelativePath
wb.ToFile(p)
wb.ToXlsxFile(p)
let wb_read = FsWorkbook.fromXlsxFile p
Expect.isDefaultTestObject wb_read

Expand Down