y-crdt / ypy

Python bindings to y-crdt

Home Page:https://ypy.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Building ypy with setuptools_rust instead of maturin

frenzymadness opened this issue · comments

Hi.

I have one question which might be silly. I'm trying to package JupyterLab and Jupyter Notebook into Fedora Linux and this package is in the dependency graph. To be able to package it, I have to build it and maturin is not available in Fedora yet, unfortunately.

So, the question is: Is there any chance to build ypy with setuptools_rust instead of maturin if I prepare a configuration for it? I'd like to know whether it makes sense to start investigating it or if it's completely impossible. I have a lot of experience with Python packaging but almost no experience with Rust.

Thanks a lot and have a nice day.

Hey @frenzymadness, I haven't worked with setuptools_rust, but at a glance this looks pretty feasible. Looks like this is a pretty good resource to get started.

You are right. I've tried it and it works. There is nothing to be done on your side but if anybody will find this looking for the solution, these are the files I had to create or modify to be able to build ypy with setuptools_rust:

pyproject.toml:

[build-system]
requires = ["setuptools", "wheel", "setuptools-rust"]

setup.py

import sys

from setuptools import setup
from setuptools_rust import RustExtension

setup(
    rust_extensions=[RustExtension("y_py")],
)

setup.cfg

[metadata]
name = y-py
version = 0.5.5
license = MIT
url = https://github.com/y-crdt/ypy
long_description = file: README.md
long_description_content_type = text/markdown

[options]
zip_safe = False
setup_requires = setuptools-rust
python_requires = >=3.6
include_package_data = True

MANIFEST.in

include Cargo.toml
recursive-include src *