Parse a Lean repo into structured items, and store them in a PostgreSQL database.
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt-
Download PostgreSQL (you can find the installation guide here).
-
Create database:
createdb my_database_nameMemorize the database name, you will later need to set it in your
.envfile.
- Clone the jixia repo:
git clone git@github.com:frenzymath/jixia.git;cd jixia - Make sure
lean-toolchainin jixia andlean-toolchainin the project you will be indexing match. If Lean versions don't match, you will get"... failed to read file ..., invalid header"error when you try to index the project. - Build jixia:
lake build(should take around 70s)
-
Copy the
.env.examplefile to.env:cp .env.example .env
-
Edit the
.envfile and set the required variables according to your setup.
psql -d <database name> -f src/schema.sqlpython -m src <project root> <prefixes>Options:
project root: Path to the project to index. This is where thelakefile.tomlorlakefile.leanis located.prefixes: Comma-separated list of module prefixes. A module is indexed only if its module path starts with one of prefixes listed here. For example,Init,Lean,Mathlibwill include onlyInit.*,Lean.*, andMathlib.*modules.
Note: to check what modules are available in your project, and to determine how prefixes work, you can use python -m prefix --project_root <project_root> --prefixes <prefixes> helper command.