Python Stub Files for builtin modules

Vertec Python Stub Files for use in code editors

Product line

Standard

|

Expert

Operating mode

CLOUD ABO

|

ON-PREMISES

Modules

Services & CRM

Budget & Phases

Purchases

Resource Planning

Business Intelligence

Created: 10.12.2020
Machine translated
Updated: 05.11.2024 | Adapted wording for cloud subscription customers and installation instructions.

Many code editors, such as Visual Studio Code, have static analysis capabilities to detect errors before execution.

In order to make the Vertec Python modules available for the Type Checker, from version 6.4.0.15 onwards we supply stub files of the built-in Vertec Modules vtcapp , vtcextensions and ziputils, from Vertec 6.6 onwards the stub files vtcplanning, vtcplanningcore and reporting and from Vertec 6.7.0.7 the Stub File vtccom with.

For on-premises customers, these are stored in the subfolder PythonStubs in the Vertec installation directory.

Cloud subscription customers can download the stub files here and save them locally:

Pythonstubs.zip

You can then import them in the Code Editor.

How this is done is explained here using the example Visual Studio Code.

  1. In Visual Studio Code, install the up-to-date version of Pylance by clicking on Manage (gear icon) on the left and selecting Extensions. Select Pylance and click on Install. You
    may see a question about the Default Language. Answer it with Yes and reload.
  2. Python 2.7 support is required. To do this, you need to install the Python Extension.
  3. To save the Vertec Stub folder in the settings, click Manage on the left again and select Settings.
  4. Type Python enter and select Extensions> Pylance. Enter the path to your Vertec Stub Files, e.g.:
  5. Then select the subdirectory on the left in the same place Python and check that as a Language Server Pylance is registered:
  6. Restart Visual Studio Code.

The required module must be imported into the scripts, e.g. vtcapp:

import vtcapp

Special features of the reporting.py Stub File

From Vertec 6.6 we deliver with reporting.py also a Python Stub File for the Python code for office reports with.

This must be imported for use as usual: from reporting import *

The methods that must be declared in the Office Report Code itself (e.g. def initialize_row(context, row)), are included in the Stub File, but only as a documentation aid (since the method is not simply used, but has to be declared itself).

In order for the context -Variable works, the following type annotation must be used in Python (example):

def calc_table(context):
    # type: (Context) -> Table