Getting started with Python


    We provide this guide in order to help our users learn all they need to start developing their Python applications at SourceLair.

    This guide assumes that you already have:

    Here we will focus mainly on how to develop command-line Python applications on SourceLair. If you are interested into learning how to develop Python web applications at SourceLair, take a look at our our Django guide.


    Creating a new Generic project will provide you with everything you need to get started. The only thing you have to do after that to get started is create your first Python file, by adding the .py extension.

    If you would like a more complete example to get started with Python on SourceLair, visit this URL to create your project

    Installing dependencies

    The easiest way to install a dependency for your project is by running the following command in your terminal:

    pipenv install mypackage

    E.g. pipenv install requests.

    Auto complete

    SourceLair provides you with intelligent as-you-type auto complete for your Python files. This feature is enabled by default; whenever you type, when editing a Python file, SourceLair will display code suggestions for you that save you time from typing.

    To disable the as-you-type auto complete open up your Control Panel, navigate to your Editor Settings and just uncheck the Show suggestions on keystroke option. To display suggestions manually afterwards just hit Ctrl + Space when you need them.

    Error reporting

    Our editor will automatically check your Python file for syntax errors when you save it and display all errors and warning in the left side of the editor, next to the line number. This way you can produce better and safer code, since you do not have to run your application before correcting your mistakes.

    If you find this feature too intrusive for you, just navigate to your Editor Settings and switch the Python linting option off.

    Choosing default Python version

    SourceLair ships with Python 3 (which is the default) and Python 2 support, so you can choose the one that suits you better, when creating our project.

    More information about Python on SourceLair can be found at

    Tips for Python

    Last we would like to share with you some great tips that can make Python development much more pleasant:

    • By pressing Alt and clicking on a class or method name, it will open up the file where this class or method is defined and scroll you down to this position
    • Add *.pyc in its own line in .gitignore, to avoid committing Python bytecode files into Git
    • Add the following entries in your .editorconfig file's [*] section, to facilitate collaboration in Python projects:
      • indent_style = space and indent_size = 4 to standardize indentation to 4 spaces
      • max_line_length = 80 to put a ruler in your editor and know when a line of code is too big
    • Do everything from your keyboard with the Command Palette: Press Ctrl + Shift + P on your PC or Cmd + Shift + P on your Mac
    • Open files rapid-fast from your keyboard: Press Ctrl + Shift + O on your PC or Cmd + Shift + O on your Mac


    So that was it! Now you are ready to start developing your Python apps in SourceLair.

    If you have any questions or run into any trouble remember to use the Help: Contact us command from the Command Palette.