2

I'm currently using a python module called petsc4py (https://pypi.org/project/petsc4py/). My main issue is that none of the typical intellisense features seems to work with this module.

I'm guessing it might have something to do with it being a C extension module, but I am not sure exactly why this happens. I initially thought that intellisense was unable to look inside ".so" files, but it seems that numpy is able to do this with the array object, which in my case is inside a file called multiarray.cpython-37m-x86_64-linux-gnu (check example below).

Does anyone know why I see this behaviour in the petsc4py module. Is there anything that I (or the developers of petsc4py) can do to get intellisense to work?

Example:

import sys
import petsc4py
petsc4py.init(sys.argv)
from petsc4py import PETSc

x_p = PETSc.Vec().create()
x_p.setSizes(10)
x_p.setFromOptions()

u_p = x_p.duplicate()


import numpy as np

x_n = np.array([1,2,3])
u_n = x_n.copy()

In this example, when trying to work with a Vec object from petsc4py, doing u_p.duplicate() cannot find the function and the suggestion is simply a repetition of the function immediately before. However, using an array from numpy, doing u_n.copy() works perfectly.

example with petsc4py example with numpy

Miguel
  • 1,293
  • 1
  • 13
  • 30

1 Answers1

0

If you're compiling in-place then you're bumping up against https://github.com/microsoft/python-language-server/issues/197.

Brett Cannon
  • 14,438
  • 3
  • 45
  • 40