From 252b13a78e6c36c6f447e9c7464ada279a6a6fbe Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Fri, 17 May 2024 16:50:04 +0200 Subject: [PATCH 01/37] build: Update flake with rust and maturin --- flake.lock | 110 ++++++++++------------------------------------------- flake.nix | 56 +++++++++++++-------------- 2 files changed, 46 insertions(+), 120 deletions(-) diff --git a/flake.lock b/flake.lock index 3146adf01..b8125be0b 100644 --- a/flake.lock +++ b/flake.lock @@ -37,19 +37,21 @@ "type": "github" } }, - "flake-compat_2": { - "flake": false, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "lastModified": 1715865404, + "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9", "type": "github" }, "original": { - "owner": "edolstra", - "repo": "flake-compat", + "owner": "hercules-ci", + "repo": "flake-parts", "type": "github" } }, @@ -71,23 +73,6 @@ "type": "github" } }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", - "type": "github" - }, - "original": { - "id": "flake-utils", - "type": "indirect" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -166,24 +151,16 @@ "type": "github" } }, - "nixpkgs-python": { - "inputs": { - "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_3" - }, + "nixpkgs-lib": { "locked": { - "lastModified": 1692934204, - "narHash": "sha256-dJG+DyQlWgeBEcCl9j3R5A4vcBnC2GLRacNeJgcZPo8=", - "owner": "cachix", - "repo": "nixpkgs-python", - "rev": "dfe9a33d0d9bd31650b69c36f8fff5f2d5342393", - "type": "github" + "lastModified": 1714640452, + "narHash": "sha256-QBx10+k6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" }, "original": { - "owner": "cachix", - "repo": "nixpkgs-python", - "type": "github" + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" } }, "nixpkgs-regression": { @@ -234,22 +211,6 @@ "type": "github" } }, - "nixpkgs_3": { - "locked": { - "lastModified": 1685974512, - "narHash": "sha256-WLPHpe96RbPRO9iDtCxgsYkadTheRq7wqXWdGpR6g7w=", - "owner": "domenkozar", - "repo": "nixpkgs", - "rev": "1102477695918daba466123cc2ef694ed3a49939", - "type": "github" - }, - "original": { - "owner": "domenkozar", - "ref": "cpython-moduralize", - "repo": "nixpkgs", - "type": "github" - } - }, "pre-commit-hooks": { "inputs": { "flake-compat": [ @@ -281,9 +242,8 @@ "root": { "inputs": { "devenv": "devenv", - "nixpkgs": "nixpkgs_2", - "nixpkgs-python": "nixpkgs-python", - "systems": "systems_3" + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs_2" } }, "systems": { @@ -300,36 +260,6 @@ "repo": "default", "type": "github" } - }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_3": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 28ea23292..a6686959f 100644 --- a/flake.nix +++ b/flake.nix @@ -1,46 +1,42 @@ { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; - systems.url = "github:nix-systems/default"; devenv.url = "github:cachix/devenv"; - nixpkgs-python.url = "github:cachix/nixpkgs-python"; - }; - - nixConfig = { - extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="; - extra-substituters = "https://devenv.cachix.org"; + flake-parts.url = "github:hercules-ci/flake-parts"; }; outputs = { self, nixpkgs, devenv, - systems, + flake-parts, ... - } @ inputs: let - forEachSystem = nixpkgs.lib.genAttrs (import systems); - in { - devShells = - forEachSystem - (system: let - pkgs = nixpkgs.legacyPackages.${system}; - in { - default = devenv.lib.mkShell { - inherit inputs pkgs; - modules = [ - { - languages.python = { + } @ inputs: + flake-parts.lib.mkFlake {inherit inputs;} { + imports = [inputs.devenv.flakeModule]; + systems = ["x86_64-linux" "aarch64-darwin"]; + + perSystem = {pkgs, ...}: { + devenv.shells.default = { + packages = with pkgs; [maturin]; + + languages = { + python = { + enable = true; + poetry = { enable = true; - poetry = { - enable = true; - install.enable = true; - install.allExtras = true; - }; - version = "3.11"; + install.enable = true; + install.allExtras = true; }; - } - ]; + }; + rust.enable = true; + }; }; - }); + }; + }; + + nixConfig = { + extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="; + extra-substituters = "https://devenv.cachix.org"; }; } From 7f12ec35c527dad652b910eed9cf282ec319f27a Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Fri, 17 May 2024 16:57:03 +0200 Subject: [PATCH 02/37] build: Move the workspace top-level --- crates/Cargo.lock => Cargo.lock | 0 Cargo.toml | 3 +++ crates/Cargo.toml | 3 --- flake.lock | 30 ++++++++---------------------- flake.nix | 7 +++++-- 5 files changed, 16 insertions(+), 27 deletions(-) rename crates/Cargo.lock => Cargo.lock (100%) create mode 100644 Cargo.toml delete mode 100644 crates/Cargo.toml diff --git a/crates/Cargo.lock b/Cargo.lock similarity index 100% rename from crates/Cargo.lock rename to Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 000000000..d7671484b --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,3 @@ +[workspace] +members = ["crates/*"] +resolver = "2" diff --git a/crates/Cargo.toml b/crates/Cargo.toml deleted file mode 100644 index 8a69f7202..000000000 --- a/crates/Cargo.toml +++ /dev/null @@ -1,3 +0,0 @@ -[workspace] - -members = ["eko", "ekore"] diff --git a/flake.lock b/flake.lock index b8125be0b..d66f4ed08 100644 --- a/flake.lock +++ b/flake.lock @@ -4,7 +4,9 @@ "inputs": { "flake-compat": "flake-compat", "nix": "nix", - "nixpkgs": "nixpkgs", + "nixpkgs": [ + "nixpkgs" + ], "pre-commit-hooks": "pre-commit-hooks" }, "locked": { @@ -137,16 +139,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1678875422, - "narHash": "sha256-T3o6NcQPwXjxJMn2shz86Chch4ljXgZn746c2caGxd8=", + "lastModified": 1715787315, + "narHash": "sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "126f49a01de5b7e35a43fd43f891ecf6d3a51459", + "rev": "33d1e753c82ffc557b4a585c77de43d4c922ebb5", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -195,22 +197,6 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1693183237, - "narHash": "sha256-c7OtyBkZ/vZE/WosBpRGRtkbWZjDHGJP7fg1FyB9Dsc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "ea5234e7073d5f44728c499192544a84244bf35a", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-23.05", - "repo": "nixpkgs", - "type": "github" - } - }, "pre-commit-hooks": { "inputs": { "flake-compat": [ @@ -243,7 +229,7 @@ "inputs": { "devenv": "devenv", "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs" } }, "systems": { diff --git a/flake.nix b/flake.nix index a6686959f..b2aeb1d8b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,10 @@ { inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; - devenv.url = "github:cachix/devenv"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + devenv = { + url = "github:cachix/devenv"; + inputs.nixpkgs.follows = "nixpkgs"; + }; flake-parts.url = "github:hercules-ci/flake-parts"; }; From 3d7e6bc6946bb8865629c0246108f34cb379e433 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Fri, 17 May 2024 17:01:18 +0200 Subject: [PATCH 03/37] build: Migrate metadata to workspace from individual crates --- Cargo.toml | 19 +++++++++++++++++++ crates/eko/Cargo.toml | 15 ++++++++++++--- crates/ekore/Cargo.toml | 15 +++++++++++---- 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d7671484b..f26518890 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,22 @@ [workspace] members = ["crates/*"] resolver = "2" + +[workspace.package] +authors = [ + "A. Barontini ", + "A. Candido ", + "F. Hekhorn ", + "N. Laurenti ", + "G. Magni ", + "T. Sharma ", +] +description = "Evolution Kernel Operators" +readme = "README.md" +categories = ["science"] +edition = "2021" +keywords = ["physics"] +license = "GPL-3.0-or-later" +repository = "https://github.com/NNPDF/eko" +rust-version = "1.60.0" +version = "0.0.1" diff --git a/crates/eko/Cargo.toml b/crates/eko/Cargo.toml index 731e1399c..40b14bb0a 100644 --- a/crates/eko/Cargo.toml +++ b/crates/eko/Cargo.toml @@ -1,10 +1,19 @@ [package] name = "eko" -version = "0.1.0" -edition = "2021" + +authors.workspace = true +description.workspace = true +readme.workspace = true +categories.workspace = true +edition.workspace = true +keywords.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true +version.workspace = true [package.metadata.docs.rs] -rustdoc-args = [ "--html-in-header", "../katex-header.html" ] +rustdoc-args = ["--html-in-header", "../katex-header.html"] [lib] name = "ekors" diff --git a/crates/ekore/Cargo.toml b/crates/ekore/Cargo.toml index 9dfdb7515..e25e24761 100644 --- a/crates/ekore/Cargo.toml +++ b/crates/ekore/Cargo.toml @@ -1,12 +1,19 @@ [package] name = "ekore" -version = "0.1.0" -edition = "2021" description = "EKO expressions" -license = "GPL-3.0-or-later" + +authors.workspace = true +readme.workspace = true +categories.workspace = true +edition.workspace = true +keywords.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true +version.workspace = true [package.metadata.docs.rs] -rustdoc-args = [ "--html-in-header", "../katex-header.html" ] +rustdoc-args = ["--html-in-header", "../katex-header.html"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html From 1c7912fed0fddb6250fb0b7c979f3e841f0ac6a6 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Fri, 17 May 2024 18:24:31 +0200 Subject: [PATCH 04/37] ci: Provide maturin-deploying workflow --- .github/workflows/maturin.yml | 123 ++++++++++++++++++++++++++++++++++ Cargo.lock | 4 +- crates/eko/Cargo.toml | 2 +- crates/eko/pyproject.toml | 2 +- 4 files changed, 127 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/maturin.yml diff --git a/.github/workflows/maturin.yml b/.github/workflows/maturin.yml new file mode 100644 index 000000000..f2861ce52 --- /dev/null +++ b/.github/workflows/maturin.yml @@ -0,0 +1,123 @@ +name: Deploy Maturin wheels + +on: + push: + tags: + - "*" + workflow_dispatch: + +permissions: + contents: read + +jobs: + linux: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: ubuntu-latest + target: x86_64 + - runner: ubuntu-latest + target: x86 + - runner: ubuntu-latest + target: aarch64 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.10" + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist --find-interpreter -m crates/eko/Cargo.toml + sccache: "true" + manylinux: auto + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-linux-${{ matrix.platform.target }} + path: dist + + windows: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: windows-latest + target: x64 + - runner: windows-latest + target: x86 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.10" + architecture: ${{ matrix.platform.target }} + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist --find-interpreter -m crates/eko/Cargo.toml + sccache: "true" + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-windows-${{ matrix.platform.target }} + path: dist + + macos: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: macos-latest + target: x86_64 + - runner: macos-14 + target: aarch64 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.10" + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist --find-interpreter -m crates/eko/Cargo.toml + sccache: "true" + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-macos-${{ matrix.platform.target }} + path: dist + + sdist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build sdist + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out dist + - name: Upload sdist + uses: actions/upload-artifact@v4 + with: + name: wheels-sdist + path: dist + + release: + name: Release + runs-on: ubuntu-latest + if: "startsWith(github.ref, 'refs/tags/')" + needs: [linux, windows, macos, sdist] + steps: + - uses: actions/download-artifact@v4 + - name: Publish to PyPI + uses: PyO3/maturin-action@v1 + env: + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + with: + command: upload + args: --non-interactive --skip-existing wheels-*/* diff --git a/Cargo.lock b/Cargo.lock index 0e6acc14f..80fa02400 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -33,7 +33,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "eko" -version = "0.1.0" +version = "0.0.1" dependencies = [ "ekore", "num", @@ -41,7 +41,7 @@ dependencies = [ [[package]] name = "ekore" -version = "0.1.0" +version = "0.0.1" dependencies = [ "float-cmp", "hashbrown", diff --git a/crates/eko/Cargo.toml b/crates/eko/Cargo.toml index 40b14bb0a..b25b785eb 100644 --- a/crates/eko/Cargo.toml +++ b/crates/eko/Cargo.toml @@ -21,4 +21,4 @@ crate-type = ["cdylib"] [dependencies] num = "0.4.1" -ekore = { version = "0.1.0", path = "../ekore" } +ekore = { path = "../ekore" } diff --git a/crates/eko/pyproject.toml b/crates/eko/pyproject.toml index cd5c25d40..7b2921e04 100644 --- a/crates/eko/pyproject.toml +++ b/crates/eko/pyproject.toml @@ -3,7 +3,7 @@ requires = ["maturin>=1.1,<2.0"] build-backend = "maturin" [project] -name = "ekors" +name = "eko-rs" requires-python = ">=3.9" classifiers = [ "Programming Language :: Rust", From b98d28915c517c42641998eafa399ca4db5faec5 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Fri, 17 May 2024 18:38:01 +0200 Subject: [PATCH 05/37] build: Reintroduce explicit internal version dependency --- crates/eko/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/eko/Cargo.toml b/crates/eko/Cargo.toml index b25b785eb..65721674a 100644 --- a/crates/eko/Cargo.toml +++ b/crates/eko/Cargo.toml @@ -21,4 +21,4 @@ crate-type = ["cdylib"] [dependencies] num = "0.4.1" -ekore = { path = "../ekore" } +ekore = { path = "../ekore", version = "0.0.1" } From d3e0062768c000422692cb6726c073c4d81863a3 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Fri, 17 May 2024 20:22:18 +0200 Subject: [PATCH 06/37] build: Add script to bump versions --- crates/bump-versions.nu | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 crates/bump-versions.nu diff --git a/crates/bump-versions.nu b/crates/bump-versions.nu new file mode 100644 index 000000000..02aec7fdf --- /dev/null +++ b/crates/bump-versions.nu @@ -0,0 +1,19 @@ +let version = "x.x.x" + +let crates = ls crates | where type == dir | get name | filter {|n| $"($n)/Cargo.toml" | path exists } | each {|p| split row "/" | last} + +def update-manifest [] { + let manifest = $in + let internals = $manifest | get dependencies | columns | where {|it| $it in $crates} + $internals | reduce --fold $manifest {|i, acc| + let field = $"dependencies.($i).version" | split row '.' | into cell-path + $acc | update $field $version + } +} + +def replace-manifest [] { + let path = $"crates/($in)/Cargo.toml" + open $path | update-manifest | to toml | save -f $path +} + +$crates | each {|p| $p | replace-manifest} From 84ebeb87680d5dcae9a85dcc186c943a303e88b0 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Fri, 17 May 2024 20:29:04 +0200 Subject: [PATCH 07/37] build: Bump workspace version as well --- crates/bump-versions.nu | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/bump-versions.nu b/crates/bump-versions.nu index 02aec7fdf..03d3cfa9b 100644 --- a/crates/bump-versions.nu +++ b/crates/bump-versions.nu @@ -1,5 +1,9 @@ +cd .. + let version = "x.x.x" +open Cargo.toml | update workspace.package.version $version | save -f Cargo.toml + let crates = ls crates | where type == dir | get name | filter {|n| $"($n)/Cargo.toml" | path exists } | each {|p| split row "/" | last} def update-manifest [] { @@ -14,6 +18,7 @@ def update-manifest [] { def replace-manifest [] { let path = $"crates/($in)/Cargo.toml" open $path | update-manifest | to toml | save -f $path + $path } -$crates | each {|p| $p | replace-manifest} +$crates | each {|p| $p | replace-manifest} | prepend Cargo.toml From e1da0a5b5bf4ca9689b91885991d06188afaab3d Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Fri, 17 May 2024 20:33:11 +0200 Subject: [PATCH 08/37] build: Restore pre-commit package installation in flake --- crates/bump-versions.nu | 4 ++-- flake.nix | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/bump-versions.nu b/crates/bump-versions.nu index 03d3cfa9b..20db6d076 100644 --- a/crates/bump-versions.nu +++ b/crates/bump-versions.nu @@ -4,12 +4,12 @@ let version = "x.x.x" open Cargo.toml | update workspace.package.version $version | save -f Cargo.toml -let crates = ls crates | where type == dir | get name | filter {|n| $"($n)/Cargo.toml" | path exists } | each {|p| split row "/" | last} +let crates = ls crates | where type == dir | get name | filter {|n| $"($n)/Cargo.toml" | path exists } | each {|p| split row "/" | last} def update-manifest [] { let manifest = $in let internals = $manifest | get dependencies | columns | where {|it| $it in $crates} - $internals | reduce --fold $manifest {|i, acc| + $internals | reduce --fold $manifest {|i, acc| let field = $"dependencies.($i).version" | split row '.' | into cell-path $acc | update $field $version } diff --git a/flake.nix b/flake.nix index b2aeb1d8b..febe22228 100644 --- a/flake.nix +++ b/flake.nix @@ -21,7 +21,7 @@ perSystem = {pkgs, ...}: { devenv.shells.default = { - packages = with pkgs; [maturin]; + packages = with pkgs; [pre-commit maturin]; languages = { python = { From 2d137adae903c50571c38bbf69ebe7fda7b7a28a Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Mon, 20 May 2024 15:04:48 +0200 Subject: [PATCH 09/37] ci: Add crates publishing workflow, add branches push events for both --- .github/workflows/crates.yml | 31 +++++++++++++++++++++++++++++++ .github/workflows/maturin.yml | 2 ++ 2 files changed, 33 insertions(+) create mode 100644 .github/workflows/crates.yml diff --git a/.github/workflows/crates.yml b/.github/workflows/crates.yml new file mode 100644 index 000000000..e4b0cab0f --- /dev/null +++ b/.github/workflows/crates.yml @@ -0,0 +1,31 @@ +name: Deploy Crates + +on: + push: + # TODO: remove branches + branches: ["*"] + tags: + - "*" + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Setup Nushell + uses: hustcer/setup-nu@v3.10 + with: + version: 0.93.0 + - name: Bump versions + shell: nu {0} + run: | + do { cd crates; nu bump-versions.nu } + - name: Publish crates + shell: nu {0} + run: | + ls crates | where type == dir + | get name + | filter {|n| $"($n)/Cargo.toml" | path exists } + | each {|p| split row "/" | last} + | each {|p| cargo publish -p $p } diff --git a/.github/workflows/maturin.yml b/.github/workflows/maturin.yml index f2861ce52..f6b8dd0e0 100644 --- a/.github/workflows/maturin.yml +++ b/.github/workflows/maturin.yml @@ -2,6 +2,8 @@ name: Deploy Maturin wheels on: push: + # TODO: remove branches + branches: ["*"] tags: - "*" workflow_dispatch: From b546bb8979af3056efb36cd6ff76ac33e0d63ef0 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Mon, 20 May 2024 15:08:51 +0200 Subject: [PATCH 10/37] ci: Providing missing path to maturin sdist job --- .github/workflows/maturin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maturin.yml b/.github/workflows/maturin.yml index f6b8dd0e0..9133adbe4 100644 --- a/.github/workflows/maturin.yml +++ b/.github/workflows/maturin.yml @@ -102,7 +102,7 @@ jobs: uses: PyO3/maturin-action@v1 with: command: sdist - args: --out dist + args: --out dist -m crates/eko/Cargo.toml - name: Upload sdist uses: actions/upload-artifact@v4 with: From 06dfc799d4aa752e6b18631cae42fa7044102b3a Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Mon, 20 May 2024 15:11:21 +0200 Subject: [PATCH 11/37] ci: Checkout repo in crate releasing worklow --- .github/workflows/crates.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/crates.yml b/.github/workflows/crates.yml index e4b0cab0f..b007ecf04 100644 --- a/.github/workflows/crates.yml +++ b/.github/workflows/crates.yml @@ -13,6 +13,7 @@ jobs: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - name: Setup Nushell uses: hustcer/setup-nu@v3.10 with: From edcc4974aa174e2c49fddda4c55e79454e6952fe Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Mon, 20 May 2024 22:32:43 +0200 Subject: [PATCH 12/37] ci: Fix writing on file just read --- crates/bump-versions.nu | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/bump-versions.nu b/crates/bump-versions.nu index 20db6d076..8815d3724 100644 --- a/crates/bump-versions.nu +++ b/crates/bump-versions.nu @@ -2,7 +2,8 @@ cd .. let version = "x.x.x" -open Cargo.toml | update workspace.package.version $version | save -f Cargo.toml +open Cargo.toml | update workspace.package.version $version + | collect { save -f Cargo.toml } let crates = ls crates | where type == dir | get name | filter {|n| $"($n)/Cargo.toml" | path exists } | each {|p| split row "/" | last} @@ -17,7 +18,7 @@ def update-manifest [] { def replace-manifest [] { let path = $"crates/($in)/Cargo.toml" - open $path | update-manifest | to toml | save -f $path + open $path | update-manifest | to toml | collect { save -f $path } $path } From 2a2319b875b1a97b7325ced54e71e734d07dfb80 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Mon, 20 May 2024 23:02:34 +0200 Subject: [PATCH 13/37] ci: Define an alpha version to test crates release --- crates/bump-versions.nu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bump-versions.nu b/crates/bump-versions.nu index 8815d3724..cc00f827f 100644 --- a/crates/bump-versions.nu +++ b/crates/bump-versions.nu @@ -1,6 +1,6 @@ cd .. -let version = "x.x.x" +let version = "0.1.1-alpha.0" open Cargo.toml | update workspace.package.version $version | collect { save -f Cargo.toml } From 4e61d425504831a9d01918e9fdd7ead0513737b5 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Tue, 21 May 2024 03:10:31 +0200 Subject: [PATCH 14/37] ci: Expose cargo token from secrets --- .github/workflows/crates.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/crates.yml b/.github/workflows/crates.yml index b007ecf04..4c4c70278 100644 --- a/.github/workflows/crates.yml +++ b/.github/workflows/crates.yml @@ -30,3 +30,5 @@ jobs: | filter {|n| $"($n)/Cargo.toml" | path exists } | each {|p| split row "/" | last} | each {|p| cargo publish -p $p } + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} From 48b946df7f3b6ec9d708445b774d33881e7e9682 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Tue, 21 May 2024 03:12:42 +0200 Subject: [PATCH 15/37] ci: Allow dirty publish to support version bumping in the CI --- .github/workflows/crates.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/crates.yml b/.github/workflows/crates.yml index 4c4c70278..aadbfe5d2 100644 --- a/.github/workflows/crates.yml +++ b/.github/workflows/crates.yml @@ -29,6 +29,6 @@ jobs: | get name | filter {|n| $"($n)/Cargo.toml" | path exists } | each {|p| split row "/" | last} - | each {|p| cargo publish -p $p } + | each {|p| cargo publish -p $p --allow-dirty } env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} From 8e44182d30a6923050efbfe240fdbf4a329afdd6 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Tue, 21 May 2024 03:45:56 +0200 Subject: [PATCH 16/37] ci: Define release order for crates --- .github/workflows/crates.yml | 6 +----- crates/README.md | 11 +++++++++++ crates/bump-versions.nu | 4 ++-- crates/release.json | 1 + 4 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 crates/README.md create mode 100644 crates/release.json diff --git a/.github/workflows/crates.yml b/.github/workflows/crates.yml index aadbfe5d2..fbad509cd 100644 --- a/.github/workflows/crates.yml +++ b/.github/workflows/crates.yml @@ -25,10 +25,6 @@ jobs: - name: Publish crates shell: nu {0} run: | - ls crates | where type == dir - | get name - | filter {|n| $"($n)/Cargo.toml" | path exists } - | each {|p| split row "/" | last} - | each {|p| cargo publish -p $p --allow-dirty } + open crates/release.json | each {|p| cargo publish -p $p --allow-dirty } env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/crates/README.md b/crates/README.md new file mode 100644 index 000000000..776a5ad07 --- /dev/null +++ b/crates/README.md @@ -0,0 +1,11 @@ +# Crates + +... + +## Files + +- `release.json` defines the releasing order of crates + - only listed crates will be released + - dependent crates should follow those they are depending on +- `katex-header.html` is an HTML snippet to be included in every docs page to inject + KaTeX support diff --git a/crates/bump-versions.nu b/crates/bump-versions.nu index cc00f827f..09970a1d4 100644 --- a/crates/bump-versions.nu +++ b/crates/bump-versions.nu @@ -1,11 +1,11 @@ cd .. -let version = "0.1.1-alpha.0" +let version = "0.1.1-alpha.1" open Cargo.toml | update workspace.package.version $version | collect { save -f Cargo.toml } -let crates = ls crates | where type == dir | get name | filter {|n| $"($n)/Cargo.toml" | path exists } | each {|p| split row "/" | last} +let crates = open crates/release.json def update-manifest [] { let manifest = $in diff --git a/crates/release.json b/crates/release.json new file mode 100644 index 000000000..c2b9f6f54 --- /dev/null +++ b/crates/release.json @@ -0,0 +1 @@ +["ekore", "eko"] From a57ca34576336b24514a896b7ec1cdc7f721eddf Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Tue, 21 May 2024 10:50:30 +0300 Subject: [PATCH 17/37] rust: Fix KaTeX location --- crates/eko/Cargo.toml | 2 +- crates/ekore/Cargo.toml | 2 +- pyproject.toml.patch | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/eko/Cargo.toml b/crates/eko/Cargo.toml index 65721674a..75fc71473 100644 --- a/crates/eko/Cargo.toml +++ b/crates/eko/Cargo.toml @@ -13,7 +13,7 @@ rust-version.workspace = true version.workspace = true [package.metadata.docs.rs] -rustdoc-args = ["--html-in-header", "../katex-header.html"] +rustdoc-args = ["--html-in-header", "crates/katex-header.html"] [lib] name = "ekors" diff --git a/crates/ekore/Cargo.toml b/crates/ekore/Cargo.toml index e25e24761..0941eed36 100644 --- a/crates/ekore/Cargo.toml +++ b/crates/ekore/Cargo.toml @@ -13,7 +13,7 @@ rust-version.workspace = true version.workspace = true [package.metadata.docs.rs] -rustdoc-args = ["--html-in-header", "../katex-header.html"] +rustdoc-args = ["--html-in-header", "crates/katex-header.html"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/pyproject.toml.patch b/pyproject.toml.patch index 8e9119a23..44b4c61e2 100644 --- a/pyproject.toml.patch +++ b/pyproject.toml.patch @@ -1,5 +1,5 @@ diff --git a/pyproject.toml b/pyproject.toml -index 7404d871..a1e3ae66 100644 +index 7404d871..3d19827b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,20 @@ @@ -30,11 +30,11 @@ index 7404d871..a1e3ae66 100644 asv-clean = { "shell" = "rm -rf benchmarks/env benchmarks/html benchmarks/results" } asv = ["asv-run", "asv-publish", "asv-preview"] +compile = "pip install -e crates/eko/" -+rdocs.cmd = "cargo doc --workspace --manifest-path crates/Cargo.toml --no-deps" -+rdocs.env = { RUSTDOCFLAGS = "--html-in-header katex-header.html" } -+rdocs-view = "xdg-open crates/target/doc/ekors/index.html" -+rdocs-clean = "rm -rf crates/target/doc/" -+rtest = "cargo test --workspace --manifest-path crates/Cargo.toml" ++rdocs.cmd = "cargo doc --workspace --no-deps" ++rdocs.env = { RUSTDOCFLAGS = "--html-in-header crates/katex-header.html" } ++rdocs-view = "xdg-open target/doc/ekors/index.html" ++rdocs-clean = "rm -rf target/doc/" ++rtest = "cargo test --workspace" [tool.pytest.ini_options] testpaths = ['tests/', 'benchmarks/'] From a7ad7d075c7600cc08e60d67f45457d4f84dcbf1 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Tue, 21 May 2024 09:52:30 +0200 Subject: [PATCH 18/37] ci: Bump prerelease version once more --- crates/bump-versions.nu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bump-versions.nu b/crates/bump-versions.nu index 09970a1d4..b12296e7f 100644 --- a/crates/bump-versions.nu +++ b/crates/bump-versions.nu @@ -1,6 +1,6 @@ cd .. -let version = "0.1.1-alpha.1" +let version = "0.1.1-alpha.2" open Cargo.toml | update workspace.package.version $version | collect { save -f Cargo.toml } From b7df850b4242209f9cecf93b414b147a6f7f0d32 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Tue, 21 May 2024 11:27:16 +0200 Subject: [PATCH 19/37] docs: Symlink katex header in individual crates --- crates/bump-versions.nu | 2 +- crates/eko/Cargo.toml | 2 +- crates/eko/katex-header.toml | 1 + crates/ekore/Cargo.toml | 2 +- crates/ekore/katex-header.toml | 1 + 5 files changed, 5 insertions(+), 3 deletions(-) create mode 120000 crates/eko/katex-header.toml create mode 120000 crates/ekore/katex-header.toml diff --git a/crates/bump-versions.nu b/crates/bump-versions.nu index b12296e7f..92290c63f 100644 --- a/crates/bump-versions.nu +++ b/crates/bump-versions.nu @@ -1,6 +1,6 @@ cd .. -let version = "0.1.1-alpha.2" +let version = "0.1.1-alpha.3" open Cargo.toml | update workspace.package.version $version | collect { save -f Cargo.toml } diff --git a/crates/eko/Cargo.toml b/crates/eko/Cargo.toml index 75fc71473..0fc9b2ee7 100644 --- a/crates/eko/Cargo.toml +++ b/crates/eko/Cargo.toml @@ -13,7 +13,7 @@ rust-version.workspace = true version.workspace = true [package.metadata.docs.rs] -rustdoc-args = ["--html-in-header", "crates/katex-header.html"] +rustdoc-args = ["--html-in-header", "katex-header.html"] [lib] name = "ekors" diff --git a/crates/eko/katex-header.toml b/crates/eko/katex-header.toml new file mode 120000 index 000000000..810e68dcb --- /dev/null +++ b/crates/eko/katex-header.toml @@ -0,0 +1 @@ +../katex-header.html \ No newline at end of file diff --git a/crates/ekore/Cargo.toml b/crates/ekore/Cargo.toml index 0941eed36..86e9784eb 100644 --- a/crates/ekore/Cargo.toml +++ b/crates/ekore/Cargo.toml @@ -13,7 +13,7 @@ rust-version.workspace = true version.workspace = true [package.metadata.docs.rs] -rustdoc-args = ["--html-in-header", "crates/katex-header.html"] +rustdoc-args = ["--html-in-header", "katex-header.html"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/ekore/katex-header.toml b/crates/ekore/katex-header.toml new file mode 120000 index 000000000..810e68dcb --- /dev/null +++ b/crates/ekore/katex-header.toml @@ -0,0 +1 @@ +../katex-header.html \ No newline at end of file From 06c4cf1cc6af334f8a9c0bc6d1387788dc46a3f4 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Tue, 21 May 2024 11:49:06 +0200 Subject: [PATCH 20/37] docs: Fix extensions --- crates/bump-versions.nu | 2 +- crates/eko/{katex-header.toml => katex-header.html} | 0 crates/ekore/{katex-header.toml => katex-header.html} | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename crates/eko/{katex-header.toml => katex-header.html} (100%) rename crates/ekore/{katex-header.toml => katex-header.html} (100%) diff --git a/crates/bump-versions.nu b/crates/bump-versions.nu index 92290c63f..67b2ca0e1 100644 --- a/crates/bump-versions.nu +++ b/crates/bump-versions.nu @@ -1,6 +1,6 @@ cd .. -let version = "0.1.1-alpha.3" +let version = "0.1.1-alpha.4" open Cargo.toml | update workspace.package.version $version | collect { save -f Cargo.toml } diff --git a/crates/eko/katex-header.toml b/crates/eko/katex-header.html similarity index 100% rename from crates/eko/katex-header.toml rename to crates/eko/katex-header.html diff --git a/crates/ekore/katex-header.toml b/crates/ekore/katex-header.html similarity index 100% rename from crates/ekore/katex-header.toml rename to crates/ekore/katex-header.html From b83d1bd5a16494a86724219bdba37261d84ce0f0 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Tue, 21 May 2024 13:08:23 +0200 Subject: [PATCH 21/37] build: Convert Nu script to python --- crates/bump-versions.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 crates/bump-versions.py diff --git a/crates/bump-versions.py b/crates/bump-versions.py new file mode 100644 index 000000000..571944123 --- /dev/null +++ b/crates/bump-versions.py @@ -0,0 +1,38 @@ +import json +from pathlib import Path + +import tomlkit + +HERE = Path(__file__).parent +CRATES = json.loads((HERE / "release.json").read_text()) + +VERSION = "0.1.1-alpha.5" + + +def workspace(manifest, version): + manifest["workspace"]["package"]["version"] = version + return manifest + + +def crate(manifest, version): + internals = set(manifest["dependencies"].keys()).intersection(CRATES) + for dep in internals: + manifest["dependencies"][dep]["version"] = version + return manifest + + +def update(path, version, edit): + path = HERE / Path(path) / "Cargo.toml" + manifest = tomlkit.parse(path.read_text()) + manifest = edit(manifest, version) + path.write_text(tomlkit.dumps(manifest)) + + +def main(): + update("..", VERSION, workspace) + for name in CRATES: + update(name, VERSION, crate) + + +if __name__ == "__main__": + main() From 4b29ceec7edcc361ddb6cc877382aa70e6dde36e Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Tue, 21 May 2024 13:21:31 +0200 Subject: [PATCH 22/37] build: Add poe script to bump versions --- flake.nix | 2 +- poetry.lock | 8 ++++---- pyproject.toml | 5 +++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index febe22228..ffed59900 100644 --- a/flake.nix +++ b/flake.nix @@ -21,7 +21,7 @@ perSystem = {pkgs, ...}: { devenv.shells.default = { - packages = with pkgs; [pre-commit maturin]; + packages = with pkgs; [pre-commit poethepoet maturin]; languages = { python = { diff --git a/poetry.lock b/poetry.lock index 0e7243979..b07cdc33c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3052,13 +3052,13 @@ files = [ [[package]] name = "tomlkit" -version = "0.12.4" +version = "0.12.5" description = "Style preserving TOML library" optional = false python-versions = ">=3.7" files = [ - {file = "tomlkit-0.12.4-py3-none-any.whl", hash = "sha256:5cd82d48a3dd89dee1f9d64420aa20ae65cfbd00668d6f094d7578a78efbb77b"}, - {file = "tomlkit-0.12.4.tar.gz", hash = "sha256:7ca1cfc12232806517a8515047ba66a19369e71edf2439d0f5824f91032b6cc3"}, + {file = "tomlkit-0.12.5-py3-none-any.whl", hash = "sha256:af914f5a9c59ed9d0762c7b64d3b5d5df007448eb9cd2edc8a46b1eafead172f"}, + {file = "tomlkit-0.12.5.tar.gz", hash = "sha256:eef34fba39834d4d6b73c9ba7f3e4d1c417a4e56f89a7e96e090dd0d24b8fb3c"}, ] [[package]] @@ -3216,4 +3216,4 @@ mark = ["banana-hep", "matplotlib", "pandas", "sqlalchemy"] [metadata] lock-version = "2.0" python-versions = "^3.9,<3.13" -content-hash = "0edd5a00d479078efaa77b4bd5f72810ba42a6d8d82a9460f1e2ace80d5d6851" +content-hash = "075575a682ab1f660b2dd3c0fc20b9c1a43ebb6e50d5d3a5d786a865810718fe" diff --git a/pyproject.toml b/pyproject.toml index 7404d8711..088cab323 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,6 +78,10 @@ asv = "^0.4.2" virtualenv = "^20.13.2" devtools = "^0.10.0" + +[tool.poetry.group.version.dependencies] +tomlkit = "^0.12.5" + [tool.poetry.extras] mark = ["banana-hep", "sqlalchemy", "pandas", "matplotlib"] box = ["rich", "click"] @@ -124,6 +128,7 @@ asv-publish = "asv publish --config benchmarks/asv.conf.json" asv-show = "asv show --config benchmarks/asv.conf.json" asv-clean = { "shell" = "rm -rf benchmarks/env benchmarks/html benchmarks/results" } asv = ["asv-run", "asv-publish", "asv-preview"] +bump-version = "python crates/bump-versions.py" [tool.pytest.ini_options] testpaths = ['tests/', 'benchmarks/'] From dde27b4fdef253a7b5f76cadf9b9209c3bb42f66 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Tue, 21 May 2024 15:05:00 +0200 Subject: [PATCH 23/37] ci: Rearrange crates deployment with python script --- .github/workflows/crates.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/crates.yml b/.github/workflows/crates.yml index fbad509cd..81a295dc1 100644 --- a/.github/workflows/crates.yml +++ b/.github/workflows/crates.yml @@ -14,17 +14,19 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Nushell - uses: hustcer/setup-nu@v3.10 + - uses: actions/setup-python@v5 + - name: Install and configure Poetry + uses: snok/install-poetry@v1 with: - version: 0.93.0 + virtualenvs-create: false + - name: Install task runner + run: pip install poethepoet - name: Bump versions - shell: nu {0} run: | - do { cd crates; nu bump-versions.nu } + poetry install --only version + poe bump-version - name: Publish crates - shell: nu {0} run: | - open crates/release.json | each {|p| cargo publish -p $p --allow-dirty } + jq '.[]' release.json | xargs -I _ cargo publish -p _ --allow-dirty env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} From 5138556fd53f76fedeb7fed205a0b829e4bc2b5d Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Tue, 21 May 2024 15:08:51 +0200 Subject: [PATCH 24/37] ci: Use virtual environment --- .github/workflows/crates.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/crates.yml b/.github/workflows/crates.yml index 81a295dc1..6b86c40cf 100644 --- a/.github/workflows/crates.yml +++ b/.github/workflows/crates.yml @@ -17,8 +17,6 @@ jobs: - uses: actions/setup-python@v5 - name: Install and configure Poetry uses: snok/install-poetry@v1 - with: - virtualenvs-create: false - name: Install task runner run: pip install poethepoet - name: Bump versions From bc7457a25c1fd644ea863613da2da48fb5459917 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Tue, 21 May 2024 15:09:21 +0200 Subject: [PATCH 25/37] ci: Remove bumping script in Nu --- crates/bump-versions.nu | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 crates/bump-versions.nu diff --git a/crates/bump-versions.nu b/crates/bump-versions.nu deleted file mode 100644 index 67b2ca0e1..000000000 --- a/crates/bump-versions.nu +++ /dev/null @@ -1,25 +0,0 @@ -cd .. - -let version = "0.1.1-alpha.4" - -open Cargo.toml | update workspace.package.version $version - | collect { save -f Cargo.toml } - -let crates = open crates/release.json - -def update-manifest [] { - let manifest = $in - let internals = $manifest | get dependencies | columns | where {|it| $it in $crates} - $internals | reduce --fold $manifest {|i, acc| - let field = $"dependencies.($i).version" | split row '.' | into cell-path - $acc | update $field $version - } -} - -def replace-manifest [] { - let path = $"crates/($in)/Cargo.toml" - open $path | update-manifest | to toml | collect { save -f $path } - $path -} - -$crates | each {|p| $p | replace-manifest} | prepend Cargo.toml From 5dc88357079bd1d68099a8c03c861e43befedc13 Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Tue, 21 May 2024 15:11:39 +0200 Subject: [PATCH 26/37] ci: Fix crates definition path --- .github/workflows/crates.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/crates.yml b/.github/workflows/crates.yml index 6b86c40cf..da2a45b98 100644 --- a/.github/workflows/crates.yml +++ b/.github/workflows/crates.yml @@ -25,6 +25,6 @@ jobs: poe bump-version - name: Publish crates run: | - jq '.[]' release.json | xargs -I _ cargo publish -p _ --allow-dirty + jq '.[]' crates/release.json | xargs -I _ cargo publish -p _ --allow-dirty env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} From 0cb7087ce89312fddc4d8a00a84b409ef02d3a79 Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Tue, 21 May 2024 17:39:10 +0300 Subject: [PATCH 27/37] rust: Fix pyproject patch --- pyproject.toml.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml.patch b/pyproject.toml.patch index 44b4c61e2..6e9d97689 100644 --- a/pyproject.toml.patch +++ b/pyproject.toml.patch @@ -1,5 +1,5 @@ diff --git a/pyproject.toml b/pyproject.toml -index 7404d871..3d19827b 100644 +index 088cab32..0d486637 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,20 @@ @@ -25,10 +25,10 @@ index 7404d871..3d19827b 100644 [tool.poetry] name = "eko" -@@ -124,6 +138,12 @@ asv-publish = "asv publish --config benchmarks/asv.conf.json" - asv-show = "asv show --config benchmarks/asv.conf.json" +@@ -129,6 +143,12 @@ asv-show = "asv show --config benchmarks/asv.conf.json" asv-clean = { "shell" = "rm -rf benchmarks/env benchmarks/html benchmarks/results" } asv = ["asv-run", "asv-publish", "asv-preview"] + bump-version = "python crates/bump-versions.py" +compile = "pip install -e crates/eko/" +rdocs.cmd = "cargo doc --workspace --no-deps" +rdocs.env = { RUSTDOCFLAGS = "--html-in-header crates/katex-header.html" } From 5ea144036328091d1b657be9b93f09dba0c66043 Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Wed, 22 May 2024 14:35:58 +0300 Subject: [PATCH 28/37] rust: Add fmt and clippy --- .pre-commit-config.yaml | 21 ++++++--------------- pyproject.toml | 2 ++ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6a799f3f3..718cfe85d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks ci: autofix_prs: false - skip: [fmt-eko, fmt-ekore] + skip: [fmt] # will be run by a separate CI repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 @@ -45,21 +45,12 @@ repos: - toml - repo: local hooks: - - id: fmt-eko - name: fmt-eko - description: Format eko files with cargo fmt. - entry: cargo fmt --manifest-path crates/eko/Cargo.toml -- + - id: fmt + name: fmt + description: Format Rust files with cargo fmt. + entry: cargo fmt -- language: system - files: ^crates/eko/.*\.rs$ - args: [] - - repo: local - hooks: - - id: fmt-ekore - name: fmt-ekore - description: Format ekore files with cargo fmt. - entry: cargo fmt --manifest-path crates/ekore/Cargo.toml -- - language: system - files: ^crates/ekore/.*\.rs$ + files: ^crates/.*\.rs$ args: [] - repo: https://github.com/pre-commit/pre-commit rev: v3.7.1 diff --git a/pyproject.toml b/pyproject.toml index 648d60c32..a47e3cefd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -135,6 +135,8 @@ rdocs.env = { RUSTDOCFLAGS = "--html-in-header crates/katex-header.html" } rdocs-view = "xdg-open target/doc/ekors/index.html" rdocs-clean = "rm -rf target/doc/" rtest = "cargo test --workspace" +fmtcheck = "cargo fmt --all -- --check" +clippy = "cargo clippy --no-deps" [tool.pytest.ini_options] testpaths = ['tests/', 'benchmarks/'] From 051847583e5ee26f9687f670a82b861ac55d9218 Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Wed, 22 May 2024 14:38:05 +0300 Subject: [PATCH 29/37] rust: Fix clippy warnings --- crates/eko/src/lib.rs | 28 ++++++++++++++++--------- crates/ekore/src/harmonics/cache.rs | 4 ++-- crates/ekore/src/harmonics/polygamma.rs | 1 + crates/ekore/src/harmonics/w1.rs | 2 +- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/crates/eko/src/lib.rs b/crates/eko/src/lib.rs index e6b3e44cc..a5dc15a6a 100644 --- a/crates/eko/src/lib.rs +++ b/crates/eko/src/lib.rs @@ -1,12 +1,14 @@ //! Interface to the eko Python package. -use ekore; use ekore::harmonics::cache::Cache; use std::ffi::c_void; mod mellin; /// QCD intergration kernel inside quad. +/// +/// # Safety +/// This is the connection from Python, so we don't know what is on the other side. #[no_mangle] pub unsafe extern "C" fn rust_quad_ker_qcd(u: f64, rargs: *mut c_void) -> f64 { let args = *(rargs as *mut QuadQCDargs); @@ -23,11 +25,11 @@ pub unsafe extern "C" fn rust_quad_ker_qcd(u: f64, rargs: *mut c_void) -> f64 { &mut c, args.nf, ); - for k in 0..args.order_qcd { - for l in 0..2 { - for m in 0..2 { - re.push(res[k][l][m].re); - im.push(res[k][l][m].im); + for gamma_s in res.iter().take(args.order_qcd) { + for col in gamma_s.iter().take(2) { + for el in col.iter().take(2) { + re.push(el.re); + im.push(el.im); } } } @@ -38,9 +40,9 @@ pub unsafe extern "C" fn rust_quad_ker_qcd(u: f64, rargs: *mut c_void) -> f64 { &mut c, args.nf, ); - for j in 0..args.order_qcd { - re.push(res[j].re); - im.push(res[j].im); + for el in res.iter().take(args.order_qcd) { + re.push(el.re); + im.push(el.im); } } // pass on @@ -127,7 +129,10 @@ pub struct QuadQCDargs { pub is_threshold: bool, } -/// empty placeholder function for python callback +/// Empty placeholder function for python callback. +/// +/// # Safety +/// This is the connection back to Python, so we don't know what is on the other side. pub unsafe extern "C" fn my_py( _re_gamma: *const f64, _im_gamma: *const f64, @@ -161,6 +166,9 @@ pub unsafe extern "C" fn my_py( /// /// This is required to make the arguments part of the API, otherwise it won't be added to the compiled /// package (since it does not appear in the signature of `quad_ker_qcd`). +/// +/// # Safety +/// This is the connection from and back to Python, so we don't know what is on the other side. #[no_mangle] pub unsafe extern "C" fn empty_qcd_args() -> QuadQCDargs { QuadQCDargs { diff --git a/crates/ekore/src/harmonics/cache.rs b/crates/ekore/src/harmonics/cache.rs index c79120def..b026e4f75 100644 --- a/crates/ekore/src/harmonics/cache.rs +++ b/crates/ekore/src/harmonics/cache.rs @@ -33,8 +33,8 @@ impl Cache { pub fn get(&mut self, k: K) -> Complex { let val = self.m.get(&k); // already there? - if val.is_some() { - return *val.unwrap(); + if let Some(value) = val { + return *value; } // compute new let val = match k { diff --git a/crates/ekore/src/harmonics/polygamma.rs b/crates/ekore/src/harmonics/polygamma.rs index 60c1de91a..f5236d8e9 100644 --- a/crates/ekore/src/harmonics/polygamma.rs +++ b/crates/ekore/src/harmonics/polygamma.rs @@ -3,6 +3,7 @@ use num::{complex::Complex, Zero}; use std::f64::consts::PI; +#[allow(clippy::excessive_precision, clippy::assign_op_pattern)] /// Compute the polygamma functions $\psi_k(z)$. /// /// Reimplementation of ``WPSIPG`` (C317) in [CERNlib](http://cernlib.web.cern.ch/cernlib/) given by [[KOLBIG1972221]][crate::bib::KOLBIG1972221]. diff --git a/crates/ekore/src/harmonics/w1.rs b/crates/ekore/src/harmonics/w1.rs index 2b861cb30..7de50bf0b 100644 --- a/crates/ekore/src/harmonics/w1.rs +++ b/crates/ekore/src/harmonics/w1.rs @@ -7,5 +7,5 @@ use crate::harmonics::polygamma::cern_polygamma; /// $$S_1(N) = \sum\limits_{j=1}^N \frac 1 j = \psi_0(N+1)+\gamma_E$$ /// with $\psi_0(N)$ the digamma function and $\gamma_E$ the Euler-Mascheroni constant. pub fn S1(N: Complex) -> Complex { - cern_polygamma(N + 1.0, 0) + 0.5772156649015328606065120 + cern_polygamma(N + 1.0, 0) + 0.577_215_664_901_532_9 } From 69d510458e604597e7586d552f9cc25939e1ead7 Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Wed, 22 May 2024 14:43:15 +0300 Subject: [PATCH 30/37] rust: Add fmt and clippy to CI --- .github/workflows/unittests-rust.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unittests-rust.yml b/.github/workflows/unittests-rust.yml index 9cce3048d..2b05cb4d6 100644 --- a/.github/workflows/unittests-rust.yml +++ b/.github/workflows/unittests-rust.yml @@ -3,13 +3,19 @@ name: Rust unit tests on: push jobs: - test-rust: + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 - name: Install task runner run: pip install poethepoet + - name: Run fmt + run: | + poe fmtcheck + - name: Run clippy + run: | + poe clippy - name: Run Rust unit tests run: | poe rtest From fe8a8db023e70ebf9cf69938f35055eb138cad3b Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Wed, 22 May 2024 15:03:59 +0300 Subject: [PATCH 31/37] rust: Attempt dynamic version resolution --- .github/workflows/crates.yml | 2 +- crates/bump-versions.py | 13 +++++++------ pyproject.toml | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/crates.yml b/.github/workflows/crates.yml index da2a45b98..631a0513a 100644 --- a/.github/workflows/crates.yml +++ b/.github/workflows/crates.yml @@ -3,7 +3,7 @@ name: Deploy Crates on: push: # TODO: remove branches - branches: ["*"] + # branches: ["*"] tags: - "*" workflow_dispatch: diff --git a/crates/bump-versions.py b/crates/bump-versions.py index 571944123..b0c3e9a44 100644 --- a/crates/bump-versions.py +++ b/crates/bump-versions.py @@ -1,4 +1,5 @@ import json +import sys from pathlib import Path import tomlkit @@ -6,8 +7,6 @@ HERE = Path(__file__).parent CRATES = json.loads((HERE / "release.json").read_text()) -VERSION = "0.1.1-alpha.5" - def workspace(manifest, version): manifest["workspace"]["package"]["version"] = version @@ -28,11 +27,13 @@ def update(path, version, edit): path.write_text(tomlkit.dumps(manifest)) -def main(): - update("..", VERSION, workspace) +def main(version): + update("..", version, workspace) for name in CRATES: - update(name, VERSION, crate) + update(name, version, crate) if __name__ == "__main__": - main() + if len(sys.argv) < 2: + raise ValueError(f"Pass version to {sys.argv[0]}") + main(sys.argv[1]) diff --git a/pyproject.toml b/pyproject.toml index a47e3cefd..33df1da37 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -128,7 +128,7 @@ asv-publish = "asv publish --config benchmarks/asv.conf.json" asv-show = "asv show --config benchmarks/asv.conf.json" asv-clean = { "shell" = "rm -rf benchmarks/env benchmarks/html benchmarks/results" } asv = ["asv-run", "asv-publish", "asv-preview"] -bump-version = "python crates/bump-versions.py" +bump-version = "python crates/bump-versions.py `git describe --tags`" compile = "pip install -e crates/eko/" rdocs.cmd = "cargo doc --workspace --no-deps" rdocs.env = { RUSTDOCFLAGS = "--html-in-header crates/katex-header.html" } From 17424887f3083a756eb01fafa473ebd631fc49dc Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Wed, 22 May 2024 15:13:59 +0300 Subject: [PATCH 32/37] rust: Fix poe bump-version --- crates/bump-versions.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bump-versions.py b/crates/bump-versions.py index b0c3e9a44..c87efa419 100644 --- a/crates/bump-versions.py +++ b/crates/bump-versions.py @@ -36,4 +36,4 @@ def main(version): if __name__ == "__main__": if len(sys.argv) < 2: raise ValueError(f"Pass version to {sys.argv[0]}") - main(sys.argv[1]) + main(sys.argv[1][1:]) diff --git a/pyproject.toml b/pyproject.toml index 33df1da37..cbd200cb5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -128,7 +128,7 @@ asv-publish = "asv publish --config benchmarks/asv.conf.json" asv-show = "asv show --config benchmarks/asv.conf.json" asv-clean = { "shell" = "rm -rf benchmarks/env benchmarks/html benchmarks/results" } asv = ["asv-run", "asv-publish", "asv-preview"] -bump-version = "python crates/bump-versions.py `git describe --tags`" +bump-version = { "shell" = "python crates/bump-versions.py $(git describe --tags)" } compile = "pip install -e crates/eko/" rdocs.cmd = "cargo doc --workspace --no-deps" rdocs.env = { RUSTDOCFLAGS = "--html-in-header crates/katex-header.html" } From 0be1e89edf163ad1a6259a4aa3cd5e661488a1e9 Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Wed, 22 May 2024 15:28:11 +0300 Subject: [PATCH 33/37] rust: Add comment to bumb-versions --- crates/bump-versions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/bump-versions.py b/crates/bump-versions.py index c87efa419..6b7220f7e 100644 --- a/crates/bump-versions.py +++ b/crates/bump-versions.py @@ -35,5 +35,6 @@ def main(version): if __name__ == "__main__": if len(sys.argv) < 2: - raise ValueError(f"Pass version to {sys.argv[0]}") + raise ValueError(f"Pass a version (e.g. v0.0.0) to {sys.argv[0]}") + # `git describe` starts with a `v` which we need to remove again main(sys.argv[1][1:]) From 94c8270fe6dc9221e1609d9de4cf474ba781467e Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Wed, 22 May 2024 15:40:13 +0300 Subject: [PATCH 34/37] Update crates/Readme --- crates/README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/README.md b/crates/README.md index 776a5ad07..baa27a087 100644 --- a/crates/README.md +++ b/crates/README.md @@ -1,6 +1,11 @@ -# Crates +# Welcome to the rusty side of EKO! -... +Here, we develop the Rust components of the EKO library + +## Crates + +- `ekore` contains the underlying collinear anomalous dimensions and the operator matrix elements +- `eko` is the glue between the Python side and the `ekore` crate ## Files @@ -9,3 +14,5 @@ - dependent crates should follow those they are depending on - `katex-header.html` is an HTML snippet to be included in every docs page to inject KaTeX support +- `bump-versions.py` increases the Rust versions in all crates consistently +- `make_bib.py` generates the Rust function stubs which serve as fake bibliography system From 909ad779d50ca20f9a328f0bdb4603714bf29342 Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Wed, 22 May 2024 16:03:15 +0300 Subject: [PATCH 35/37] Temporarily disable PyPI --- .github/workflows/crates.yml | 2 -- .github/workflows/maturin.yml | 2 -- .github/workflows/pypi.yml | 8 ++++---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/crates.yml b/.github/workflows/crates.yml index 631a0513a..935ce2aba 100644 --- a/.github/workflows/crates.yml +++ b/.github/workflows/crates.yml @@ -2,8 +2,6 @@ name: Deploy Crates on: push: - # TODO: remove branches - # branches: ["*"] tags: - "*" workflow_dispatch: diff --git a/.github/workflows/maturin.yml b/.github/workflows/maturin.yml index 9133adbe4..4680d0316 100644 --- a/.github/workflows/maturin.yml +++ b/.github/workflows/maturin.yml @@ -2,8 +2,6 @@ name: Deploy Maturin wheels on: push: - # TODO: remove branches - branches: ["*"] tags: - "*" workflow_dispatch: diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 45f89248b..774618f85 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -1,9 +1,9 @@ name: deploy -on: - push: - tags: - - "*" +# on: +# push: +# tags: +# - "*" jobs: publish: From 49233a5d6781b72ac3708d241bb326682e0f7629 Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Wed, 22 May 2024 16:15:02 +0300 Subject: [PATCH 36/37] Reactivate PyPI --- .github/workflows/pypi.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 774618f85..45f89248b 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -1,9 +1,9 @@ name: deploy -# on: -# push: -# tags: -# - "*" +on: + push: + tags: + - "*" jobs: publish: From af02fadc850954ead98d5657e362ec4e0ac95fd2 Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Thu, 30 May 2024 13:01:05 +0300 Subject: [PATCH 37/37] Fix clippy warnings --- .../src/anomalous_dimensions/unpolarized/spacelike/as3.rs | 3 +-- crates/ekore/src/bib.rs | 8 +++++++- crates/ekore/src/harmonics/cache.rs | 2 +- crates/ekore/src/harmonics/g_functions.rs | 2 +- crates/make_bib.py | 3 ++- pyproject.toml | 1 + 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/as3.rs b/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/as3.rs index b43608e01..14354f736 100644 --- a/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/as3.rs +++ b/crates/ekore/src/anomalous_dimensions/unpolarized/spacelike/as3.rs @@ -155,8 +155,7 @@ pub fn gamma_nsv(c: &mut Cache, nf: u8) -> Complex { + 46.18 * E2 ); - let result = gamma_nsm(c, nf) + (nf as f64) * ps2; - result + gamma_nsm(c, nf) + (nf as f64) * ps2 } /// Compute the pure-singlet quark-quark anomalous dimension. diff --git a/crates/ekore/src/bib.rs b/crates/ekore/src/bib.rs index 167294b41..75da707bb 100644 --- a/crates/ekore/src/bib.rs +++ b/crates/ekore/src/bib.rs @@ -1,5 +1,6 @@ -//! List of References (autogenerated on 2024-04-25T18:22:43.797877). +//! List of References (autogenerated on 2024-05-30T12:57:15.459698). +#[allow(non_snake_case)] /// The Three loop splitting functions in QCD: The Nonsinglet case /// /// Moch, S. and Vermaseren, J. A. M. and Vogt, A. @@ -11,6 +12,7 @@ /// DOI: [10.1016/j.nuclphysb.2004.03.030](https:dx.doi.org/10.1016/j.nuclphysb.2004.03.030) pub fn Moch2004pa() {} +#[allow(non_snake_case)] /// The Three-loop splitting functions in QCD: The Singlet case /// /// Vogt, A. and Moch, S. and Vermaseren, J. A. M. @@ -22,6 +24,7 @@ pub fn Moch2004pa() {} /// DOI: [10.1016/j.nuclphysb.2004.04.024](https:dx.doi.org/10.1016/j.nuclphysb.2004.04.024) pub fn Vogt2004mw() {} +#[allow(non_snake_case)] /// Programs for computing the logarithm of the gamma function, and the digamma function, for complex argument /// /// K.S. Kölbig @@ -33,6 +36,7 @@ pub fn Vogt2004mw() {} /// DOI: [https://doi.org/10.1016/0010-4655(72)90012-4](https://doi.org/10.1016/0010-4655(72)90012-4) pub fn KOLBIG1972221() {} +#[allow(non_snake_case)] /// Multi‐precision Laplace transform inversion /// /// Abate, J. and Valkó, P. @@ -44,6 +48,7 @@ pub fn KOLBIG1972221() {} /// DOI: [10.1002/nme.995](https:dx.doi.org/10.1002/nme.995) pub fn Abate() {} +#[allow(non_snake_case)] /// Resummations of Transverse Momentum Distributions /// /// Muselli, Claudio @@ -55,6 +60,7 @@ pub fn Abate() {} /// DOI: [10.13130/muselli-claudio_phd2017-12-01](https:dx.doi.org/10.13130/muselli-claudio_phd2017-12-01) pub fn MuselliPhD() {} +#[allow(non_snake_case)] /// Efficient evolution of unpolarized and polarized parton distributions with QCD-PEGASUS /// /// Vogt, A. diff --git a/crates/ekore/src/harmonics/cache.rs b/crates/ekore/src/harmonics/cache.rs index 0fed95258..1342f5175 100644 --- a/crates/ekore/src/harmonics/cache.rs +++ b/crates/ekore/src/harmonics/cache.rs @@ -87,7 +87,7 @@ pub fn recursive_harmonic_sum( ) -> Complex { let mut fact = Complex::zero(); for i in 1..iterations + 1 { - fact = fact + (1.0 / (n + (i as f64))).powu(weight); + fact += (1.0 / (n + (i as f64))).powu(weight); } base_value + fact } diff --git a/crates/ekore/src/harmonics/g_functions.rs b/crates/ekore/src/harmonics/g_functions.rs index ff0f8789f..cfde9e9ea 100644 --- a/crates/ekore/src/harmonics/g_functions.rs +++ b/crates/ekore/src/harmonics/g_functions.rs @@ -18,7 +18,7 @@ pub fn g3(N: Complex, S1: Complex) -> Complex { let mut g3 = Complex::zero(); for cit in CS.iter().enumerate() { let Nj = N + (cit.0 as f64); - g3 = g3 + (*cit.1) * (ZETA2 - s(S1, N, cit.0, 1) / Nj) / Nj; + g3 += (*cit.1) * (ZETA2 - s(S1, N, cit.0, 1) / Nj) / Nj; } g3 } diff --git a/crates/make_bib.py b/crates/make_bib.py index df5437a04..e758c41ad 100644 --- a/crates/make_bib.py +++ b/crates/make_bib.py @@ -10,7 +10,8 @@ BIBFILE = pathlib.Path(__file__).parent / "ekore" / "refs.bib" # A single entry -ENTRY = """/// {title} +ENTRY = """#[allow(non_snake_case)] +/// {title} /// /// {author} /// diff --git a/pyproject.toml b/pyproject.toml index cbd200cb5..89ef66c71 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -137,6 +137,7 @@ rdocs-clean = "rm -rf target/doc/" rtest = "cargo test --workspace" fmtcheck = "cargo fmt --all -- --check" clippy = "cargo clippy --no-deps" +rbib = { "shell" = "python crates/make_bib.py > crates/ekore/src/bib.rs" } [tool.pytest.ini_options] testpaths = ['tests/', 'benchmarks/']