On Mon, Nov 28, 2022 at 10:44 PM Kai A. Hiller <v02460@xxxxxxxxx> wrote: > > Hello, > > I am in the process of figuring out packaging of a Python/Rust hybrid > and have a few questions. Specifically, my work is on updating the > matrix-synapse package[0]. Synapse is originally a Python package, but > the developers started rewriting some critical parts in Rust and used > Pyo3 as glue. After a lot of experimentation, I hacked together a first > working copr build[1], but I don’t know how to get it into a clean shape > or how that even looks like exactly. > > * Should I move the Rust parts into a subpackage? What are the > conventions then (e.g. for naming)? > * What is the best way to install a Rust-generated so-file as Python > module into the Python sitearch dir? > * Currently, I bypass python-setuptools-rust completely and went with > Fedora’s Rust macros. Is that the preferred path? > * Are there some useful macros/macro options I can utilize, and where > is manual work required instead? Hi! I suggest that you look at the python-cryptography package: https://src.fedoraproject.org/rpms/python-cryptography/ It seems to be in the same situation, i.e. uses setuptools-rust and PyO3. I would recommend doing something similar. setuptools-rust actually works pretty well as far as I know, so you shouldn't need to work around it at all. I wonder why you think the "native" python extension should be in a separate subpackage? It's not unusual for Python packages to ship "native" extensions, and those aren't split off from the "main" package - it's just no longer "noarch". setuptools_rust should already do the correct thing here and install that extension .so into the correct directory for architecture-dependent Python packages / extensions. Depending on the setup and layout of the Rust code inside matrix-synapse, you might need to use workarounds for the %cargo_generate_buildrequires macro, which doesn't support cargo workspaces (yet, I mean to implement this once I have the time). Other than that, there shouldn't be any "gotchas" if you do things like they're done in python-cryptography. Fabio _______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue