Develop#

These are instructions for developers, to quickly start coding for luxos.

Pre-requisites#

There are essentially three pre-requisites.

We assume you have installed a recent version of python (eg. >=3.10) and the python binary is in the path. If so the following should be verified:

$> python3 --version
Python 3.12.3

The code is from a github checkout:

git clone https://github.com/LuxorLabs/luxos-tooling.git

Also we assume the current directory is the check out directory:

cd luxos-tooling

Setup#

You need (only once) to Create the python virtual environment, Setting up the repository, then every time you restart a shell, you need to Activate the virtual environment.

Create the python virtual environment#

First you need to create a virtual environment and install all dependencies:

python3 -m venv %CD%\venv
.\venv\Scripts\activate.bat    

pip install -r tests\requirements.txt
pip install -e .

Setting up the repository

Luxos leverages pre-commit to execute checks on code commit, so the code can be checked for issues before being submitted to the repo.

=== “Windows” ```bash $> .\venv\Scripts\activate
# on powershell $> .\venv\Scripts\activate.ps1

$> pre-commit install
```

=== “*NIX” bash     $> source ./venv/bin/activate     $> pre-commit install    

  • ACTIVATE the environment (each time you start a new shell)

    Windows
    .\venv\Scripts\activate
    
    *NIX
    source ./venv/bin/activate
    
  • RUN the tests

    (Windows & *NIX)

    pytest -vvs tests
    

Coding

Precommit

When it comes to coding, you can use pre-commit hooks to help you validate code at every git commit.

  • ENABLE precommit:

    pre-commit install
    
  • DISABLE precommit:

    pre-commit uninstall
    
  • SKIP CHECKS during git commit: Use the -n flag:

    git commit -n ....
    

At every git commit code scanner ruff and mypy will run.