Rust crate for linking against the RDKit C++ API

Related tags

Database rust rdkit
Overview

RDKit-Sys

Rust code that binds to the C++ rdkit library!

How does it work?

RDKit is a C++ mega-library, full of cheminformatics wisdom. We don't want to rewrite RDKit in Rust, we should instead meet somewhere in the middle and "bridge" Rust to C++ through some wrappers.

The goal is to do 1-1 bindings with the C++ library, exposing all the classes as we need them. The goal is not to create a high-level functionality like the MinimalLib (cffiwrapper). Our goal is to expose the building blocks. If you're looking for idiomatic Rust, check out the rdkit crate.

Static Linking

The build.rs script informs cargo how to find headers, library files, and finally how to link the final result. This crate currently links all RDKit libraries statically, meaning output binaries are portable and users of your software will not need to find their own RDKit.

Prerequisites

On Mac:

brew install rdkit

boost is a RDKit C++ dependency, cmake is how you create RDKit's Makefile, llvm is used by bind-gen to create the rust bindings.rs file with all the dylib definitions required to use RDKit from rust.

Testing

Or just run the test suite:

cargo test

TODO

  • figure out how to cargo publish without --no-verify (otherwise it detects changes outside of OUTDIR)
  • specify path to RDKit's cffiwrapper.h and all required search paths for other dependent headers
  • use conditional rebuild logic to make the library build experience more reliable (for now, if you get stuck, try cargo clean and retry with cargo build -vv)

Related Documentation

Prior art

You might also like...
Telegram bot API client for Rust
Telegram bot API client for Rust

Frankenstein Telegram bot API client for Rust. It's a complete wrapper for Telegram bot API and it's up to date with version 5.2 of the API. Frankenst

A Rust SQL query builder with a pleasant fluent API closely imitating actual SQL

Scooby An SQL query builder with a pleasant fluent API closely imitating actual SQL. Meant to comfortably build dynamic queries with a little bit of s

Rust API to manage user accounts 🦦

Autha Autha, pronounced Otter 🦦 , is the service that manages user accounts and the associated delegation. ☄️ Autha is an OAuth2 server designed with

A Rust-based comment server using SQLite and an intuitive REST API.

soudan A Rust-based comment server using SQLite and an intuitive REST API. Soudan is built with simplicity and static sites in mind. CLI usage See sou

Rust - Build a CRUD API with SQLX and PostgreSQL

In this article, you'll learn how to build a CRUD API in Rust using SQLX, Actix-web, and PostgreSQL. Learning how to build a CRUD API as a developer will equip you with valuable skills for building robust, maintainable, and scalable applications.

High performance and distributed KV store w/ REST API. 🦀
High performance and distributed KV store w/ REST API. 🦀

About Lucid KV High performance and distributed KV store w/ REST API. 🦀 Introduction Lucid is an high performance, secure and distributed key-value s

An async executor based on the Win32 thread pool API

wae An async executor based on the Win32 thread pool API use futures::channel::oneshot; #[wae::main] async fn main() { let (tx, rx) = oneshot::ch

RedisLess is a fast, lightweight, embedded and scalable in-memory Key/Value store library compatible with the Redis API.

RedisLess is a fast, lightweight, embedded and scalable in-memory Key/Value store library compatible with the Redis API.

"KakaoTalk" internal api bindings

talk-api-client "KakaoTalk" internal api bindings Examples Auth See examples/auth.rs To run example, clone this repository and run command cargo run -

Comments
  • Conda Build

    Conda Build

    #3

    Introduces a feature flag for dynamic-linking-from-conda which changes build.rs to prefer dynamic linking and it invokes the conda info --base to find where packages exist.

    @iwatobipen does this work for you?

    In the project which depends on rdkit-sys you'll want to do something like:

    [dependencies]
    rdkit-sys = { git = "[email protected]:rdkit-rs/rdkit-sys.git", branch = "conda-build", features = ["dynamic-linking-from-conda"] }
    

    also, you need to make sure that the conda packages are in your library path, on linux it'll be something like:

    export LD_LIBRARY_PATH=$(conda info --base)/lib
    

    before you can use the code. The Dockerfile.conda in this PR shows an example of how you can update your /etc/ld.so.conf.d/conda to include that conda path all the time (although the conda project does not recommend it).

    opened by xrl 7
  • rdkit-sys question

    rdkit-sys question

    Hi,

    I’m a relatively new user of Rust (more familiar with Python & R) and hoping to integrate Rust and RDKit (trying to start a cheminformatics project in Rust), so I was quite excited to come across this crate, rdkit-sys, online. I was running it on VS code on Mac OS, by using the latest version 0.2.16 of rdkit-sys in the cargo.toml. However, when I ran it via cargo check or cargo test, it showed a set of errors like this after compilation (in total it appeared twice):

    warning: /usr/local/include/rdkit/RDGeneral/Dict.h:261:26: error: no template named 'is_same_v' in namespace 'std'; did you mean 'is_same'? warning: static_assert(! std::is_same_v<T, std::string_view>, warning: ~~~~~^~~~~~~~~ warning: is_same

    warning: /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits:547:61: note: 'is_same' declared here warning: template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_same : public false_type {}; warning:

    Prior to this, I’ve already installed rdkit and relevant dependencies via Homebrew. It appeared there might be conflicts between one of the RDKit files and one of the llvm files (this was as far as I could tell if I went back to these files). So either I’m missing something obvious here (being quite new in the coding world) or I wasn’t doing something correctly?

    Hoping someone might be able to enlighten me on this one... (might be due to a silly thing I've missed).

    Many thanks, J

    opened by jhylin 3
  • Convert BitVec<u64> to BitVec<u8>

    Convert BitVec to BitVec

    The Boost library returns explicit bitvects as vectors of u64 (so whole CPU words). but libraries like tantivy expect vectors of u8. we should add a helper function for converting Vec<u64> to Vec<u8>

    opened by xrl 0
  • Build package with conda env

    Build package with conda env

    Dear, Thanks for sharing uself chemoinformaitcs package of Rust! I would like to ask you if I could build the code with rdkit which is installed from conda. By using conda env, I couldn't solve the issue which related static link. Any suggestion, advicces are greatly appreciated. Thanks,

    Taka

    opened by iwatobipen 5
Owner
null
A Rust crate for writing servers that speak PostgreSQL's wire protocol

Convergence A Rust crate for writing servers that speak PostgreSQL's wire protocol. Additionally, the experimental convergence-arrow crate enables con

ReservoirDB 63 Jan 2, 2023
This is a maintained rust project that exposes the cpp driver at cpp-driver in a somewhat-sane crate.

cassandra-rs This is a maintained rust project that exposes the cpp driver at https://github.com/datastax/cpp-driver/ in a somewhat-sane crate. For th

Tupshin Harper 51 Aug 20, 2020
An implementation of the tz database for the time-rs Rust crate.

time-tz An implementation of the tz database for the time-rs Rust crate. This implementation is based off of chrono-tz

null 12 Jul 27, 2022
Rust Uint crate using const-generics

Rust uint crate using const-generics Implements [Uint<BITS, LIMBS>], the ring of numbers modulo $2^{\mathtt{BITS}}$ . It requires two generic argument

Remco Bloemen 63 Dec 29, 2022
Rust D-Bus crate.

zbus A Rust API for D-Bus communication. The goal is to provide a safe and simple high- and low-level API akin to GDBus, that doesn't depend on C libr

The future of D-Bus 40 Jun 2, 2023
Simple crate that wraps a tokio::process into a tokio::stream

tokio-process-stream tokio-process-stream is a simple crate that wraps a tokio::process into a tokio::stream Having a stream interface to processes is

Leandro Lisboa Penz 8 Sep 13, 2022
This crate allows you to send cypher queries to the REST endpoint of a neo4j database

rusted_cypher Rust crate for accessing the cypher endpoint of a neo4j server This crate allows you to send cypher queries to the REST endpoint of a ne

Livio Ribeiro 68 Dec 1, 2022
A Rust client for the ElasticSearch REST API

rs-es Introduction An ElasticSearch client for Rust via the REST API. Targetting ElasticSearch 2.0 and higher. Other clients For later versions of Ela

Ben Ashford 218 Dec 27, 2022
An Elasticsearch REST API client for Rust

elastic elastic is an efficient, modular API client for Elasticsearch written in Rust. The API is targeting the Elastic Stack 7.x. elastic provides st

null 249 Oct 18, 2022
An API Wrapper for https://paste.myst.rs written in rust

PasteMyst.RS pastemyst-rs is an api wrapper for pastemyst written in Rust. ⚠ This package is under development ⚠ Sample usage To get a paste from past

ANF Studios 14 Nov 28, 2021