@@ -10,3 +10,110 @@ See [docs/](docs/) for more information.
1010
1111[ pypi-badge ] : https://img.shields.io/pypi/v/sphinx-rust.svg
1212[ pypi-link ] : https://pypi.org/project/sphinx-rust
13+
14+ ## Fork notes
15+
16+ ### Integration, usage and testing
17+
18+ ** CURRENTLY FORK UNDER DEVELOPMENT! - PIP PACKAGE UNAVAILABLE**
19+
20+ * In order to integrate in score:
21+
22+ Update score/docs/conf.py :
23+
24+ ``` python
25+ extensions = [
26+ " sphinx_rust" ,
27+ ...
28+ ]
29+
30+ # point to a rust crate in score(create a dummy one for testing if unavailable)
31+ rust_crates = [
32+ " ../rust-crates/dummy_crate" ,
33+ ]
34+ ```
35+ In index.rst :
36+ ```
37+ Rust API <api/crates/dummy_crate/index>
38+ ```
39+
40+ * Testing in score repo:
41+
42+ For fast development it is recomended to convert sphinx-rust module to bazel module by creating:
43+
44+ - __ sphinx-rust__ /BUILD.bazel:
45+
46+ ``` python
47+ load(" @rules_python//python:defs.bzl" , " py_library" )
48+
49+ py_library(
50+ name = " sphinx_rust" ,
51+ srcs = glob([" python/sphinx_rust/**/*.py" ]),
52+ data = glob([
53+ " python/sphinx_rust/sphinx_rust.cpython-312-*.so" ,
54+ ]),
55+ imports = [" python" ],
56+ visibility = [" //visibility:public" ],
57+ )
58+ ```
59+
60+ - __ sphinx-rust__ /MODULE.bazel
61+
62+ ``` python
63+ module(name = " sphinx_rust" , version = " 0.0.0-dev" )
64+ bazel_dep(name = " rules_python" , version = " 1.4.1" )
65+ ```
66+
67+ Now we can add the __ sphinx_rust__ module directly in __ score__ :
68+
69+ - __ score__ /MODULE.bazel:
70+
71+ ``` python
72+ bazel_dep(name = " sphinx_rust" , version = " 0.0.0-dev" )
73+ local_path_override(module_name = " sphinx_rust" , path = " ../sphinx-rust" )
74+ ```
75+
76+ - create the dummy_crate in __ score__ with the following structure and content:
77+
78+ ``` sh
79+ ../score/rust-crates/
80+ └── dummy_crate
81+ ├── Cargo.toml
82+ └── src
83+ └── lib.rs
84+ ```
85+
86+ Cargo.toml:
87+
88+ ``` yaml
89+ [package]
90+ name = "dummy_crate"
91+ version = "0.1.0"
92+ edition = "2021"
93+
94+ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
95+
96+ [dependencies]
97+
98+ [lib]
99+ name = "dummy_crate"
100+ ```
101+
102+ lib.rs:
103+
104+ ``` rs
105+ pub fn add (left : usize , right : usize ) -> usize {
106+ left + right
107+ }
108+
109+ #[cfg(test)]
110+ mod tests {
111+ use super :: * ;
112+
113+ #[test]
114+ fn it_works () {
115+ let result = add (2 , 2 );
116+ assert_eq! (result , 4 );
117+ }
118+ }
119+ ```
0 commit comments