The project folder¶
The toolkit keeps everything for one research project in one folder, the project folder. You choose it once, and every later command finds it, whichever folder you start from: a terminal anywhere on your machine, a Jupyter notebook, Spyder or another IDE.
Set it once¶
Pick (or create) a folder for the project, then tell the toolkit about it.
Windows (Command Prompt or PowerShell):
aa set-params --project-dir "D:\research\aa"
macOS or Linux:
aa set-params --project-dir ~/research/aa
The folder is created if it does not exist. The command prints
Project folder saved: D:\research\aa
Config saved (database: D:\research\aa\Data\aa.duckdb)
You can set other parameters in the same command, for example
aa set-params --project-dir ~/research/aa --sample-start 1963 --sample-end 2024. They are
saved in that project's database.
From Python the same step is:
import assayinganomalies as aa
aa.set_project_dir(r"D:\research\aa")
What is inside it¶
<project folder>/
Data/
aa.duckdb the database, with your settings stored inside it
aa.manifest.json what the last build used (code version, sample, inputs)
logs/ build logs
staging/ downloaded files the build reads
Scratch/
Assay/ outputs of aa run-protocol (results, report, TeX and PDF)
aa setup-database builds Data/aa.duckdb here, and aa run-protocol writes its outputs
under Scratch/Assay/ unless you pass --out-dir.
Check which database is in use¶
Every aa command starts by printing which database it uses and why:
Using database: D:\research\aa\Data\aa.duckdb (project folder: D:\research\aa, from saved in C:\Users\you\AppData\Local\assayinganomalies\settings.json)
aa show-config prints the same line, followed by the project folder and every setting.
The from ... part says where the project folder came from. In order of priority:
| Source | Meaning |
|---|---|
argument |
Python only: aa.load_config(project_dir=...), for that one call. |
AA_PROJECT_DIR |
The AA_PROJECT_DIR environment variable is set in this terminal (see below). |
saved in <file> |
The folder you saved with aa set-params --project-dir. |
current folder |
Nothing is set, so the folder you started from is used. aa set-params warns about this. |
The saved folder is kept in a small settings file for your user account (the path shown
after saved in). It holds only the folder's location; your research settings stay in the
database.
Switch projects for one terminal session¶
To work on a second project without changing the saved one, set AA_PROJECT_DIR in that
terminal. It lasts until you close the terminal.
export AA_PROJECT_DIR=~/research/aa-test # macOS / Linux
$env:AA_PROJECT_DIR = "D:\research\aa-test" # Windows PowerShell
set AA_PROJECT_DIR=D:\research\aa-test # Windows Command Prompt
To switch for good, run aa set-params --project-dir <folder> again.
When the database is not there¶
If the project folder has no database yet, or one that holds only settings (you ran
aa set-params but not aa setup-database), aa run-protocol and the Python data
functions stop with a message like
Error: The database D:\research\aa\Data\aa.duckdb does not exist.
It comes from: project folder D:\research\aa (from saved in ...).
Fix it with one of:
aa set-params --project-dir <folder> point at the folder that holds Data/aa.duckdb
aa setup-database build the database in this project folder
Nothing is created in that case. Either the project folder is the wrong one (point it at
the folder that holds Data/aa.duckdb), or the database has not been built yet.
If the saved folder itself is missing (an unplugged external drive, a renamed folder), every
command says so and asks you to choose a folder with aa set-params --project-dir.
Config files (AA_CONFIG_PATH)¶
If the AA_CONFIG_PATH environment variable names a JSON config file, that file decides
the database instead (its database_path), and the project folder is used only for
outputs. Most users never need this.