You can use dolfinx.Expression as shown in
dolfinx.Expression
Some nicer front-end UI will hopefully be merged soon with: Interpolation of ufl expressions by jorgensd · Pull Request #1875 · FEniCS/dolfinx · GitHub