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
Updated: 05.11.2024 | Replaces PythonStubs.zip: All stub files are up to date with Vertec 6.7.0.8.

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, we supply stub files of the built-in Vertec modules vtcapp , vtcextensions and ziputils, from Vertec 6.6 the stub files vtcplanning , vtcplanningcore and reporting and from Vertec 6.7.0.7 the Stub File vtccom with. These are placed in the subfolder Pythonstubs in the Vertec installation directory. Alternatively you can download the Stub Files here:

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. Install the latest version of Pylance in Visual Studio Code using the keyboard shortcut Ctrl+Shift+P and click on Install Extension > Pylance installieren . You
    may see a question about the Default Language. Answer it with Yes and reload .
  2. To save the Vertec Stub folder in the settings, open with the shortcut Ctrl+Shift+P the Command Line Interface.
  3. Type Settings and select the option Open Settings (JSON) .
  4. Enter the path to the Vertec Stub Files in the code python.analysis.stubPath one:

    To copy the code:
    “python.languageServer”: “Pylance,”
    “python.pythonPath”: “C:\\Python27\\python.exe,”
    “python.analysis.stubPath”: “C:\\ProgramFiles\\Vertec\\PythonStubs,”
  5. Verify that as a Language Server Pylance is registered (the current version was installed with point 1).

  6. Restart Visual Studio Code.

For this to work in your script, import the desired module, 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
Bitte wählen Sie Ihren Standort