studysystem 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- studysystem/__init__.py +1 -0
- studysystem/assets/note-callouts.lua +100 -0
- studysystem/assets/note-no-html.lua +28 -0
- studysystem/assets/note.css +146 -0
- studysystem/cli.py +344 -0
- studysystem/dashboard.html +781 -0
- studysystem/dashboard.py +377 -0
- studysystem/db/__init__.py +1 -0
- studysystem/db/engine.py +158 -0
- studysystem/db/migrate.py +122 -0
- studysystem/db/migrations/env.py +59 -0
- studysystem/db/migrations/script.py.mako +29 -0
- studysystem/db/migrations/versions/0000_baseline.py +19 -0
- studysystem/db/migrations/versions/0001_the_whole_schema.py +1743 -0
- studysystem/db/migrations/versions/0002_semester_ignores_case.py +38 -0
- studysystem/db/migrations/versions/0003_course_vault_folder.py +26 -0
- studysystem/db/migrations/versions/0004_note_pdf_path.py +26 -0
- studysystem/db/migrations/versions/0005_tagging_kind.py +39 -0
- studysystem/db/migrations/versions/0006_practice_mode.py +36 -0
- studysystem/db/migrations/versions/0007_exam_prep_from.py +25 -0
- studysystem/db/migrations/versions/0008_more_papers_kind.py +37 -0
- studysystem/db/migrations/versions/0009_past_exam_month_date.py +28 -0
- studysystem/db/migrations/versions/0010_task_parts.py +70 -0
- studysystem/db/migrations/versions/0011_observation_kind.py +39 -0
- studysystem/db/migrations/versions/0012_profile_claim.py +52 -0
- studysystem/db/migrations/versions/0013_assumed_instructor_papers.py +40 -0
- studysystem/db/migrations/versions/0014_scan_confirmation.py +44 -0
- studysystem/db/migrations/versions/0015_practice_item_count.py +37 -0
- studysystem/db/migrations/versions/0016_timetable_patterns.py +102 -0
- studysystem/db/migrations/versions/0017_course_dropped.py +36 -0
- studysystem/db/migrations/versions/0018_syllabus_topics.py +82 -0
- studysystem/db/migrations/versions/0019_course_lab_group.py +36 -0
- studysystem/db/migrations/versions/0020_chapter_scope.py +61 -0
- studysystem/db/migrations/versions/0021_note_retired_at.py +28 -0
- studysystem/db/migrations/versions/0022_rescope.py +48 -0
- studysystem/db/migrations/versions/0023_backlog_reason.py +42 -0
- studysystem/db/migrations/versions/0024_guess_sensitivity.py +35 -0
- studysystem/db/migrations/versions/0025_shortfall_inputs.py +83 -0
- studysystem/db/migrations/versions/0026_trials_switch.py +36 -0
- studysystem/db/tables.py +1096 -0
- studysystem/demo.py +722 -0
- studysystem/errors.py +39 -0
- studysystem/server/__init__.py +83 -0
- studysystem/server/__main__.py +5 -0
- studysystem/services/__init__.py +1 -0
- studysystem/services/adherence.py +147 -0
- studysystem/services/assessments.py +171 -0
- studysystem/services/capacity.py +164 -0
- studysystem/services/claims.py +405 -0
- studysystem/services/course_folder.py +82 -0
- studysystem/services/courses.py +176 -0
- studysystem/services/coverage.py +121 -0
- studysystem/services/dashboard_key.py +102 -0
- studysystem/services/feedback.py +412 -0
- studysystem/services/forward_eval.py +65 -0
- studysystem/services/gate.py +77 -0
- studysystem/services/generation.py +2864 -0
- studysystem/services/ids.py +15 -0
- studysystem/services/intake.py +278 -0
- studysystem/services/launcher.py +455 -0
- studysystem/services/lookups.py +91 -0
- studysystem/services/materials.py +97 -0
- studysystem/services/note_markdown.py +241 -0
- studysystem/services/notes.py +396 -0
- studysystem/services/parts.py +65 -0
- studysystem/services/past_exams.py +115 -0
- studysystem/services/pdf_render.py +148 -0
- studysystem/services/pdf_worker.py +184 -0
- studysystem/services/plan.py +1300 -0
- studysystem/services/private_view.py +38 -0
- studysystem/services/profiles.py +544 -0
- studysystem/services/programs.py +16 -0
- studysystem/services/replacements.py +107 -0
- studysystem/services/rescope.py +277 -0
- studysystem/services/settings.py +50 -0
- studysystem/services/setup.py +235 -0
- studysystem/services/shortfall.py +443 -0
- studysystem/services/state.py +846 -0
- studysystem/services/statements.py +222 -0
- studysystem/services/study_loop.py +998 -0
- studysystem/services/summaries.py +369 -0
- studysystem/services/syllabus.py +138 -0
- studysystem/services/system_work.py +113 -0
- studysystem/services/taxonomy.py +459 -0
- studysystem/services/topics.py +477 -0
- studysystem/services/trials.py +201 -0
- studysystem/services/unconfirmed.py +95 -0
- studysystem/services/units.py +34 -0
- studysystem/services/users.py +53 -0
- studysystem/services/values.py +168 -0
- studysystem/startup.py +147 -0
- studysystem/tools/__init__.py +4 -0
- studysystem/tools/course_setup.py +185 -0
- studysystem/tools/dashboard.py +27 -0
- studysystem/tools/feedback.py +66 -0
- studysystem/tools/gate.py +24 -0
- studysystem/tools/generation.py +156 -0
- studysystem/tools/materials.py +32 -0
- studysystem/tools/notes.py +29 -0
- studysystem/tools/past_exams.py +51 -0
- studysystem/tools/ping.py +9 -0
- studysystem/tools/plan.py +40 -0
- studysystem/tools/profiles.py +94 -0
- studysystem/tools/results.py +77 -0
- studysystem/tools/study_loop.py +145 -0
- studysystem/tools/summaries.py +52 -0
- studysystem/tools/topics.py +143 -0
- studysystem-1.0.0.dist-info/METADATA +254 -0
- studysystem-1.0.0.dist-info/RECORD +112 -0
- studysystem-1.0.0.dist-info/WHEEL +4 -0
- studysystem-1.0.0.dist-info/entry_points.txt +3 -0
- studysystem-1.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""Alembic entry point. Runs every migration on a connection from our own engine, so the
|
|
2
|
+
PRAGMAs (foreign_keys, WAL, busy_timeout) and BEGIN IMMEDIATE apply here too."""
|
|
3
|
+
|
|
4
|
+
from alembic import context
|
|
5
|
+
|
|
6
|
+
from studysystem.db.engine import db_path, make_engine
|
|
7
|
+
from studysystem.db.tables import metadata
|
|
8
|
+
|
|
9
|
+
# What the code believes the database looks like; `alembic revision --autogenerate` diffs the
|
|
10
|
+
# migrations against it.
|
|
11
|
+
target_metadata = metadata
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def run_migrations() -> None:
|
|
15
|
+
config = context.config
|
|
16
|
+
# `study migrate` hands us its engine; the bare `alembic` CLI (dev only) gets a fresh one.
|
|
17
|
+
engine = config.attributes.get("engine") or make_engine(db_path())
|
|
18
|
+
|
|
19
|
+
with engine.connect() as connection:
|
|
20
|
+
# SQLite (D-103): batch mode rebuilds a table as copy -> drop -> rename, and with foreign
|
|
21
|
+
# keys enforced the drop of a parent table fails against its children - RESTRICT fires
|
|
22
|
+
# even when deferred. `foreign_keys = OFF` is a no-op inside a transaction, so it is set
|
|
23
|
+
# here, on the raw connection, before the run's transaction opens. Postgres alters in
|
|
24
|
+
# place and needs none of it: `raw` is the sqlite3 connection underneath, or None on
|
|
25
|
+
# Postgres.
|
|
26
|
+
sqlite = connection.dialect.name == "sqlite"
|
|
27
|
+
raw = connection.connection.driver_connection if sqlite else None
|
|
28
|
+
if raw is not None:
|
|
29
|
+
raw.execute("PRAGMA foreign_keys = OFF")
|
|
30
|
+
try:
|
|
31
|
+
# The run's one transaction, opened here. Left to itself, Alembic treats SQLite's DDL
|
|
32
|
+
# as non-transactional and commits after every migration, so the check below would
|
|
33
|
+
# run after the last commit and undo nothing. A transaction already open when
|
|
34
|
+
# `configure` runs is the caller's: Alembic opens none of its own inside it.
|
|
35
|
+
with connection.begin():
|
|
36
|
+
context.configure(
|
|
37
|
+
connection=connection,
|
|
38
|
+
target_metadata=target_metadata,
|
|
39
|
+
render_as_batch=True, # SQLite alters a table by rebuilding it (D-08)
|
|
40
|
+
)
|
|
41
|
+
context.run_migrations()
|
|
42
|
+
if raw is not None:
|
|
43
|
+
# The check the run skipped, once, before COMMIT: a row pointing at a
|
|
44
|
+
# missing id raises, and the whole run rolls back.
|
|
45
|
+
dangling = connection.exec_driver_sql("PRAGMA foreign_key_check").fetchall()
|
|
46
|
+
if dangling:
|
|
47
|
+
raise RuntimeError(
|
|
48
|
+
f"migration left rows pointing at missing ids: {dangling[:5]}"
|
|
49
|
+
)
|
|
50
|
+
finally:
|
|
51
|
+
# The connection goes back to the pool, and every pooled connection enforces them.
|
|
52
|
+
# The run has committed by now, but SQLAlchemy may hold a fresh, empty transaction
|
|
53
|
+
# open - inside it the PRAGMA would be a no-op again - so end it first.
|
|
54
|
+
if raw is not None:
|
|
55
|
+
connection.rollback()
|
|
56
|
+
raw.execute("PRAGMA foreign_keys = ON")
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
run_migrations()
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""${message}
|
|
2
|
+
|
|
3
|
+
Revision ID: ${up_revision}
|
|
4
|
+
Revises: ${down_revision | comma,n}
|
|
5
|
+
Create Date: ${create_date}
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import sqlalchemy as sa
|
|
9
|
+
from alembic import op
|
|
10
|
+
${imports if imports else ""}
|
|
11
|
+
|
|
12
|
+
revision = ${repr(up_revision)}
|
|
13
|
+
down_revision = ${repr(down_revision)}
|
|
14
|
+
branch_labels = ${repr(branch_labels)}
|
|
15
|
+
depends_on = ${repr(depends_on)}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# Batch mode rebuilds a table by reflecting it, and SQLAlchemy cannot reflect an expression
|
|
19
|
+
# index: rebuilding `course`, `topic` or `assessment_slot` silently drops ux_course_code,
|
|
20
|
+
# ux_topic_live or ux_assessment_slot_name (the "Skipped unsupported reflection" SAWarning).
|
|
21
|
+
# A migration that rebuilds one of them recreates its index after the batch block.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def upgrade() -> None:
|
|
25
|
+
${upgrades if upgrades else "pass"}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def downgrade() -> None:
|
|
29
|
+
${downgrades if downgrades else "pass"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""baseline: empty schema
|
|
2
|
+
|
|
3
|
+
Revision ID: 0000
|
|
4
|
+
Revises:
|
|
5
|
+
Create Date: 2026-09-17
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
revision = "0000"
|
|
9
|
+
down_revision = None
|
|
10
|
+
branch_labels = None
|
|
11
|
+
depends_on = None
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def upgrade() -> None:
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def downgrade() -> None:
|
|
19
|
+
pass
|