spu icon indicating copy to clipboard operation
spu copied to clipboard

[Bug]: SPU codes can not normally jump and automatically expand function in VScode

Open TY-cc opened this issue 1 year ago • 4 comments

Issue Type

Support

Modules Involved

SPU runtime

Have you reproduced the bug with SPU HEAD?

Yes

Have you searched existing issues?

Yes

SPU Version

0.9.3

OS Platform and Distribution

linux ubuntu 22.04

Python Version

Python 3.10.4

Compiler Version

GCC 11.4

Current Behavior?

I am currently leanring SPU code in VScode. But it can not normally jump and automatically expand function in VScode. as the picture: image It point out "xxxx" is not a known attribute of module "spu.spu_pb2"Pylance[reportAttributeAccessIssue] (function) xxxx: Unknown How to solve this problem?

Standalone code to reproduce the issue

This code is the jnp_debug.py [https://github.com/secretflow/spu/blob/main/spu/tests/jnp_debug.py](url)
import numpy as np

import spu.intrinsic as si
import spu.spu_pb2 as spu_pb2
import spu.utils.simulation as ppsim
im = ppsim.Simulator.simple(3, spu_pb2.ProtocolKind.CHEETAH, spu_pb2.FieldType.FM64)
copts = spu_pb2.CompilerOptions()
# Tweak compiler options
copts.disable_div_sqrt_rewrite = True

Relevant log output

`"ProtocolKind" is not a known attribute of module "spu.spu_pb2"Pylance[reportAttributeAccessIssue]
(function) ProtocolKind: Unknown`

`"FieldType" is not a known attribute of module "spu.spu_pb2"Pylance[reportAttributeAccessIssue]
(function) FieldType: Unknown`

`"CompilerOptions" is not a known attribute of module "spu.spu_pb2"Pylance[reportAttributeAccessIssue]
(function) CompilerOptions: Unknown`

TY-cc avatar Sep 19 '24 03:09 TY-cc

These files are auto generated during build. For VSCode to find these files, build a wheel package and install in the python env.

anakinxc avatar Sep 24 '24 03:09 anakinxc

Sorry, I don't know much about this. I haven't found any relevant guidance on historical issues and the Internet. Can you provide some guidance and help?

TY-cc avatar Sep 25 '24 06:09 TY-cc

see https://github.com/secretflow/spu/blob/main/libspu/spu.proto. Protobuf compiler will generate these files during building.

tpppppub avatar Sep 25 '24 08:09 tpppppub

Thank for your reply,I had found this file. But I can't understand how to use this file to solve the follow problems, Can you give me a sample?

TY-cc avatar Sep 29 '24 01:09 TY-cc

Stale issue message. Please comment to remove stale tag. Otherwise this issue will be closed soon.

github-actions[bot] avatar Oct 29 '24 09:10 github-actions[bot]