https://github.com/its-kumar/python-package
https://github.com/its-kumar/python-package
Last synced: 19 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/its-kumar/python-package
- Owner: its-Kumar
- Created: 2024-11-01T12:53:56.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-01T13:41:01.000Z (over 1 year ago)
- Last Synced: 2025-12-27T02:53:53.975Z (5 months ago)
- Language: Python
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Python Package
Create Python packages/modules with using different languages such as Python, C, C++, and Rust.
## Python Libraries
### In Python
Create python modules written in python
#### Folder Structure
```sh
ks-package # package root dir
├── README.md
├── dist # for distributing the package
│ ├── ks_package-0.1.0-py3-none-any.whl
│ └── ks_package-0.1.0.tar.gz
├── ks_package # src dir
│ ├── __init__.py
│ └── main.py # source code for package
├── pyproject.toml # package metadata and dependencies
└── tests # test cases for the package
├── __init__.py
└── test_main.py
```
#### Build
Create package easily with `poetry`
poetry new
Build
poetry build
Install
poetry install
pip install dist/-0.1.0-py3-none-any.whl
### In C++
#### Folder Structure
```sh
ks-package-cpp/
├── README.md
├── build
├── dist # for distribution
│ └── ks_package_cpp-0.1-cp311-cp311-linux_x86_64.whl
├── ks_package_cpp
│ └── __init__.py
├── pyproject.toml
├── setup.py # required `setup.py` file
├── src
│ └── main.cpp # source code for package
└── tests # test cases
├── __init__.py
└── test_main.py
```
#### Build
Create python package in C++ (aka., extension for python) easily using `pybind11`
pip install pybind11
python setup.py bdist_wheel
Install
pip install dist/-0.1-cp311-cp311-linux_x86_64.whl
### In C
#### Folder Structure
```sh
ks-package-c # package root dir
├── README.md # about package
├── build
├── dist # for distribution
│ └── ks_package_c-0.1-cp311-cp311-linux_x86_64.whl
├── ks_package_c
│ └── __init__.py
├── pyproject.toml # package metadata
├── setup.py # required `setup.py` file
├── src # source code
│ └── main.c
└── tests # test cases
└── __init__.py
```
#### Build
Create python package in C language (aka., extension for python) easily using `Python.h` header
python setup.py bdist_wheel
Install
pip install dist/-0.1-cp311-cp311-linux_x86_64.whl
### In Rust
#### Folder Structure
```sh
ks-package-rust # package root dir
├── Cargo.toml # package metadata
├── build
├── ks_package_rust
│ ├── __init__.py
│ └── ks_package_rust.pyi # type stub for the library
├── setup.py # required `setup.py` file
├── src # source code for the library
│ └── lib.rs
└── target
└── wheels # for distribution
└── -0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl
```
#### Build
Create python package in Rust language (aka., extension for python) easily using `maturin` and `pyo3`.
pip install maturin
Create new library
cargo new --lib
Build
maturin develop
maturin build
Install
pip install target/wheels/-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl