`import_from` is gone. Still in docs
Documentation (dev) seems out of date.
It still lists the method import_from in the reference API,
but it's gone and not exported in SymPyCore.
Here is what I used to do (see #385)
begin
using SymPy
import PyCall
PyCall.pyimport_conda("sympy.physics.wigner", "sympy")
import_from(sympy.physics.wigner)
end
Now, it throws an error.
UndefVarError: `import_from` not defined in `Main.var"workspace#29"`
Suggestion: check for spelling errors or missing imports.
I was confused who suppose to export this method: SymPy, SymPyCode, or PyCall.
[91a5bcdd] Plots v1.40.13
[438e738f] PyCall v1.96.4
[24249f21] SymPy v2.3.3
[44cfe95a] Pkg v1.11.0
Here is my work around
macro bind_pyfunc(jlname, pymod, pyn)
esc(:( $(jlname)(ex, args...; kwargs...) = $(pymod).$(pyn)(ex, args...; kwargs...) ))
end
binding symbols similarly as it used to work with import_from
begin
@bind_pyfunc wignerD sympy.physics.quantum.spin WignerD
@bind_pyfunc clebsch_gordan sympy.physics.wigner clebsch_gordan
end
Sorry to be so tardy in response.
I lost track of when that got removed (it was breaking), but the automatic importing of names was removed. The workaround you have should be documented. I'll look into it and add your method as a possible suggestion.
Thanks
Here is the new snippet:
## External packages
Using packages from the sympy ecosphere not imported into `SymPyCore` requires calling into the `_pyimport` method of the underlying module. Depending on which is being used. The following shows how the `WignerD` method can be called from the `sympy.physics.quantum.spin` module under `SymPyPythonCall`.
julia> spin = SymPyPythonCall._pyimport("sympy.physics.quantum.spin")
Julia> WignerD = spin.WignerD(1,1,0, pi, pi/2, 0) Python: WignerD(1, 1, 0, 3.14159265358979, 1.5707963267949, 0)
This example flushes out some idiosyncracies: passing `PI` errors; the output is a python reference, call `Sym` to get a symbolic one.