diff --git a/.bonsai/NuGet.config b/.bonsai/NuGet.config index 97e8b73..aa5beec 100644 --- a/.bonsai/NuGet.config +++ b/.bonsai/NuGet.config @@ -1,8 +1,5 @@ - - - diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 278b6c7..d32441d 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,10 +3,11 @@ "isRoot": true, "tools": { "docfx": { - "version": "2.75.3", + "version": "2.78.3", "commands": [ "docfx" - ] + ], + "rollForward": false } } } \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c9a9d0d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,46 @@ +root = true + +[*] +indent_style = space + +#-------------------------------------------------------------------------------------------------- +# XML, JSON, and web files +#-------------------------------------------------------------------------------------------------- +[*.{xml,csproj,vcxproj,vcxproj.filters,shproj,props,targets,config,nuspec,resx,vsixmanifest,wxs,vstemplate,slnx}] +indent_size = 2 + +[*.json] +indent_size = 2 + +[*.{html,css}] +indent_size = 2 + +#-------------------------------------------------------------------------------------------------- +# C++ +#-------------------------------------------------------------------------------------------------- +[*.{c,cpp,h,hpp,ixx}] +indent_size = 4 +charset = utf-8-bom +trim_trailing_whitespace = true +insert_final_newline = true + +#-------------------------------------------------------------------------------------------------- +# C# +#-------------------------------------------------------------------------------------------------- +[*.{cs,csx}] +indent_size = 4 +charset = utf-8-bom +trim_trailing_whitespace = true +insert_final_newline = true + +# Language keyword vs full type name +# Predefined for members, etc does not create a message because the explicitly sized types are conveient in interop scenarios where the bit size matters. +dotnet_style_predefined_type_for_locals_parameters_members = true:none +dotnet_style_predefined_type_for_member_access = true:suggestion + +# Instantiate argument exceptions correctly +dotnet_diagnostic.CA2208.severity = warning + +# Don't complain about not using modern collection syntax +dotnet_style_prefer_collection_expression = never +csharp_style_prefer_range_operator = false diff --git a/.gitattributes b/.gitattributes index eb356c9..601a4e2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,6 +8,7 @@ # Config *.gitignore text *.gitattributes text +*.gitmodules text eol=lf *.editorconfig text *.git-blame-ignore-revs text *.sln text @@ -39,4 +40,4 @@ LICENSE text *.png binary *.ico binary *.gif binary -*.svg text \ No newline at end of file +*.svg text diff --git a/.github/workflows/Bonsai.Scripting.Python.yml b/.github/workflows/Bonsai.Scripting.Python.yml new file mode 100644 index 0000000..4c5e78d --- /dev/null +++ b/.github/workflows/Bonsai.Scripting.Python.yml @@ -0,0 +1,344 @@ +# ======================================================================================================================================================================= +# Bonsai.Scripting.Python CI/CD +# ======================================================================================================================================================================= +# Index: +# * Build, test, and package .NET +# * Build documentation +# * Render workflow images +# * Publish packages to GitHub +# * Publish packages to NuGet.org +# * Publish documentation +# ======================================================================================================================================================================= +# Note that this is a generic workflow meant for all Bonsai packages. Minor local modifications are fine, see https://github.com/bonsai-rx/prefect for more information. +# ======================================================================================================================================================================= +name: Bonsai.Scripting.Python +on: + push: + # This prevents tag pushes from triggering this workflow + branches: ['*'] + pull_request: + release: + types: [published] + workflow_dispatch: +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + DOTNET_GENERATE_ASPNET_CERTIFICATE: false + ContinuousIntegrationBuild: true +jobs: + # ===================================================================================================================================================================== + # Build, test, and package .NET + # ___ _ _ _ _ _ _ _ _ _ ___ _____ + # | _ )_ _(_) |__| | | |_ ___ __| |_ __ _ _ _ __| | _ __ __ _ __| |____ _ __ _ ___ | \| | __|_ _| + # | _ \ || | | / _` |_ | _/ -_|_-< _|_ / _` | ' \/ _` | | '_ \/ _` / _| / / _` / _` / -_) _| .` | _| | | + # |___/\_,_|_|_\__,_( ) \__\___/__/\__( ) \__,_|_||_\__,_| | .__/\__,_\__|_\_\__,_\__, \___| (_)_|\_|___| |_| + # |/ |/ |_| |___/ + # ===================================================================================================================================================================== + build: + strategy: + fail-fast: false + matrix: + platform: + - name: Windows x64 + os: windows-latest + rid: win-x64 + - name: Linux x64 + os: ubuntu-22.04 + rid: linux-x64 + configuration: ['debug', 'release'] + include: + - platform: + rid: win-x64 + configuration: release + collect-packages: true + name: ${{matrix.platform.name}} ${{matrix.configuration}} + runs-on: ${{matrix.platform.os}} + outputs: + need-workflow-image-render: ${{steps.configure-build.outputs.need-workflow-image-render}} + steps: + # ----------------------------------------------------------------------- Checkout + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + # ----------------------------------------------------------------------- Set up tools + - name: Set up .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + + # ----------------------------------------------------------------------- Configure build + - name: Configure build + id: configure-build + uses: bonsai-rx/configure-build@v1 + + # ----------------------------------------------------------------------- Build + - name: Restore + run: dotnet restore + + - name: Build + run: dotnet build --no-restore --configuration ${{matrix.configuration}} + + # ----------------------------------------------------------------------- Pack + - name: Pack + id: pack + run: dotnet pack --no-restore --no-build --configuration ${{matrix.configuration}} + + # ----------------------------------------------------------------------- Test + - name: Test .NET Framework 4.7.2 + run: dotnet test --no-restore --no-build --configuration ${{matrix.configuration}} --verbosity normal --framework net472 + - name: Test .NET 8 + run: dotnet test --no-restore --no-build --configuration ${{matrix.configuration}} --verbosity normal --framework net8.0 + - name: Test .NET 8 Windows + if: matrix.platform.rid == 'win-x64' + run: dotnet test --no-restore --no-build --configuration ${{matrix.configuration}} --verbosity normal --framework net8.0-windows + + # ----------------------------------------------------------------------- Collect artifacts + - name: Collect NuGet packages + uses: actions/upload-artifact@v4 + if: matrix.collect-packages && steps.pack.outcome == 'success' && always() + with: + name: Packages + if-no-files-found: error + path: artifacts/package/${{matrix.configuration}}/** + + # ===================================================================================================================================================================== + # Build documentation + # ___ _ _ _ _ _ _ _ + # | _ )_ _(_) |__| | __| |___ __ _ _ _ __ ___ _ _| |_ __ _| |_(_)___ _ _ + # | _ \ || | | / _` | / _` / _ \/ _| || | ' \/ -_) ' \ _/ _` | _| / _ \ ' \ + # |___/\_,_|_|_\__,_| \__,_\___/\__|\_,_|_|_|_\___|_||_\__\__,_|\__|_\___/_||_| + # ===================================================================================================================================================================== + build-documentation: + name: Build documentation + runs-on: ubuntu-latest + steps: + # ----------------------------------------------------------------------- Checkout + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + # ----------------------------------------------------------------------- Set up tools + - name: Set up .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + + - name: Set up .NET tools + run: dotnet tool restore + + # ----------------------------------------------------------------------- Restore + - name: Restore + run: dotnet restore + + # ----------------------------------------------------------------------- Build metadata + - name: Build metadata + id: build-metadata + run: dotnet docfx metadata docs/docfx.json --noRestore + + # ----------------------------------------------------------------------- Build documentation + - name: Build documentation + id: build-documentation + run: dotnet docfx build docs/docfx.json + + # ----------------------------------------------------------------------- Collect artifacts + - name: Collect documentation metadata + uses: actions/upload-artifact@v4 + if: steps.build-metadata.outcome == 'success' && always() + with: + name: DocumentationMetadata + if-no-files-found: error + path: artifacts/docs/api/ + + - name: Collect documentation artifact + uses: actions/upload-artifact@v4 + if: steps.build-documentation.outcome == 'success' && always() + with: + name: DocumentationWebsite + if-no-files-found: error + path: artifacts/docs/site/ + + # ===================================================================================================================================================================== + # Render workflow images + # ___ _ _ __ _ _ + # | _ \___ _ _ __| |___ _ _ __ __ _____ _ _| |__/ _| |_____ __ __ (_)_ __ __ _ __ _ ___ ___ + # | / -_) ' \/ _` / -_) '_| \ V V / _ \ '_| / / _| / _ \ V V / | | ' \/ _` / _` / -_|_-< + # |_|_\___|_||_\__,_\___|_| \_/\_/\___/_| |_\_\_| |_\___/\_/\_/ |_|_|_|_\__,_\__, \___/__/ + # |___/ + # ===================================================================================================================================================================== + workflow-images: + name: Render workflow images + runs-on: windows-latest + needs: build + if: needs.build.outputs.need-workflow-image-render == 'true' + steps: + # ----------------------------------------------------------------------- Checkout + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + # ----------------------------------------------------------------------- Download built packages + - name: Download packages for rendering + uses: actions/download-artifact@v4 + with: + name: Packages + path: artifacts/packages/ + + # ----------------------------------------------------------------------- Set up Bonsai environments + - name: Set up Bonsai environments + uses: bonsai-rx/setup-bonsai@v1 + with: + environment-paths: '**/.bonsai/' + inject-packages: artifacts/packages/*.nupkg + + # ----------------------------------------------------------------------- Render + - name: Render images + id: render + run: pwsh ./docs/export-images.ps1 -OutputFolder artifacts/docs/site/ -Verbose + + # ----------------------------------------------------------------------- Collect artifacts + - name: Collect images + uses: actions/upload-artifact@v4 + if: steps.render.outcome == 'success' && always() + with: + name: DocumentationWorkflowImages + if-no-files-found: error + path: artifacts/docs/site/ + + # ===================================================================================================================================================================== + # Publish packages to GitHub + # ___ _ _ _ _ _ _ ___ _ _ _ _ _ + # | _ \_ _| |__| (_)__| |_ _ __ __ _ __| |____ _ __ _ ___ ___ | |_ ___ / __(_) |_| || |_ _| |__ + # | _/ || | '_ \ | (_-< ' \ | '_ \/ _` / _| / / _` / _` / -_|_-< | _/ _ \ | (_ | | _| __ | || | '_ \ + # |_| \_,_|_.__/_|_/__/_||_| | .__/\__,_\__|_\_\__,_\__, \___/__/ \__\___/ \___|_|\__|_||_|\_,_|_.__/ + # |_| |___/ + # ===================================================================================================================================================================== + publish-github: + name: Publish packages to GitHub + runs-on: ubuntu-latest + needs: build + permissions: + # Needed to attach files to releases + contents: write + # Needed to upload to GitHub Packages + packages: write + if: github.event_name == 'push' || github.event_name == 'release' + steps: + # ----------------------------------------------------------------------- Set up .NET + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + + # ----------------------------------------------------------------------- Download built packages + - name: Download built packages + uses: actions/download-artifact@v4 + with: + name: Packages + path: artifacts/packages/ + + # ----------------------------------------------------------------------- Upload release assets + - name: Upload release assets + if: github.event_name == 'release' + run: gh release upload --repo ${{github.repository}} ${{github.event.release.tag_name}} artifacts/packages/* --clobber + env: + GH_TOKEN: ${{github.token}} + + # ----------------------------------------------------------------------- Push to GitHub Packages + - name: Push to GitHub Packages + run: dotnet nuget push "artifacts/packages/*.nupkg" --skip-duplicate --no-symbols --api-key ${{secrets.GITHUB_TOKEN}} --source https://nuget.pkg.github.com/${{github.repository_owner}} + env: + # This is a workaround for https://github.com/NuGet/Home/issues/9775 + DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER: 0 + + # ===================================================================================================================================================================== + # Publish packages to NuGet.org + # ___ _ _ _ _ _ _ _ _ ___ _ + # | _ \_ _| |__| (_)__| |_ _ __ __ _ __| |____ _ __ _ ___ ___ | |_ ___ | \| |_ _ / __|___| |_ ___ _ _ __ _ + # | _/ || | '_ \ | (_-< ' \ | '_ \/ _` / _| / / _` / _` / -_|_-< | _/ _ \ | .` | || | (_ / -_) _|_/ _ \ '_/ _` | + # |_| \_,_|_.__/_|_/__/_||_| | .__/\__,_\__|_\_\__,_\__, \___/__/ \__\___/ |_|\_|\_,_|\___\___|\__(_)___/_| \__, | + # |_| |___/ |___/ + # ===================================================================================================================================================================== + publish-packages-nuget-org: + name: Publish packages to NuGet.org + runs-on: ubuntu-latest + environment: public-release + needs: build + if: github.event_name == 'release' + steps: + # ----------------------------------------------------------------------- Set up .NET + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + + # ----------------------------------------------------------------------- Download built packages + - name: Download built packages + uses: actions/download-artifact@v4 + with: + name: Packages + path: artifacts/packages/ + + # ----------------------------------------------------------------------- Push to NuGet.org + - name: Push to NuGet.org + run: dotnet nuget push "artifacts/packages/*.nupkg" --api-key ${{secrets.NUGET_API_KEY}} --source ${{vars.NUGET_API_URL}} + env: + # This is a workaround for https://github.com/NuGet/Home/issues/9775 + DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER: 0 + + + # ===================================================================================================================================================================== + # Publish documentation + # ___ _ _ _ _ _ _ _ _ + # | _ \_ _| |__| (_)__| |_ __| |___ __ _ _ _ __ ___ _ _| |_ __ _| |_(_)___ _ _ + # | _/ || | '_ \ | (_-< ' \ / _` / _ \/ _| || | ' \/ -_) ' \ _/ _` | _| / _ \ ' \ + # |_| \_,_|_.__/_|_/__/_||_| \__,_\___/\__|\_,_|_|_|_\___|_||_\__\__,_|\__|_\___/_||_| + # ===================================================================================================================================================================== + publish-documentation: + name: Publish documentation + runs-on: ubuntu-latest + # Publishing is not strictly necessary here, but if we're going to do a public release we want to wait to publish the docs until it goes out + needs: [build-documentation, workflow-images, publish-packages-nuget-org] + permissions: + # Both required by actions/deploy-pages + pages: write + id-token: write + environment: + # Intentionally not using the "default" github-pages environment as it's not compatible with this workflow + name: documentation-website + url: ${{steps.publish.outputs.page_url}} + # Only run if the workflow isn't dying and build-documentation was successful and either A) we're releasing or B) we have continuous deployment enabled + if: | + !cancelled() && !failure() && needs.build-documentation.result == 'success' + && (github.event_name == 'release' + || (vars.CONTINUOUS_DOCUMENTATION && github.event_name != 'pull_request') + ) + steps: + # ----------------------------------------------------------------------- Download documentation website components + # It is intentional that we use two independent download steps here as it ensures that workflow images are permitted + # to overwrite any conflicts in the docfx output but not the other way around. + - name: Download documentation website + uses: actions/download-artifact@v4 + with: + name: DocumentationWebsite + + - name: Download workflow images + if: ${{needs.workflow-images.result == 'success'}} + uses: actions/download-artifact@v4 + with: + name: DocumentationWorkflowImages + + # ----------------------------------------------------------------------- Collect artifacts + - name: Upload final documentation website artifact + uses: actions/upload-pages-artifact@v3 + with: + path: '.' + + # ----------------------------------------------------------------------- Publish to GitHub Pages (for forks) + - name: Publish to GitHub Pages (forks) + id: publish + if: github.event_name == 'release' || github.event.repository.fork + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 9e0c786..0000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,51 +0,0 @@ -# Builds and publishes the documentation website to gh-pages branch -name: Build docs - -on: - workflow_dispatch: - -jobs: - build: - runs-on: windows-latest - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 - with: - submodules: true - - - name: Setup MSBuild - uses: microsoft/setup-msbuild@v2 - - - name: Restore NuGet Packages - run: msbuild -t:restore src/Bonsai.Scripting.Python.sln - - - name: Build Solution - run: msbuild src/Bonsai.Scripting.Python.sln /p:Configuration=Release - - - name: Setup .NET Core SDK - uses: actions/setup-dotnet@v4.0.0 - with: - dotnet-version: 7.x - - - name: Setup DocFX - run: dotnet tool restore - - - name: Setup Bonsai - working-directory: .bonsai - run: .\Setup.ps1 - - - name: Build Documentation - working-directory: docs - run: .\build.ps1 - - - name: Checkout gh-pages - uses: actions/checkout@v4.1.1 - with: - ref: gh-pages - path: gh-pages - - name: Publish to github pages - uses: peaceiris/actions-gh-pages@v3.9.3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: docs/_site - force_orphan: true \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6b16b78..81aec86 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,8 @@ -.vs +.bonsai/Bonsai.exe* +.bonsai/Packages/ +.bonsai/Settings/ +.vs/ +/artifacts/ .venv -bin -obj -Packages -*.exe -*.exe.* *.user *.suo diff --git a/.gitmodules b/.gitmodules index c8ffa76..acf6d39 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "docs/bonsai"] - path = docs/bonsai - url = https://github.com/bonsai-rx/docfx-tools +[submodule "docs/bonsai-docfx"] + path = docs/bonsai-docfx + url = https://github.com/bonsai-rx/docfx-tools.git diff --git a/src/Bonsai.Scripting.Python.sln b/Bonsai.Scripting.Python.sln similarity index 63% rename from src/Bonsai.Scripting.Python.sln rename to Bonsai.Scripting.Python.sln index b8f13eb..6d2e540 100644 --- a/src/Bonsai.Scripting.Python.sln +++ b/Bonsai.Scripting.Python.sln @@ -3,11 +3,16 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.3.32825.248 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bonsai.Scripting.Python", "Bonsai.Scripting.Python\Bonsai.Scripting.Python.csproj", "{DE54420F-E2A7-48E5-B96E-7D9CEA1B2CB0}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonsai.Scripting.Python", "src\Bonsai.Scripting.Python\Bonsai.Scripting.Python.csproj", "{DE54420F-E2A7-48E5-B96E-7D9CEA1B2CB0}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{497840F3-F4DC-4E8A-A000-21E5929B945B}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{DEE5DD87-39C1-BF34-B639-A387DCCF972B}" ProjectSection(SolutionItems) = preProject - Directory.Build.props = Directory.Build.props + build\Common.csproj.props = build\Common.csproj.props + build\Common.csproj.targets = build\Common.csproj.targets + build\Common.Tests.csproj.props = build\Common.Tests.csproj.props + build\icon.png = build\icon.png + build\Package.props = build\Package.props + build\Project.csproj.props = build\Project.csproj.props EndProjectSection EndProject Global diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..91586df --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000..b7ac253 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/LICENSE b/LICENSE index 6cc246b..a0432fd 100644 --- a/LICENSE +++ b/LICENSE @@ -1,13 +1,11 @@ -MIT License +Copyright (c) Bonsai Foundation CIC and Contributors -Copyright (c) 2023 Bonsai Foundation CIC - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -18,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +SOFTWARE. \ No newline at end of file diff --git a/build/Common.Tests.csproj.props b/build/Common.Tests.csproj.props new file mode 100644 index 0000000..c42b25f --- /dev/null +++ b/build/Common.Tests.csproj.props @@ -0,0 +1,6 @@ + + + false + false + + \ No newline at end of file diff --git a/build/Common.csproj.props b/build/Common.csproj.props new file mode 100644 index 0000000..1099119 --- /dev/null +++ b/build/Common.csproj.props @@ -0,0 +1,80 @@ + + + + + Debug + AnyCPU + + + + + 12.0 + true + strict + enable + true + + + true + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)../artifacts')) + + + $(ArtifactsPath)/wsl + + + + + true + Dependency;BonsaiLibrary + + icon.png + $(MSBuildThisFileDirectory)icon.png + + LICENSE + $(MSBuildThisFileDirectory)../LICENSE + + README.md + $(MSBuildThisFileDirectory)../docs/README.md + $(MSBuildThisFileDirectory)README.nuget.md + $(MSBuildProjectDirectory)\README.md + $(MSBuildProjectDirectory)\README.nuget.md + + + false + true + snupkg + + + false + true + + + + + $(WarningsAsErrors);NU1701;CS7035 + + + true + + + true + + + $(MSBuildThisFileDirectory)../.bonsai/Bonsai.exe + + + + + + \ No newline at end of file diff --git a/build/Common.csproj.targets b/build/Common.csproj.targets new file mode 100644 index 0000000..07f4916 --- /dev/null +++ b/build/Common.csproj.targets @@ -0,0 +1,46 @@ + + + + + + + + + + + $(TargetName.ToLowerInvariant()) + DotnetTool + + + 1591,1573 + + + + + + + + 0 + 42.42.42-dev$(DevVersion) + + $(CiBuildVersion) + + + + + + + + + + + + \ No newline at end of file diff --git a/build/Package.props b/build/Package.props new file mode 100644 index 0000000..a353a81 --- /dev/null +++ b/build/Package.props @@ -0,0 +1,9 @@ + + + Bonsai Rx Scripting Python Python.NET + https://bonsai-rx.org/python-scripting + + Bonsai Foundation + Copyright © Bonsai Foundation CIC and Contributors + + \ No newline at end of file diff --git a/build/Project.csproj.props b/build/Project.csproj.props new file mode 100644 index 0000000..1d004b4 --- /dev/null +++ b/build/Project.csproj.props @@ -0,0 +1,5 @@ + + + annotations + + \ No newline at end of file diff --git a/build/icon.png b/build/icon.png new file mode 100644 index 0000000..50b328b Binary files /dev/null and b/build/icon.png differ diff --git a/docs/.gitignore b/docs/.gitignore deleted file mode 100644 index c08f9ad..0000000 --- a/docs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_site \ No newline at end of file diff --git a/README.md b/docs/README.md similarity index 100% rename from README.md rename to docs/README.md diff --git a/docs/api/.gitignore b/docs/api/.gitignore deleted file mode 100644 index e8079a3..0000000 --- a/docs/api/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -############### -# temp file # -############### -*.yml -.manifest diff --git a/docs/bonsai b/docs/bonsai deleted file mode 160000 index 81ef52f..0000000 --- a/docs/bonsai +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 81ef52fb1741ed607a583aa3b640428d70d896a9 diff --git a/docs/bonsai-docfx b/docs/bonsai-docfx new file mode 160000 index 0000000..5b584ca --- /dev/null +++ b/docs/bonsai-docfx @@ -0,0 +1 @@ +Subproject commit 5b584cadc5f1e3088f4972469243df2e3faf6925 diff --git a/docs/build.ps1 b/docs/build.ps1 index 43edf81..01ad8f5 100644 --- a/docs/build.ps1 +++ b/docs/build.ps1 @@ -1,2 +1,19 @@ -.\bonsai\modules\Export-Image.ps1 "..\src\Bonsai.Scripting.Python\bin\Release\net472" -dotnet docfx @args \ No newline at end of file +[CmdletBinding()] param ( + [string[]]$docfxArgs +) +Set-StrictMode -Version 3.0 +$ErrorActionPreference = 'Stop' +$PSNativeCommandUseErrorActionPreference = $true + +Push-Location $PSScriptRoot +try { + $libPaths = @() + $libPaths += Get-ChildItem "..\artifacts\bin\*\release_net4*" -Directory | Select-Object -Expand FullName + $libPaths += "..\artifacts\package\release" + + ./export-images.ps1 $libPaths + dotnet docfx metadata + dotnet docfx build $docfxArgs +} finally { + Pop-Location +} diff --git a/docs/docfx.json b/docs/docfx.json index 6a359cf..3b1af4a 100644 --- a/docs/docfx.json +++ b/docs/docfx.json @@ -1,76 +1,75 @@ { + "$schema": "https://raw.githubusercontent.com/dotnet/docfx/main/schemas/docfx.schema.json", "metadata": [ { "src": [ { - "files": [ - "Bonsai.Scripting.Python*/*.csproj" - ], - "src": "../src" + "src": "../src/", + "files": "**/*.csproj", + "exclude": "**/*.Tests.csproj" } ], - "dest": "api" + "output": "../artifacts/docs/api/", + "enumSortOrder": "declaringOrder", + "memberLayout": "separatePages", + "filter": "filter.yml" } ], "build": { "content": [ { "files": [ - "api/**.yml", - "api/index.md" - ] + "*.md", + "toc.yml", + "{articles,tutorials,examples}/**/*.md", + "{articles,tutorials,examples}/**/toc.yml" + ], + "exclude": "README.md" }, { - "files": [ - "articles/**.md", - "articles/**/toc.yml", - "toc.yml", - "*.md" - ] + "src": "../artifacts/docs/api/", + "dest": "api", + "files": "**/*.yml" } ], "resource": [ { "files": [ - "logo.svg", - "favicon.ico", "images/**", - "workflows/**" + "workflows/**/*.{bonsai,svg}", + "{articles,tutorials,examples}/**/*.{bonsai,svg}" ] + }, + { + "src": "../build/", + "files": "icon.png" } ], - "output": "_site", "overwrite": [ - { - "files": [ - "apidoc/**.md" - ], - "exclude": [ - "obj/**", - "_site/**" - ] - } + "apidoc/**/*.md" ], + "output": "../artifacts/docs/site/", "template": [ "default", "modern", - "bonsai/template", + "bonsai-docfx/template", "template" ], + "sitemap": { + "baseUrl": "https://bonsai-rx.org/python-scripting" + }, "globalMetadata": { - "_appName": "Bonsai - Python Scripting", + "_appName": "Bonsai.Scripting.Python", "_appTitle": "Bonsai.Scripting.Python", + "_appFooter": "© Bonsai Foundation CIC and Contributors. Made with docfx", + "_appLogoPath": "logo.svg", + "_appFaviconPath": "icon.png", "_enableNewTab": true, "_enableSearch": true, - "pdf": false, - "_appFooter": "© 2024 Bonsai Foundation CIC and Contributors. Made with docfx", "_gitContribute": { - "repo": "https://github.com/bonsai-rx/python-scripting", - "branch": "main", "apiSpecFolder": "docs/apidoc" } }, - "markdownEngineName": "markdig", "markdownEngineProperties": { "markdigExtensions": [ "attributes", diff --git a/docs/export-images.ps1 b/docs/export-images.ps1 new file mode 100644 index 0000000..e613b87 --- /dev/null +++ b/docs/export-images.ps1 @@ -0,0 +1,44 @@ +[CmdletBinding()] param ( + [string[]]$LibrarySources, + [bool]$UseGalleryForWorkflowsDirectory=$false, + [bool]$UseGalleryForExamplesDirectory=$true, + [string]$OutputFolder=$null +) +Set-StrictMode -Version 3.0 +$ErrorActionPreference = 'Stop' +$PSNativeCommandUseErrorActionPreference = $true + +if ($OutputFolder) { + $OutputFolder = Join-Path (Get-Location) $OutputFolder +} + +function Process-Workflow-Collection([bool]$useGallery, [string]$workflowPath, [string]$environmentPath) { + $libPath = $LibrarySources + + if ($useGallery) { + $libPath = @() + $galleryPath = Join-Path $environmentPath 'Gallery' + $null = New-Item -ItemType Directory -Path $galleryPath -Force + foreach ($librarySource in $LibrarySources) { + Get-ChildItem -Path $librarySource -Filter *.nupkg | Copy-Item -Destination $galleryPath + } + } + + $bootstrapperPath = (Join-Path $environmentPath 'Bonsai.exe') + .\bonsai-docfx\modules\Export-Image.ps1 -libPath $libPath -workflowPath $workflowPath -bootstrapperPath $bootstrapperPath -outputFolder $OutputFolder -documentationRoot $PSScriptRoot +} + +Push-Location $PSScriptRoot +try { + if (Test-Path -Path 'workflows/') { + Process-Workflow-Collection $UseGalleryForWorkflowsDirectory './workflows' '../.bonsai/' + } + + if (Test-Path -Path 'examples/') { + foreach ($environment in (Get-ChildItem -Path 'examples/' -Filter '.bonsai' -Recurse -FollowSymlink -Directory)) { + Process-Workflow-Collection $UseGalleryForExamplesDirectory ($environment.Parent.FullName) ($environment.FullName) + } + } +} finally { + Pop-Location +} diff --git a/docs/favicon.ico b/docs/favicon.ico deleted file mode 100644 index 5387c2d..0000000 Binary files a/docs/favicon.ico and /dev/null differ diff --git a/docs/filter.yml b/docs/filter.yml new file mode 100644 index 0000000..472eb43 --- /dev/null +++ b/docs/filter.yml @@ -0,0 +1,4 @@ +apiRules: +- exclude: + hasAttribute: + uid: System.ObsoleteAttribute diff --git a/docs/logo.svg b/docs/logo.svg deleted file mode 100644 index aaf57f7..0000000 --- a/docs/logo.svg +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - diff --git a/docs/template/public/main.css b/docs/template/public/main.css index ee56505..13bc806 100644 --- a/docs/template/public/main.css +++ b/docs/template/public/main.css @@ -1 +1 @@ -@import "workflow.css"; \ No newline at end of file +@import "workflow.css"; diff --git a/docs/template/public/main.js b/docs/template/public/main.js index 62c7fa4..9a0c9f7 100644 --- a/docs/template/public/main.js +++ b/docs/template/public/main.js @@ -10,4 +10,4 @@ export default { start: () => { WorkflowContainer.init(); } -} \ No newline at end of file +} diff --git a/docs/toc.yml b/docs/toc.yml index e61b382..3f6d310 100644 --- a/docs/toc.yml +++ b/docs/toc.yml @@ -1,4 +1,4 @@ -- name: Manual +- name: Documentation href: articles/ -- name: Reference - href: api/ +- name: API + href: ../artifacts/docs/api/ diff --git a/docs/workflows/.gitignore b/docs/workflows/.gitignore index af455cb..e2beea4 100644 --- a/docs/workflows/.gitignore +++ b/docs/workflows/.gitignore @@ -1,2 +1,2 @@ *.layout -*.svg \ No newline at end of file +*.svg diff --git a/global.json b/global.json new file mode 100644 index 0000000..989a69c --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "8.0.100", + "rollForward": "latestMinor" + } +} \ No newline at end of file diff --git a/src/.editorconfig b/src/.editorconfig deleted file mode 100644 index d0f6ba9..0000000 --- a/src/.editorconfig +++ /dev/null @@ -1,27 +0,0 @@ -# To learn more about .editorconfig see https://aka.ms/editorconfigdocs -############################### -# Core EditorConfig Options # -############################### -# All files -[*] -indent_style = space - -# XML project files -[*.{csproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] -indent_size = 2 - -# XML config files -[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] -indent_size = 2 - -# Code files -[*.{cs,csx}] -indent_size = 4 -insert_final_newline = true -charset = utf-8-bom -############################### -# .NET Coding Conventions # -############################### -[*.{cs}] -# Organize usings -dotnet_sort_system_directives_first = true diff --git a/src/Bonsai.Scripting.Python/Bonsai.Scripting.Python.csproj b/src/Bonsai.Scripting.Python/Bonsai.Scripting.Python.csproj index 0855a4f..38e145f 100644 --- a/src/Bonsai.Scripting.Python/Bonsai.Scripting.Python.csproj +++ b/src/Bonsai.Scripting.Python/Bonsai.Scripting.Python.csproj @@ -3,10 +3,7 @@ Bonsai - Python Scripting Library Bonsai Scripting Library for interfacing with the Python runtime. - Bonsai Rx Scripting Python Python.NET net472;netstandard2.0 - 0.2.1 - 8.0 @@ -14,4 +11,4 @@ - + \ No newline at end of file diff --git a/src/Bonsai.Scripting.Python/Properties/launchSettings.json b/src/Bonsai.Scripting.Python/Properties/launchSettings.json index 93c2d6b..4af4f46 100644 --- a/src/Bonsai.Scripting.Python/Properties/launchSettings.json +++ b/src/Bonsai.Scripting.Python/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "Bonsai": { "commandName": "Executable", - "executablePath": "$(SolutionDir)..\\.bonsai\\Bonsai.exe", + "executablePath": "$(BonsaiExecutablePath)", "commandLineArgs": "--lib:\"$(TargetDir).\"", "nativeDebugging": true } diff --git a/src/Directory.Build.props b/src/Directory.Build.props deleted file mode 100644 index 6007f57..0000000 --- a/src/Directory.Build.props +++ /dev/null @@ -1,24 +0,0 @@ - - - - Bonsai - Copyright © Bonsai Foundation CIC and Contributors 2023 - snupkg - true - ..\bin\$(Configuration) - README.md - https://bonsai-rx.org/python-scripting - https://github.com/bonsai-rx/python-scripting/blob/main/LICENSE - https://bonsai-rx.org/assets/images/bonsai.png - true - true - https://github.com/bonsai-rx/python-scripting.git - git - - strict - - - - - - \ No newline at end of file diff --git a/src/NuGet.config b/src/NuGet.config deleted file mode 100644 index 43a0574..0000000 --- a/src/NuGet.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file