Wrapping proc macro with another macro for compile-time python

Hi, I would like to use a compile-time python crate to do some complex computation(which is extremely tricky to rewrite with rust).

I have checked that the concept kind of works with literal input, but can't wrap it with another macro. Basically the first of below works, but the second doesn't (which is what I want);

// This works
let x =  ct_python! {
                import numpy as np
                num = np.array([0., 1.])
                print("{}".format(np.array2string(num, precision=16, floatmode="unique", separator=", ")))
            };

// This does not
macro_rules! wrapped_call {
        ($x:tt) => {
            ct_python! {
                import numpy as np
                num = np.array($x)
                print("{}".format(np.array2string(num, precision=16, floatmode="unique", separator=", ")))
            }
        };
    }

let x = wrapped_call!([0., 1.]);

with following compiler error

error: python: invalid syntax (signal_proc.rs, line 147)
   --> src/signal_proc.rs:137:13
    |
135 | /       macro_rules! wrapped_call {
136 | |           ($x:tt) => {
137 | | /             ct_python! {
138 | | |                 import numpy as np
139 | | |                 num = np.array($x)
140 | | |                 print("{}".format(np.array2string(num, precision=16, floatmode="unique", separator=", ")))
141 | | |             }
    | | |             ^ in this macro invocation (#2)
    | | |_____________|
    | |
142 | |           };
143 | |       }
    | |_______- in this expansion of `wrapped_call!` (#1)
...
147 |             let x = wrapped_call!([0., 1.]);
    |                     ----------------------- in this macro invocation (#1)
    |
   ::: /Users/<username>/.cargo/registry/src/github.com-1ecc6299db9ec823/inline-python-macros-0.10.0/src/lib.rs:118:1
    |
118 |     pub fn ct_python(input: TokenStream1) -> TokenStream1 {
    |     ----------------------------------------------------- in this expansion of `ct_python!` (#2)

How could I do this kind of wrapping?
Do I need a function like a proc macro?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.