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

Python Integration #86

Merged
merged 13 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]
},
"fable": {
"version": "4.1.3",
"version": "4.13.0",
"commands": [
"fable"
]
Expand Down
67 changes: 41 additions & 26 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,63 @@ on:
branches: [ main ]

jobs:
build-and-test-linux:
test:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3

# SETUP .NET
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.x.x
- name: Restore fable
run: dotnet tool restore

# SETUP NODE
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 16
- name: install node modules
run: npm install
- name: make script executable
run: chmod u+x build.sh
- name: Build and test dotnet
working-directory: ./
run: ./build.sh runtests

build-and-test-windows:

runs-on: windows-latest
run: npm install --ignore-scripts

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.x.x
- name: Restore fable
run: dotnet tool restore
- name: Setup Node.js environment
uses: actions/setup-node@v3
# SETUP PYTHON
- name: Setup Python
uses: actions/setup-python@v5
with:
node-version: 16
- name: install node modules
run: npm install
- name: Build and test dotnet
python-version: '3.11'
- name: Setup Virtual Environment
run: python -m venv .venv
- name: Setup Poetry Windows
if: matrix.os == 'windows-latest'
run: |
.\.venv\Scripts\python.exe -m pip install -U pip setuptools
.\.venv\Scripts\python.exe -m pip install poetry
.\.venv\Scripts\python.exe -m poetry install --no-root
- name: Setup Poetry Unix
if: matrix.os == 'ubuntu-latest'
run: |
./.venv/bin/python -m pip install -U pip setuptools
./.venv/bin/python -m pip install poetry
./.venv/bin/python -m poetry install --no-root

# BUILD
- name: make script executable
if: matrix.os == 'ubuntu-latest'
run: chmod u+x build.sh
- name: Test (Unix)
if: matrix.os == 'ubuntu-latest'
working-directory: ./
run: ./build.cmd runtests
run: ./build.sh runtests
- name: Test (Windows)
if: matrix.os == 'windows-latest'
run: .\build.cmd runtests
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,12 @@ tmp/
output/
.fsdocs/
/tests/FsSpreadsheet.JsNativeTests/fable/**/*.js
**/TestFiles/WRITE_*.xlsx
/tests/FsSpreadsheet.ExcelIO.Tests/TestFiles/WRITE_*.xlsx
/tests/JS/TestFiles/WRITE_*.xlsx
/tests/TestUtils/TestFiles/TestWorkbook_FsSpreadsheet_WRITE.*.xlsx
/js
**/py/**
/.venv
/tests/FsSpreadsheet.Tests/js
/tests/JS/fable
/tests/JS/FsSpreadsheet.Exceljs
Expand Down
31 changes: 31 additions & 0 deletions FsSpreadsheet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{276B
package.json = package.json
playground.fsx = playground.fsx
.github\workflows\publish-github-pages.yml = .github\workflows\publish-github-pages.yml
pyproject.toml = pyproject.toml
README.md = README.md
RELEASE_NOTES.md = RELEASE_NOTES.md
EndProjectSection
Expand Down Expand Up @@ -51,6 +52,10 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TestUtils", "tests\TestUtil
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Speedtest", "tests\Speedtest\Speedtest.fsproj", "{6DAD5C65-64CA-4ED4-B609-2D068F021024}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FsSpreadsheet.ExcelPy.Tests", "tests\FsSpreadsheet.ExcelPy.Tests\FsSpreadsheet.ExcelPy.Tests.fsproj", "{EB4669EF-77CF-4CB0-AAFA-BBB3C4FD4CE6}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FsSpreadsheet.ExcelPy", "src\FsSpreadsheet.ExcelPy\FsSpreadsheet.ExcelPy.fsproj", "{EE8A85D5-F453-4580-9FA4-59DA27ACB6D3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -205,6 +210,30 @@ Global
{6DAD5C65-64CA-4ED4-B609-2D068F021024}.Release|x64.Build.0 = Release|Any CPU
{6DAD5C65-64CA-4ED4-B609-2D068F021024}.Release|x86.ActiveCfg = Release|Any CPU
{6DAD5C65-64CA-4ED4-B609-2D068F021024}.Release|x86.Build.0 = Release|Any CPU
{EB4669EF-77CF-4CB0-AAFA-BBB3C4FD4CE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB4669EF-77CF-4CB0-AAFA-BBB3C4FD4CE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB4669EF-77CF-4CB0-AAFA-BBB3C4FD4CE6}.Debug|x64.ActiveCfg = Debug|Any CPU
{EB4669EF-77CF-4CB0-AAFA-BBB3C4FD4CE6}.Debug|x64.Build.0 = Debug|Any CPU
{EB4669EF-77CF-4CB0-AAFA-BBB3C4FD4CE6}.Debug|x86.ActiveCfg = Debug|Any CPU
{EB4669EF-77CF-4CB0-AAFA-BBB3C4FD4CE6}.Debug|x86.Build.0 = Debug|Any CPU
{EB4669EF-77CF-4CB0-AAFA-BBB3C4FD4CE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB4669EF-77CF-4CB0-AAFA-BBB3C4FD4CE6}.Release|Any CPU.Build.0 = Release|Any CPU
{EB4669EF-77CF-4CB0-AAFA-BBB3C4FD4CE6}.Release|x64.ActiveCfg = Release|Any CPU
{EB4669EF-77CF-4CB0-AAFA-BBB3C4FD4CE6}.Release|x64.Build.0 = Release|Any CPU
{EB4669EF-77CF-4CB0-AAFA-BBB3C4FD4CE6}.Release|x86.ActiveCfg = Release|Any CPU
{EB4669EF-77CF-4CB0-AAFA-BBB3C4FD4CE6}.Release|x86.Build.0 = Release|Any CPU
{EE8A85D5-F453-4580-9FA4-59DA27ACB6D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE8A85D5-F453-4580-9FA4-59DA27ACB6D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE8A85D5-F453-4580-9FA4-59DA27ACB6D3}.Debug|x64.ActiveCfg = Debug|Any CPU
{EE8A85D5-F453-4580-9FA4-59DA27ACB6D3}.Debug|x64.Build.0 = Debug|Any CPU
{EE8A85D5-F453-4580-9FA4-59DA27ACB6D3}.Debug|x86.ActiveCfg = Debug|Any CPU
{EE8A85D5-F453-4580-9FA4-59DA27ACB6D3}.Debug|x86.Build.0 = Debug|Any CPU
{EE8A85D5-F453-4580-9FA4-59DA27ACB6D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE8A85D5-F453-4580-9FA4-59DA27ACB6D3}.Release|Any CPU.Build.0 = Release|Any CPU
{EE8A85D5-F453-4580-9FA4-59DA27ACB6D3}.Release|x64.ActiveCfg = Release|Any CPU
{EE8A85D5-F453-4580-9FA4-59DA27ACB6D3}.Release|x64.Build.0 = Release|Any CPU
{EE8A85D5-F453-4580-9FA4-59DA27ACB6D3}.Release|x86.ActiveCfg = Release|Any CPU
{EE8A85D5-F453-4580-9FA4-59DA27ACB6D3}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -223,6 +252,8 @@ Global
{ADCF7D08-F2EE-4DFD-A96A-7E0134A1546F} = {F77AD108-C6B4-46BB-B7BC-13573F45F876}
{60678E53-EDC4-4ADE-A9EE-B194BDC76B37} = {F77AD108-C6B4-46BB-B7BC-13573F45F876}
{6DAD5C65-64CA-4ED4-B609-2D068F021024} = {F77AD108-C6B4-46BB-B7BC-13573F45F876}
{EB4669EF-77CF-4CB0-AAFA-BBB3C4FD4CE6} = {F77AD108-C6B4-46BB-B7BC-13573F45F876}
{EE8A85D5-F453-4580-9FA4-59DA27ACB6D3} = {1CF1274C-DE28-4446-9B4E-5884E797B87B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0EDE6697-0F13-4DB1-AC56-12C15A72D395}
Expand Down
45 changes: 34 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# FsSpreadsheet
# FsSpreadsheet
Spreadsheet creation and manipulation in FSharp

## DSL
Expand Down Expand Up @@ -65,28 +65,51 @@ tables
```


## Develop
## Development

### Build QuickStart
### Requirements

If not already done,
1. install .NET SDK
2. install Node.js
- [nodejs and npm](https://nodejs.org/en/download)
- verify with `node --version` (Tested with v18.16.1)
- verify with `npm --version` (Tested with v9.2.0)
- [.NET SDK](https://dotnet.microsoft.com/en-us/download)
- verify with `dotnet --version` (Tested with 7.0.306)
- [Python](https://www.python.org/downloads/)
- verify with `py --version` (Tested with 3.12.2)

### Local Setup

1. Setup dotnet tools

`dotnet tool restore`

2. Install NPM dependencies

`npm install`

3. Setup python environment

`py -m venv .venv`

4. Install [Poetry](https://python-poetry.org/) and dependencies

1. `.\.venv\Scripts\python.exe -m pip install -U pip setuptools`
2. `.\.venv\Scripts\python.exe -m pip install poetry`
3. `.\.venv\Scripts\python.exe -m poetry install --no-root`

Verify correct setup with `./build.cmd runtests`

In any shell, run
1. `dotnet tool restore`
4. `npm install`
5. `build.cmd <target>` where `<target>` may be
- if `<target>` is empty, it just runs dotnet build after cleaning everything
- `runtests` to run unit tests
- `runtestsjs` to only run JS unit tests
- `runtestsdotnet` to only run .NET unit tests
- `runtestpy` to only run Python unit tests
- `releasenotes semver:<version>` where `<version>` may be `major`, `minor`, or `patch` to update RELEASE_NOTES.md
- `pack` to create a NuGet release
- `packprelease` to create a NuGet prerelease
- `builddocs` to create docs
- `builddocsprerelease` to create prerelease docs
- `watchdocs` to create docs and run them locally
- `watchdocsprelease` to create prerelease docs and run them locally
- `publishnuget` to create a NuGet release and publish it
- `publishnugetprelease` to create a NuGet prerelease and publish it
- `release` to create a NuGet, NPM, PyPI and GitHub release
12 changes: 12 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
### 5.2.0+bbba6d4 (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
* [[#992fa5a](https://github.com/CSBiology/FsSpreadsheet/commit/992fa5ac485313efc71285347b156b83614585d0)] add python xlsx io support
* [[#ddcc16d](https://github.com/CSBiology/FsSpreadsheet/commit/ddcc16dbdc51da516f53cbc3192d114584bd73fb)] add runtestspy target
* [[#d69288a](https://github.com/CSBiology/FsSpreadsheet/commit/d69288a33f1a259987cf4c229671723eaaf5beb2)] switch to pyxpecto for testing
* [[#2b88258](https://github.com/CSBiology/FsSpreadsheet/commit/2b882586b12aae0500eaad98d01603521dfee26f)] small speed improvement of reader by skipping sst include on opendocument cell
* Bugfixes:
* [[#b35f309](https://github.com/CSBiology/FsSpreadsheet/commit/b35f30908a4a68d8e3870c30cb8ace2dde748a7b)] finalize python xlsx io test and fixes
* [[#a55336e](https://github.com/CSBiology/FsSpreadsheet/commit/a55336ec03d5d2f1a254d2908d06d9b5381c7d55)] fix python xlsx io for default formats

### 5.1.3+a260549 (Released 2024-2-13)
* Additions:
* [[#a260549](https://github.com/CSBiology/FsSpreadsheet/commit/a26054928881975896f2c07926261091979216a4)] update tests to change in empty workbook handling
Expand Down
4 changes: 4 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
@echo off

set PYTHONIOENCODING=utf-8
dotnet tool restore
cls
dotnet run --project ./build/build.fsproj %*
10 changes: 9 additions & 1 deletion build/BasicTasks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ module Helper =

createProcess npmPath

let python =
if System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows) then
Fake.Core.Trace.log "Detected Windows System."
createProcess (__SOURCE_DIRECTORY__.Replace(@"\build",@"\.venv\Scripts\python.exe"))
else
Fake.Core.Trace.log "Detected Unix System."
createProcess (__SOURCE_DIRECTORY__.Replace(@"/build",@"/.venv/bin/python"))

let run proc arg dir =
proc arg dir
|> Proc.run
Expand All @@ -117,7 +125,7 @@ let clean = BuildTask.create "Clean" [] {
++ "src/**/obj"
++ "tests/**/bin"
++ "tests/**/obj"
++ "pkg"
++ "dist"
|> Shell.cleanDirs
}

Expand Down
2 changes: 1 addition & 1 deletion build/Build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ open ReleaseTasks
let _release =
BuildTask.createEmpty
"Release"
[clean; build; runTests; pack; buildDocs; createTag; publishNuget; publishNPM; releaseDocs]
[clean; build; runTests; pack; buildDocs; createTag; publishNuget; publishNPM; publishPyPi; releaseDocs]

/// Full release of nuget package, git tag, and documentation for the prerelease version.
let _preRelease =
Expand Down
Loading
Loading