Giter VIP home page Giter VIP logo

python-libc's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.