Skip to content

grimmkeeper-here/python-libc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-libc

This is app template for install libc

Prerequisites

  • OS: Ubuntu v21.04 or later
  • Runtime environment: Python version 3.9.x
  • Package manager: APT (Ubuntu)

Setup project

sudo apt-get install build-essential

python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt --trusted-host pypi.python.org

Setup dev enviroment

  • Make env folder
  • Add secrets key to env/dev.env
  • Secrets key can find at app/core/config.py

Format before git

  • Auto autoflake,isort then black all .py file in git status
./scripts/format.sh

Add new libc for implement to Python

  • Add new C file to app/libc/source/
    // square.c
    
    #include <stdio.h>
    int square(int i) {
        return i * i;
    }
  • Add Lib info to app/libc/lib.json
[
  {
     "name":"square libc",
     "_file":"square",
     "description":"This is test libc with square function"
  }
]
  • Install libc(or build .so file from .c file), run command:
./scripts/install_libc.sh
  • List all libc is installed
python manage.py libc list
#######################################################
name: square libc
_file: square
install: from libc import square
description: This is test libc with square function
#######################################################
  • Use libc with install
from libc import square as square_lib
square_lib.square(10) #100

About

This is app template for install libc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published