Installing pymoors from source
Setting Up
Before you proceed, make sure you have Rust installed. We recommend using rustup for an easy setup:
# For Linux/Mac:
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
# For Windows, download and run the installer from the official website:
# https://rustup.rs/
Also pymoors
uses uv . Make sure it's available on your PATH so the make
commands can run properly.
Then
-
Clone the repository
git clone https://github.com/andresliszt/pymoors cd pymoors
-
Create a virtual environment
# Create the virtual environment uv venv # Activate it (Linux/Mac) source .venv/bin/activate # On Windows, you would typically do: # .venv\Scripts\activate
-
Install and compile in dev mode
make build-dev
This command will install all the necessary dependencies for development and compile using maturin.
- Compile in prod mode
This command will run
make build-prod
maturin develop --release
, i.e compiling in a optimized way. This is needed when you want to check the performance of the different algorithms.
Code Formatting and Linting
To ensure code quality and consistency, pymoors
uses various tools for formatting and linting. You can run these tools using the provided make
commands.
-
Format the code
This command will format the codebase using tools likemake format
black
for Python andrustfmt
for Rust. -
Lint the code
This command will run linters likemake lint
flake8
for Python andclippy
for Rust to check for potential issues and enforce coding standards.
Additionally, pymoors
uses pre-commit
to automatically run these checks before each commit. To set up pre-commit
, run the following command:
pre-commit install
This will ensure that your code is formatted and linted before every commit, helping maintain code quality throughout the development process.