From 7339be81cbc7da034bace33ffc7b97f97fdb5cda Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Thu, 16 May 2024 12:38:41 +0300 Subject: [PATCH 1/2] rust: Drop katexit --- crates/Cargo.lock | 48 ------------------------- crates/eko/Cargo.toml | 1 - crates/eko/src/mellin.rs | 1 - crates/ekore/Cargo.toml | 1 - crates/ekore/src/constants.rs | 4 --- crates/ekore/src/harmonics/cache.rs | 1 - crates/ekore/src/harmonics/polygamma.rs | 1 - 7 files changed, 57 deletions(-) diff --git a/crates/Cargo.lock b/crates/Cargo.lock index b6d5d084d..0e6acc14f 100644 --- a/crates/Cargo.lock +++ b/crates/Cargo.lock @@ -36,7 +36,6 @@ name = "eko" version = "0.1.0" dependencies = [ "ekore", - "katexit", "num", ] @@ -46,7 +45,6 @@ version = "0.1.0" dependencies = [ "float-cmp", "hashbrown", - "katexit", "num", ] @@ -69,17 +67,6 @@ dependencies = [ "allocator-api2", ] -[[package]] -name = "katexit" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1304c448ce2c207c2298a34bc476ce7ae47f63c23fa2b498583b26be9bc88c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "num" version = "0.4.1" @@ -162,41 +149,6 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" -[[package]] -name = "proc-macro2" -version = "1.0.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" - [[package]] name = "version_check" version = "0.9.4" diff --git a/crates/eko/Cargo.toml b/crates/eko/Cargo.toml index 50aee6504..2e5beca41 100644 --- a/crates/eko/Cargo.toml +++ b/crates/eko/Cargo.toml @@ -9,5 +9,4 @@ crate-type = ["cdylib"] [dependencies] num = "0.4.1" -katexit = "0.1.4" ekore = { version = "0.1.0", path = "../ekore" } diff --git a/crates/eko/src/mellin.rs b/crates/eko/src/mellin.rs index 5afc96f5f..f2f968fe4 100644 --- a/crates/eko/src/mellin.rs +++ b/crates/eko/src/mellin.rs @@ -6,7 +6,6 @@ use num::complex::Complex; use std::f64::consts::PI; -#[cfg_attr(doc, katexit::katexit)] /// Talbot inversion path. /// /// Implements the algorithm presented in [\[Abate\]](crate::bib::Abate). diff --git a/crates/ekore/Cargo.toml b/crates/ekore/Cargo.toml index ef8499dba..4c66a00f1 100644 --- a/crates/ekore/Cargo.toml +++ b/crates/ekore/Cargo.toml @@ -10,5 +10,4 @@ license = "GPL-3.0-or-later" [dependencies] num = "0.4.1" float-cmp = "0.9.0" -katexit = "0.1.4" hashbrown = "0.14" diff --git a/crates/ekore/src/constants.rs b/crates/ekore/src/constants.rs index 3cdd13a15..bfe44fe9c 100644 --- a/crates/ekore/src/constants.rs +++ b/crates/ekore/src/constants.rs @@ -1,24 +1,20 @@ //! Global constants. -#[cfg_attr(doc, katexit::katexit)] /// The number of colors. /// /// Defaults to $N_C = 3$. pub const NC: u8 = 3; -#[cfg_attr(doc, katexit::katexit)] /// The normalization of fundamental generators. /// /// Defaults to $T_R = 1/2$. pub const TR: f64 = 1.0 / 2.0; -#[cfg_attr(doc, katexit::katexit)] /// Second Casimir constant in the adjoint representation. /// /// Defaults to $C_A = N_C = 3$. pub const CA: f64 = NC as f64; -#[cfg_attr(doc, katexit::katexit)] /// Second Casimir constant in the fundamental representation. /// /// Defaults to $C_F = \frac{N_C^2-1}{2N_C} = 4/3$. diff --git a/crates/ekore/src/harmonics/cache.rs b/crates/ekore/src/harmonics/cache.rs index 6ad72171d..c79120def 100644 --- a/crates/ekore/src/harmonics/cache.rs +++ b/crates/ekore/src/harmonics/cache.rs @@ -5,7 +5,6 @@ use num::complex::Complex; use crate::harmonics::w1; -#[cfg_attr(doc, katexit::katexit)] /// List of available elements. #[derive(Debug, PartialEq, Eq, Hash)] pub enum K { diff --git a/crates/ekore/src/harmonics/polygamma.rs b/crates/ekore/src/harmonics/polygamma.rs index efbdae147..60c1de91a 100644 --- a/crates/ekore/src/harmonics/polygamma.rs +++ b/crates/ekore/src/harmonics/polygamma.rs @@ -3,7 +3,6 @@ use num::{complex::Complex, Zero}; use std::f64::consts::PI; -#[cfg_attr(doc, katexit::katexit)] /// 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]. From a5eb84093f3098ce3b6e5aa4077fc10918a3a7c7 Mon Sep 17 00:00:00 2001 From: Felix Hekhorn Date: Thu, 16 May 2024 12:44:04 +0300 Subject: [PATCH 2/2] Activate global KaTeX --- crates/eko/Cargo.toml | 3 + crates/ekore/Cargo.toml | 3 + crates/katex-header.html | 19 + pyproject.toml.patch | 7 +- rustify.sh | 6 +- src/eko/evolution_operator/__init__.py.patch | 56 +- .../eko/evolution_operator/test_init.py.patch | 601 ------------------ 7 files changed, 72 insertions(+), 623 deletions(-) create mode 100644 crates/katex-header.html delete mode 100644 tests/eko/evolution_operator/test_init.py.patch diff --git a/crates/eko/Cargo.toml b/crates/eko/Cargo.toml index 2e5beca41..731e1399c 100644 --- a/crates/eko/Cargo.toml +++ b/crates/eko/Cargo.toml @@ -3,6 +3,9 @@ name = "eko" version = "0.1.0" edition = "2021" +[package.metadata.docs.rs] +rustdoc-args = [ "--html-in-header", "../katex-header.html" ] + [lib] name = "ekors" crate-type = ["cdylib"] diff --git a/crates/ekore/Cargo.toml b/crates/ekore/Cargo.toml index 4c66a00f1..9dfdb7515 100644 --- a/crates/ekore/Cargo.toml +++ b/crates/ekore/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" description = "EKO expressions" license = "GPL-3.0-or-later" +[package.metadata.docs.rs] +rustdoc-args = [ "--html-in-header", "../katex-header.html" ] + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/katex-header.html b/crates/katex-header.html new file mode 100644 index 000000000..ff018b9c3 --- /dev/null +++ b/crates/katex-header.html @@ -0,0 +1,19 @@ + + + + diff --git a/pyproject.toml.patch b/pyproject.toml.patch index 7fb6fd672..8e9119a23 100644 --- a/pyproject.toml.patch +++ b/pyproject.toml.patch @@ -1,5 +1,5 @@ diff --git a/pyproject.toml b/pyproject.toml -index 31be6cb0..b4ec7c95 100644 +index 7404d871..a1e3ae66 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,20 @@ @@ -25,12 +25,13 @@ index 31be6cb0..b4ec7c95 100644 [tool.poetry] name = "eko" -@@ -124,6 +138,11 @@ asv-publish = "asv publish --config benchmarks/asv.conf.json" +@@ -124,6 +138,12 @@ 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"] +compile = "pip install -e crates/eko/" -+rdocs = "cargo doc --workspace --manifest-path crates/Cargo.toml --no-deps" ++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" diff --git a/rustify.sh b/rustify.sh index 05078d0b7..7e99996f0 100755 --- a/rustify.sh +++ b/rustify.sh @@ -1,5 +1,9 @@ #!/usr/bin/bash +# git diff --merge-base master pyproject.toml > pyproject.toml.patch patch -p1 src/eko/evolution_operator/__init__.py.patch patch -p1