Skip to content

domvwt/poetry-rust-example-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Adders

A simple Python package demonstrating how to build and package a Rust extension using Poetry.

Project Structure

.
├── Makefile             # Makefile for convenience
├── poetry.lock          # Lock file for Poetry dependencies
├── pyproject.toml       # Poetry configuration file
├── python
│   ├── src
│   │   └── adders
│   │       ├── addition.py  # Python wrapper for Rust functions
│   │       └── __init__.py  # Package initializer
│   └── tests
│       ├── __init__.py
│       └── test_addition.py # Test file for the addition module
├── README.md            # This README file
└── rust
    ├── Cargo.lock       # Cargo lock file for Rust dependencies
    ├── Cargo.toml       # Cargo configuration file
    ├── pyproject.toml   # maturin configuration file
    └── src
        └── lib.rs       # Rust source file containing the extension implementation

Getting Started

Prerequisites

  • Python 3.8.1 or higher
  • Poetry
  • Rust
  • maturin

Building the Project

  1. Clone the repository:
git clone https://github.com/domvwt/poetry-rust-example-project.git
cd poetry-rust-example-project
  1. Install the project:
make install
  1. Activate the virtual environment:
poetry shell
  1. Run the tests:
make test
  1. Build the project:
make dist

Using the Package

You can use the adders package in your Python projects like this:

from adders import add

result = add(2, 3)
print(result)  # Output: 5

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published