Development Guide
1. Environment
cd Paper_Atlas1.5
python launcher.py --prepare-only
python launcher.py --reinstall
--prepare-only creates .venv and installs dependencies without starting the server.
Manual:
python -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements.txt
Use the manual verification checklist in section 3 before a release.
2. Run
.venv/bin/python app.py --host 127.0.0.1 --port 8765
or:
.venv/bin/python launcher.py --no-open
The server creates data/ automatically. For development, use a disposable copy of the data folder so real papers and notes are not touched.
3. Manual verification
Before publishing, at minimum:
python launcher.py --check
Start the app and verify:
- login page and access code;
- dashboard counters and project list;
- arXiv search with plain keywords (avoid a real AI call);
- create a project and link a paper;
- PDF reader: canvas, text layer, paging, zoom, outline;
- AI analysis panel (existing analysis) and evidence navigation;
- text selection, highlight creation and note saving;
- settings save/reload;
- close and reopen the reader to confirm reading-state restore.
For a release build:
./dist/PaperAtlas --check
4. Data scripts
python scripts/backup_data.py # DB/config/library/analysis
python scripts/verify_data.py # read-only integrity checks
python scripts/migrate_schema.py # migrations with automatic backup
python scripts/migrate_schema.py --dry-run
python scripts/migrate_schema.py --restore-on-failure
All scripts support --help.
5. Database changes
Schema lives in atlas/db/schema.py.
Rules:
- Add a new migration entry; never edit a released migration.
- Prefer additive changes (
CREATE TABLE,CREATE INDEX,ALTER TABLE ADD COLUMN). - Check
PRAGMA table_infobeforeALTER TABLEso retries are safe. - Record the version in
schema_migration. - Update repositories and API schemas.
- Back up and migrate a copy of a real database before applying.
- Never delete user tables or columns in a migration.
V4_COLUMNS = (("annotation", "my_field", "TEXT NOT NULL DEFAULT ''"),)
def _apply_v4(conn):
for table, column, ddl in V4_COLUMNS:
existing = {row[1] for row in conn.execute(f"PRAGMA table_info({table})")}
if column not in existing:
conn.execute(f"ALTER TABLE {table} ADD COLUMN {column} {ddl}")
MIGRATIONS = (
...,
(4, "my_change", _apply_v4),
)
6. Code conventions
- Python 3.10+, type hints on public functions,
from __future__ import annotations. - Keep domain logic out of HTTP routers and the browser.
- Use
atlas.core.errors; new endpoints return the unified error envelope. - Use
LLMClientfor every model call; never create a second OpenAI client. - Use
atlas.core.filesfor atomic writes/path checks. - Do not read
data/config.jsondirectly; use the settings facade. - Write user data under
data/only. - Frontend:
textContentonly (neverinnerHTMLfor user/model data), no CDN, no framework. - Reader: keep PDF rendering and analysis data separate; do not call a model to render.
7. Structure notes
app.pyis the composition root for arXiv/system routes; feature routers live inatlas/api/.review/is the journal acquisition and analysis engine, reused by the reader.atlas/services/reader.pyreads analysis results; it must not trigger a second analysis.static/vendor/pdfjs/is third-party code; update it as a whole and keepLICENSE.
8. Build
python build.py --check
./build.sh --clean --zip # Linux/macOS
build.bat --clean --zip # Windows
PyInstaller bundles:
- Python + runtime dependencies
templates/andstatic/(including PDF.js)atlasandreview
Build on the target OS family. Output is in dist/.
9. CI
.github/workflows/build.yml runs on Windows and Ubuntu:
- install dependencies;
- compile-check Python sources;
- build with PyInstaller;
- smoke-test
--check; - upload the zip artifact.
CI does not call real AI or publisher APIs.