Skip to content

Modernize build system: Rust stable + Python 3.8+ + maturin + uv #15

Description

@athoune

Summary

This project has been abandoned for several years and requires Rust nightly and Python 2.7 support. I've done a complete modernization of the build system and I'm proposing a PR for your review.

Changes Made

1. Migrate from Rust nightly to stable ()

  • Removed #![feature(core_intrinsics)] and #![crate_type = "dylib"]
  • Replaced std::intrinsics::type_name with std::any::type_name (stable since 1.38)
  • Replaced deprecated err.description() with format!("{}", err)
  • Added explicit "C" ABI to extern fn declarations in macros
  • Fixed unused_must_use warnings with drop() in free functions
  • Removed unused std::error::Error imports

2. Drop Python 2.7 support (fd97538)

  • Removed py27 from tox.ini envlist
  • Updated appveyor.yml: Python 2.7 → 3.9, Rust nightly → stable
  • Removed from __future__ import print_function from rust_setuptools.py
  • Updated docs and README to require Python >= 3.8

3. Migrate build system to maturin + uv (145932e)

  • Replaced legacy setup.py/milksnake with modern maturin CFFI backend
  • Added pyproject.toml with proper metadata and dependencies
  • Renamed Rust crate to _rust_fst to avoid Python package name collision
  • Updated rust_fst/lib.py import: from ._nativefrom ._cffi
  • Removed setup.py, rust_setuptools.py, test-requirements.txt, tox.ini
  • Rewrote build-wheels.sh to use maturin + uv

4. Code quality fixes (4a9d89d, 9738fa3)

  • Added rust_fst/_cffi.py wrapper to isolate CFFI imports
  • Added C99 typedefs to rust_fst.h for valid ISO C
  • Documented build.rs fragility (cbindgen can't handle generic types)
  • Updated README.md, docs/index.rst, and appveyor.yml

Test Results

All 38 tests pass:

uv run pytest tests/ -v
============================== 38 passed in 0.44s ==============================

Build Verification

maturin build --release -o /tmp/wheelhouse
# Produces: rust_fst-0.3.0-py3-none-macosx_11_0_arm64.whl

Current Status

The work is on a branch in my fork: modernize-build-system

I'm not creating the PR yet — I'd like your feedback first. If you're interested, I can open the PR for review.

Known Limitations

  • The C header (rust_fst.h) is hand-written because cbindgen cannot handle generic Rust types (`SetBuilder<BufWriter*>). It must be kept in sync manually.
  • The Rust crate is named _rust_fst (not rust_fst) to avoid collision with the Python package when maturin generates CFFI bindings.
  • CI files (.travis.yml, appveyor.yml) are updated but not fully tested with the new build system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions