back to home

byexamples / byexample

Write snippets of code in C++, Python, Ruby, and others as documentation and execute them as regression tests.

65 stars
9 forks
40 issues
PythonMakefileDockerfile

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing byexamples/byexample in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/byexamples/byexample)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

byexample byexample is a literate programming engine where you mix ordinary text and snippets of code in the same file and then you execute them as regression tests. Do not write tests: write what you want, what do you expect, make examples of them. Let turn them in your tests. You can always be sure that the examples are correct and your documentation is up to date! Usage You write your documentation with examples in a Markdown or other text file. Then, you run from the command line selecting which language or languages you want to run: Python, Ruby, Shell and C/C++ to mention a few. And yes, you can write examples in different languages in the same file. Combine them to combine their strengths and make your life easier. That's all. will compare the output of the examples with the expected ones and it will show any difference. How do I get started? First, you need to install it: Or if you prefer, you can install it inside a virtual env. If you don't have pip or python installed, check the download page. That's it! Now, write a tutorial, a blog or a how-to and put some examples in between (like this README.md that you are reading); All the snippets and examples will be collected, executed and checked. Several languages are supported like Python , Ruby and C++ along with others. Take at look at the official web page: https://byexamples.github.io Some quick links: • Quick usage • Where should I write the examples? Languages supported Currently we support: • Python • Ruby • Javascript • Shell • GDB • C/C++ • iasm • PowerShell • Go • Rust • Java More languages will be supported in the future. Stay tuned. Currently unsupported: • Elixir • PHP Help is needed! Platforms supported Linux is the preferable choice as it is very well tested. Since macOS is also supported for the testing is more limited and it is expected to have little variations from Linux. You can even run in Windows using Windows Subsystem for Linux but keep in mind that the testing is even more limited; a native execution in Windows (outside of WSL) is currently not supported. Contributing First off, thanks for using and considering contributing to byexample . We love to receive contributions from our community. There are tons of ways you can contribute • add support to new languages (Javascript, Julia, just listen to you heart). Check this how to. • misspelling? Improve to the documentation is more than welcome. • add more examples. How do you use byexample ? Give us your feedback! • is byexample producing a hard-to-debug diff or you found a bug? Create an issue in github. But don't be limited to those options. We keep our mind open to other useful contributions: write a tutorial or a blog, feature requests, social media... Check out our CONTRIBUTING guidelines and welcome! Extend byexample It is possible to extend byexample adding new ways to find examples in a document and/or to parse and run/interpret a new language or adding hooks to be called regardless of the language/interpreter. Check out how to support new finders and languages and how to hook to events with concerns for a quick tutorials that shows exactly how to do that. You could also share your work and contribute to byexample with your extensions. Versioning We use semantic version for the core or engine. For each module we have the following categorization: • experimental : non backward compatibility changes are possible or even removal between versions (even patch versions). • provisional : low impact non backward compatibility changes may occur between versions; but in general a change like that will happen only between major versions. • stable : non backward compatibility changes, if happen, they will between major versions. • deprecated : it will disappear in a future version. • unsupported : it may work but currently it is not possible to offer *any* guarantees. Contributions from the community are needed! See the latest releases and tags and the changelog Current version: License This project is licensed under GPLv3 See LICENSE for more details.