Skip to main content

python packaging tutorial

Project description

exampleDSL for reference

Optional: check python packages

  • update package manager tools
    • python -m pip install --upgrade pip setuptools wheel
  • check if python package virtualenv is installed if Python < 3.3 is used else a subset of it has been integrated into the standard library under venv
    • python -m pip show virtualenv
    • if not install package virtualenv into global system environment
      • python -m pip install virtualenv

Install Server Dependencies

  • generate virtual environment in directory .venv using the standard library venv
    • python -m venv .venv
    • alternative use virtualenv, see optional python packages
  • activate virtual environment .venv
    • source .venv/bin/activate
  • install antlr4-python3-runtime, Jinja2, mock, pygls and pytest package into virtual environment .venv
    • python -m pip install antlr4-python3-runtime Jinja2 mock pygls pytest

Optional: update npm and node

  • check npm version
    • npm --version
  • install latest npm version globally (-g or --global)
    • sudo npm install -g npm@latest
  • install latest node version
    • sudo n latest
  • Install the dependencies to the global mode (-g or --global)
    • sudo npm update -g

Install Client Dependencies

  • Goto extension directory python-oceandsls/example-dsl
  • Install the dependencies to the local node_modules
    • npm install

Run Example using VSCode

  • Open python-oceandsls/example-dsl in VSCode
  • Trust author files in python-oceandsls/example-dsl
  • Goto Run and Debug
    • Ctrl/Cmd+Shift+D
  • Select Server + Client
  • Start Debugging via F5 or GUI
  • Open a *.odsl file
  • If server is working correctly notification shows Text Document Did Open

Troubleshooting

  • If VS Code doesn`t automatically locate the interpreter of the virtual environment. Set it manually

    • Open Command prompt Ctrl/Cmd+Shift+P
      • Run select interpreter command Python: Select Interpreter
    • Alternative create .vscode/settings.json file in python-oceandsls/example-dsl directory and set python.defaultInterpreterPath to point to the virtual environment
      • settings.json

        {
            // set Python Interpreter relative to workspaceFolder to virtual environment '.venv'
            "python.defaultInterpreterPath": "${workspaceFolder}/../.venv/bin/python",
            // alternative
            //"python.defaultInterpreterPath": "../.venv",
            // deprecated
            // "python.pythonPath": "${workspaceFolder}/../.venv/bin/python",
        
            // Pylance VSCode code analysis and auto-completion using Python 3.10
            "python.analysis.extraPaths": [
                "{workspaceFolder}/../.venv/lib/python3.10/site-packages/:${workspaceFolder}/../antlrLib/"
            ],
        
        
            // Object with environment variables that will be added to the VS Code process to be used by the terminal on OS X
            "terminal.integrated.env.osx": {"PYTHONPATH": "${workspaceFolder}/.."},
        
            // Object with environment variables that will be added to the VS Code process to be used by the terminal on Linux
            "terminal.integrated.env.linux": {"PYTHONPATH": "${workspaceFolder}/.."},
        
            // Object with environment variables that will be added to the VS Code process to be used by the terminal on Windows
            "terminal.integrated.env.windows": {"PYTHONPATH": "${workspaceFolder}/.."},
        }
        
  • If npm version conflicts exists change npm to the required version

    • E.g. reset npm version to 9.2.0
      • sudo npm install -g npm@9.2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

examplelspserver-0.0.3.2.tar.gz (69.0 kB view details)

Uploaded Source

Built Distribution

examplelspserver-0.0.3.2-py3-none-any.whl (99.7 kB view details)

Uploaded Python 3

File details

Details for the file examplelspserver-0.0.3.2.tar.gz.

File metadata

  • Download URL: examplelspserver-0.0.3.2.tar.gz
  • Upload date:
  • Size: 69.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/5.15.0-89-generic

File hashes

Hashes for examplelspserver-0.0.3.2.tar.gz
Algorithm Hash digest
SHA256 6a6f15953554c26f3447a661e3e9f2f5be994118cf49f5813275137162e754bc
MD5 1d1659e7ca8212f111cc60368bc82c03
BLAKE2b-256 158861cc333459a56d7bbffb3df1e1d00732407199910aa2a2231803584b43b9

See more details on using hashes here.

File details

Details for the file examplelspserver-0.0.3.2-py3-none-any.whl.

File metadata

  • Download URL: examplelspserver-0.0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 99.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/5.15.0-89-generic

File hashes

Hashes for examplelspserver-0.0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cc2d9e9d42faa5567c784489719ccfc8f1739e295b3178c8db9932aca966c375
MD5 13c064db51d91fdfd288772e6150d4bb
BLAKE2b-256 e6d7ad0d3ba05c90341fc206651c0fcfe2f674077224277117a104b65ac21545

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page