Skip to content

Specific pip package (and its associated modules) "upbge-stubs" #1825

Closed

Description

@ItsCubeTime

So, theres this package https://pypi.org/project/upbge-stubs/ which comes with a set of modules created entirely for syntax highlighting when developing with the game engine "Uchronia Project Blender Game Engine".

Supposedly the package should allow for syntax highlighting with PyCharm in a Linux environment without issues (according to the creator of the package). I cant get it working with a fresh install of VS Code & Python on Windows 10.

Cant quite figure out what the issue is, but funny enough, even VS Codes Python Extension appears to recognize the submodules when typing "import bge.", but not when you actually attempt using any of the modules.

To demonstrate this:

kkCo18gbGF.mp4

Now, Im not certain exactly why this particular package isnt being interpreted properly by the python extension, but any knowledge on the topic would be appreciated, its unclear if there are any potential bugs related to VS Codes python extension that prevents the module from loading properly.

Environment data

  • VS Code version: XXX
  • Extension version (available under the Extensions sidebar):
    v2021.9.1230869389
  • OS and version: Windows 10 v 10.0.19042.1165
  • Python version (& distribution if applicable, e.g. Anaconda): From Python.org: Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] on win32
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): pipenv or no environment (doesnt appear to affect the issue)
  • Relevant/affected Python packages and their versions: https://pypi.org/project/upbge-stubs/
  • Relevant/affected Python-related VS Code extensions and their versions: "Python" by Microsoft
  • Value of the python.languageServer setting: "python.languageServer": "Pylance",

Expected behaviour

I expect code completion to be fully functional

Actual behaviour

I have no code completion and operations such as "Go to reference" results in "no definition for ..."

Steps to reproduce:

Install a fresh install version of VS Code in a self contained environment (or well, that would be the ideal scenario as I have no clue at all why I dont quite get autocomplete for this module working.

Install Python v 3.9.6 from Python.org, double check that your path is correct and configure VS Code to utelize this newly installed interpreter (view > cmd palette > select py intepreter > 3.9.6).

Run pip install upbge-stubs.

Create a new python file and add:

import bge

notice how if you start typing something like bge. you will get no syntax code completion - but, ironically, if you type import bge. you will get code completion - only when importing, but not when attempting to access the bge module as a separate expression.

Activity

  1. erictraut commented on Sep 16, 2021

    @erictraut
    Contributor

    The stub files indicate that no symbols are exported from the top-level module bge. You need to import submodules (like bge.app or bge.constraints).

    If you believe that symbols should be exported from the top-level bge module, you should reach out to the maintainers of the upbge-stubs package and report the bug. They would need to include a top-level __init__.pyi file the re-exports the appropriate symbols.

  2. ItsCubeTime commented on Sep 16, 2021

    @ItsCubeTime
    Author

    Hi and thanks for the reply Eric Traut (@erictraut) !

    I can confirm that doing something like "from bge import logic" appears to work like expected:

    image

    Ive sent a link to this issue to the project maintainer of upbge-stubs, I will leave this open until he gets a chance to stop by

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions