Trustfall and cargo-semver-checks - Predrag Gruevski
Aug 27, 2023
auto_awesome
Predrag Gruevski, creator of Trustfall and Cargo-semver-checks, talks about integrating custom APIs and the relationship with GraphQL in Trustfall. They discuss integrating JavaScript and Python adapters, contributing to cargo-semver-checks, and the supportive Rust community. They emphasize setting boundaries, seeking support, and their future plans for Trustfall and Cargo Check.
Trustfall is a query engine that allows users to query various data sources using expressive capabilities like filtering and aggregation.
Cargo-semver-checks is a tool that helps Rust developers maintain semantic versioning compliance by analyzing changes between crate versions and detecting potential compatibility issues.
Developing tools like Cargo-semver-checks and Trustfall comes with challenges related to format changes, performance, and limitations in detecting violations of re-exported types, but leveraging these tools alongside proper testing practices can significantly reduce compatibility problems in software projects.
Deep dives
Trust Fall: A Query Engine for Data Sources
Trust Fall is a query engine designed to query various data sources, ranging from databases to APIs. It aims to provide a layer of abstraction, allowing users to query data without worrying about the specific implementation details of the underlying sources. The project originated in 2016 as a solution to a FinTech startup's need for efficient and correct query evaluation on a knowledge graph. Trust Fall provides a mechanism to interact with data from multiple sources, including APIs, databases, and machine learning models. It offers expressive querying capabilities, such as filtering and aggregation, making it a versatile tool for data retrieval. The project leverages GraphQL syntax and tooling, providing a familiar and developer-friendly experience. Trust Fall stands out for its stability, performance, and the ease of developing adapters in various languages such as Rust, TypeScript, JavaScript, and Python.
Cargo Semver Checks is a tool developed to help Rust developers ensure compliance with semantic versioning principles. It was created to address the challenge of maintaining correct versioning in Rust crates, avoiding unexpected breaking changes that disrupt downstream projects. The tool operates by analyzing changes between different crate versions and identifying potential compatibility issues. It performs thorough checks, including detecting renamed or removed public functions, additions or changes to public struct fields, and auto trait violations. By running Cargo Semver Checks prior to publishing a crate, developers can receive warnings about possible breaking changes and make informed decisions. The tool aims to provide a smooth and reliable process for maintaining semantic versioning and ultimately reduces the probability of introducing compatibility issues for users.
Challenges and Limitations
Developing tools like Cargo Semver Checks and Trust Fall comes with certain challenges and limitations. Rustdoc JSON, the data source used in these tools, can introduce format changes that require frequent updates and maintenance. Efforts have been made to stabilize the format, but it's an ongoing endeavor to strike a balance between stability and compatibility with evolving Rust language features. Performance-wise, Cargo Semver Checks may require a few extra seconds to run, especially when parsing large Rustdoc JSON files. However, these slight delays are usually worthwhile considering the importance of catching semantic versioning issues early on. One limitation is that Cargo Semver Checks currently cannot detect violations in re-exported types from other crates. The tool focuses on detecting violations within the target crate itself. Nevertheless, maintaining semantic versioning compliance is a shared responsibility, and leveraging these tools along with proper automated testing practices can significantly reduce compatibility problems in software projects.
Tips for Maintainers and Rust Developers
For maintainers of open-source projects and new Rust developers, there are several key tips to ensure smooth development and project maintenance. One crucial aspect is to prioritize ease of maintenance and testing when developing tools or libraries. Having a robust test suite, utilizing tools like Clippy and Cargo Semver Checks, and establishing a fast and reliable continuous integration process are essential for sustaining and improving project quality. Understanding common semantic versioning pitfalls, such as ensuring structured types are marked as non-exhaustive and handling auto trait violations, can help prevent avoidable breaking changes. Additionally, being aware that semantic versioning violations happen to everyone and using these tools as aids rather than indicators of failure can help maintain motivation and a positive development experience. By implementing these practices, developers can create and maintain high-quality projects that benefit both themselves and the wider Rust community.
Importance of High-Quality Rust Crates
The speaker highlights the exceptional quality of Rust crates in the ecosystem, emphasizing how these crates have solid test suites, good documentation, and well-thought-out APIs. This high quality makes development in Rust enjoyable and efficient, as it is easy to build and debug with these crates, ensuring strong type safety throughout the process.
Tips for Promoting Open Source Projects
The speaker provides advice on promoting open-source projects, encouraging developers to put their work out there and share it with the community. They stress the importance of explaining the motivation behind the project and the problem it solves. The speaker suggests leveraging platforms like Reddit's r/rust, where the community is positive and supportive. They also highlight the value of setting expectations and being transparent about the project's limitations. Additionally, they emphasize not taking detractors too seriously, focusing on the supportive feedback and constructive engagement.
π¦ RustShip is a podcast where Rust developers share their experiences and talk about their projects.
π§ββοΈ In this episode, Predrag Gruevski walks us through Trustfall and Cargo-semver-checks, two Rust projects he created.
π Trustfall is a query engine for any combination of data sources, allowing to query files and APIs as if they were databases. https://github.com/obi1kenobi/trustfall
π‘οΈ Cargo-semver-checks is a cargo plugin that scans Rust crates looking for semver violations. Under the hood it uses Trustfall and Rustdoc to do its job. https://github.com/obi1kenobi/cargo-semver-checks