Development

Setup

Starting with version 0.6, and due to new requirements including Algokit, the Permission dApp requires Python 3.12 or later for development and deployment.

Python environment

Create Python virtual environment:

python3 -m venv dapp

Activate Python environment:

source dapp/bin/activate

Adding an alias can be useful:

~/.bashrc
alias 'dapp'='cd /home/ipaleka/dev/permission-dapp/dapp; \
  source /home/ipaleka/dev/venvs/dapp/bin/activate'

Environment variables

Copy provided .env.example file to a working copy:

cd /home/ipaleka/dev/permission-dapp/dapp
cp .env.example .env

You have to update CREATOR_TESTNET_MNEMONIC variable in the newly created .env` file, as well as the related PERMISSION_APP_ID_TESTNET application identifier after you deploy your own dapp on Testnet.

SonarQube

SonarQube is an automated code review and static analysis tool designed to detect coding issues. You can find the installation instructions here

Starting server

$ ~/opt/pt/sonarqube-25.9.0.112764/bin/linux-x86-64/sonar.sh console

Starting scanner

For additional information read the scanner documentation.

You should add scanner executable to your PATH. For example, by adding the following line to your ~/.bashrc:

export PATH=$PATH:~/opt/repos/sonar-scanner/bin

To start scanning, run the scanner from the root directory of the project with:

$ sonar-scanner

Newer versions require authentication:

$ sonar-scanner -Dsonar.login=admin -Dsonar.password=password -Dsonar.projectKey=permission-dapp

Smart contract

Compile

After you activated the Python environment, you can compile smart contract by issuing the following commands:

algokit compile py contract.py --out-dir artifacts

Deploy and fund Permission dApp

Issue the following command to deploy the smart contractdeploy generated smart contract on the blockchain and fund the related account with required ALGO:

python deploy.py

Tests

Python

cd /home/ipaleka/dev/permission-dapp/dapp
source /home/ipaleka/dev/venvs/dapp/bin/activate
python -m pytest -v  # or just `pytest -v`