https://github.com/betatim/kamal
A simple API usage analyser for your private code
https://github.com/betatim/kamal
Last synced: 6 months ago
JSON representation
A simple API usage analyser for your private code
- Host: GitHub
- URL: https://github.com/betatim/kamal
- Owner: betatim
- License: bsd-3-clause
- Created: 2023-06-22T14:36:35.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-13T08:53:27.000Z (over 1 year ago)
- Last Synced: 2025-02-13T23:15:33.932Z (8 months ago)
- Language: Python
- Homepage:
- Size: 121 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kamal
A simple API usage analyser. The goal of this project is to provide a tool that is
very simple to read and understand, in the hope that this increases the chances of
people running it on their private code bases.## Setup
To analyse source code you need the `kamal.py` script and its only
dependency: `pip install jedi`. Run `python kamal.py --module `
in an environment that has the `` you are interested in installed.## Usage
To analyse all the Python files in a folder run:
```
python kamal.py --module path/to/python/files
```
This will produce a `statistics.csv` containing one line for each call to a function
or instantiation of a class in ``.## Analysis
A useful tool for exploring the output of kamal is [datasette](https://datasette.io/).
1. Create a sqlite database from the CSV with `sqlite-utils insert --csv statistics.db sklearn statistics.csv`
2. Launch datasette: `datasette serve statistics.db`To combine the results of multiple `kamal.py` runs can be combined into one database
by running `sqlite-utils insert --csv statistics.db sklearn ` for each CSV. Each
CSV is appended to the database table.