Bonsai
Features
What to expect from bonsai:
classes for the different entities of a program (e.g. variables, functions, etc.);
extended classes for specific programming languages (only C++ for now);
parser implementations, able to take a file and produce a model (e.g. clang for C++);
extensible interface to manipulate and query the resulting model (e.g. find calls for a function);
a console script to use as a standalone application.
Installation
Method 1: Running Without Installation
git clone https://github.com/git-afsantos/bonsai.git
cd bonsai
python bonsai-runner.py <args>
You can also run it with the executable package syntax.
python -m bonsai <args>
Method 2: Installing Bonsai on Your Machine
[sudo] pip install bonsai-code
python setup.py install
Examples
parser = CppAstParser(workspace = "examples/cpp")
parser.global_scope.pretty_str()
CodeQuery(parser.global_scope).all_references.where_name("a").get()
class C:
C():
[declaration]
void m(int a):
[declaration]
int x_ = None
C():
x_ = 0
void m(int a):
a = (a + 2) * 3
this.x_ = a
int main(int argc, char ** argv):
C c = new C()
c.m(42)
C * c1 = new C()
C * c2 = new C()
new C()
delete(c1)
delete(c2)
return 0
Metadata
Release files for bonsai-code 0.6.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| bonsai-code-0.6.8.tar.gz | 43.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bonsai_code-0.6.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 95.7 kB
Release files / bonsai-code-0.6.8.tar.gz
| Download URL | bonsai-code-0.6.8.tar.gz |
|---|---|
| Size | 43.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ef835e605bd8ac6cba9df68d0c9f176297027ccb277469ffb4baeea837a3602
|
|
BLAKE2b-256 checksum How to use checksums |
cc3c95755937d4dbb6d493408e939445b86b675b623bc87cc4e72d67950523f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.10
|
Release files / bonsai_code-0.6.8-py3-none-any.whl
| Download URL | bonsai_code-0.6.8-py3-none-any.whl |
|---|---|
| Size | 52.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca880e515a52ff823f5f7e79452867078270c81f18bc7616f4d038941a166d7b
|
|
BLAKE2b-256 checksum How to use checksums |
8730265c6fc841513cf36d17eaaf22cc149286c1901fb036dd381e021041602d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.10
|
Security for bonsai-code 0.6.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.