Commit graph

226 commits

Author SHA1 Message Date
Damien Elmes
e676e1a484 Exclude version numbers from cargo/licenses.json
Version numbers are not required by the license, and keeping them in means
the build breaks after merging in a dependabot update.
2025-08-19 23:48:04 +10:00
dependabot[bot]
5c07c899ec
Bump slab from 0.4.10 to 0.4.11 (#4265)
Bumps [slab](https://github.com/tokio-rs/slab) from 0.4.10 to 0.4.11.
- [Release notes](https://github.com/tokio-rs/slab/releases)
- [Changelog](https://github.com/tokio-rs/slab/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/slab/compare/v0.4.10...v0.4.11)

---
updated-dependencies:
- dependency-name: slab
  dependency-version: 0.4.11
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
2025-08-19 19:59:48 +10:00
Luc Mcgrady
402008950c
Feat/expected_workload_with_existing_cards implementation (#4243)
* https://github.com/open-spaced-repetition/fsrs-rs/pull/355

* add is_included card

* bump version

* ./check

* update package.lock

* parallellify

* bump fsrs
2025-08-06 18:01:06 +10:00
Jarrett Ye
2b55882cce
Fix/use real step count to simulate (#4240)
* Fix/use real step count to simulate

* Update licenses.json
2025-08-04 16:01:26 +10:00
Luc Mcgrady
c947690aeb
Feat/Use cached workload values (#4208)
* Feat/Use cached workload values

* Fix: Calculation when unchanged

* Modify constants

* Cache clearing logic

* Use function params

* use https://github.com/open-spaced-repetition/fsrs-rs/pull/352

* Revert "use https://github.com/open-spaced-repetition/fsrs-rs/pull/352"

This reverts commit 72efcf230c.

* Reapply "use https://github.com/open-spaced-repetition/fsrs-rs/pull/352"

This reverts commit 49eab2969f.

* ./check

* bump fsrs
2025-07-28 19:00:16 +10:00
Luc Mcgrady
1af3c58d40
Feat/Desired retention info graphs (#4199)
* backend part

* split memorised and cost

* slapdash frontend

* extract some simulator logic

* Add zoomed version of graph

* ./check

* Fix: Tooltip

* Fix: Simulator/workload transition

* remove "time"

* Update ts/routes/graphs/simulator.ts

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>

* Added: Mode toggle

* Disable Dr in workload mode

* keep button order consistant between modes

* dont clear points on mode swap

* add review count graph

* Revert "dont clear points on mode swap"

This reverts commit fc89efb1d9.

* "Help me pick" button

* unrelated title case change

* Add translation strings

* fix: missing translation string

* Fix: Layout shift

* Add: Experimental

* Fix Time / Memorized

* per day values

* set review limit to 9999 on open

* keep default at currently set value

* Do DR calculation in parallel (dae)

Approx 5x faster on my machine

---------

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
Co-authored-by: Damien Elmes <gpg@ankiweb.net>
2025-07-28 18:55:08 +10:00
Damien Elmes
2e74101ca4 Show recent versions in launcher
Did it with Python to avoid bloating the launcher binary with
network code
2025-07-07 23:46:33 +07:00
llama
b6c70f7b75
Add search keyword to strip clozes beforehand (#4145)
* add strip_clozes fn

* add test

* replace without_combining with process_text

* update write_unqualified

* update write_regex

* add `sc:...` search option

* add test

* strip clozes before stripping combining characters

find_notes_sc           time:   [1.0398 s 1.0405 s 1.0412 s]
                        change: [-6.1276% -6.0323% -5.9401%] (p = 0.00 < 0.05)
                        Performance has improved.

* add bitflags crate

* add and use ProcessTextFlags

* update sqlwriter.rs to use bitflags
2025-07-01 16:35:21 +07:00
Damien Elmes
469fd763c7 Fix taskbar pinning on Windows
Closes #4107
2025-06-29 20:53:43 +07:00
Damien Elmes
6eb1db0f5d Switch to the windows crate 2025-06-29 16:49:20 +07:00
Damien Elmes
de7de82f76 Refactor launcher + various tweaks
- Launcher can now be accessed via Tools>Upgrade/Downgrade
- Anki closes automatically on update
- When launcher not available, show update link like in the past
- It appears that access to the modern console host requires an app
to be built with the windows console subsystem, so we introduce an
extra anki-console.exe binary to relaunch ourselves with. Solves
https://forums.ankiweb.net/t/new-online-installer-launcher/62745/50
- Windows now requires you to close the terminal like on a Mac,
as I couldn't figure out how to have it automatically close. Suggestions
welcome!
- Reduce the amount of duplicate/near-duplicate code in the various
platform files, and improve readability
- Add a helper to install the current code into the launcher env
- Fix cargo test failing to build on ARM64 Windows
2025-06-27 16:10:12 +07:00
llama
cc395f7c44
Upgrade to nom 8.0.0 (#4105)
* bump nom to 8.0.0

* update cloze.rs

* update template.rs

* update imageocclusion.rs

* update search/parser.rs

* update card_rendering/parser.rs

* replace use of fold_many0 with many0

in nom 8, `many0` doesn't accumulate when used within `recognize`
2025-06-21 19:15:19 +07:00
Damien Elmes
04996c77f3
Migrate build system to uv (#4074)
* Migrate build system to uv

Closes #3787, and is a step towards #3081 and #4022

This change breaks our PyOxidizer bundling process. While we probably
could update it to work with the new venvs & lockfile, my intention
is to use this as a base to try out a uv-based packager/installer.

Some notes about the changes:

- Use uv for python download + venv installation
- Drop python/requirements* in favour of pyproject files / uv.lock
- Bumped to latest Python 3.9 version. The move to 3.13 should be
a fairly trivial change when we're ready.
- Dropped the old write_wheel.py in favour of uv/hatchling. This has
the unfortunate side-effect of dropping leading zeros in our wheels,
which we could try hack around in the future.
- Switch to Qt 6.7 for the dev repo, as it's the first PyQt version
with a Linux/ARM WebEngine wheel.
- Unified our macOS deployment target with minimum required for ARM.
- Dropped unused fluent python files
- Dropped unused python license generation
- Dropped helpers to run under Qt 5, as our wheels were already
requiring Qt 6 to install.

* Build action to create universal uv binary

* Drop some PyOxidizer-related files

* Use Windows ARM64 cargo/node binaries during build

We can't provide ARM64 wheels to users yet due to #4079, but we can
at least speed up the build.

The rustls -> native-tls change on Windows is because ring requires
clang to compile for ARM64, and I figured it's best to keep our Windows
deps consistent. We already built the wheels with native-tls.

* Make libankihelper a universal library

We were shipping a single arch library in a purelib, leading to
breakages when running on a different platform.

* Use Python wheel for mpv/lame on Windows/Mac

This is convenient, but suboptimal on a Mac at the moment. The first
run of mpv will take a number of seconds for security checks to run,
and our mpv code ends up timing out, repeating the process each time.
Our installer stub will need to invoke mpv once first to get it validated.

We could address this by distributing the audio with the installer/stub,
or perhaps by putting the binaries in a .pkg file that's notarized+stapled
and then included in the wheel.

* Add some helper scripts to build a fully-locked wheel

* Initial macOS launcher prototype

* Add a hidden env var to preload our libs and audio helpers on macOS

* qt/bundle -> qt/launcher

- remove more of the old bundling code
- handle app icon

* Fat binary, notarization & dmg

* Publish wheels on testpypi for testing

* Use our Python pin for the launcher too

* Python cleanups

* Extend launcher to other platforms + more

- Switch to Qt 6.8 for repo default, as 6.7 depends on an older
libwebp/tiff which is unavailable on newer installs
- Drop tools/mac-x86, as we no longer need to test against Qt 5
- Add flags to cross compile wheels on Mac and Linux
- Bump glibc target to 2_36, building on Debian Stable
- Increase mpv timeout on macOS to allow for initial gatekeeper checks
- Ship both arm64 and amd64 uv on Linux, with a bash stub to pick
the appropriate arch.

* Fix pylint on Linux

* Fix failure to run from /usr/local/bin

* Remove remaining pyoxidizer refs, and clean up duplicate release folder

* Rust dep updates

- Rust 1.87 for now (1.88 due out in around a week)
- Nom looks involved, so I left it for now
- prost-reflect depends on a new prost version that got yanked

* Python 3.13 + dep updates

Updated protoc binaries + add helper in order to try fix build breakage.
Ended up being due to an AI-generated update to pip-system-certs that
was not reviewed carefully enough:
https://gitlab.com/alelec/pip-system-certs/-/issues/36

The updated mypy/black needed some tweaks to our files.

* Windows compilation fixes

* Automatically run Anki after installing on Windows

* Touch pyproject.toml upon install, so we check for updates

* Update Python deps

- urllib3 for CVE
- pip-system-certs got fixed
- markdown/pytest also updated
2025-06-19 14:03:16 +07:00
Jarrett Ye
615bbf95a1
update to fsrs-rs 4.0.0 (#4080)
* update to fsrs-rs 4.0.0

* fix ci

* update test
2025-06-14 12:48:33 +07:00
Jarrett Ye
8add993fca
improve the accuracy of the expected workload calculation (#4056)
* improve the accuracy of the expected workload calculation

* ./ninja fix:minilints

* implement smoothing & a separate struct for return value

* set TERMINATION_PROB to 0.001
2025-06-04 18:20:12 +07:00
Jarrett Ye
dfee38898d
calculate accurate retrievability in card info (#4034) 2025-05-26 23:25:27 +10:00
Damien Elmes
1e2f11a271 Latest FSRS 2025-04-27 19:48:43 +10:00
Jarrett Ye
90f2e06b17
Fix/missing-simulator-decay-for-FSRS-5 (#3956) 2025-04-27 17:20:13 +10:00
Jarrett Ye
7556f71b96
Update to FSRS-rs v3.0.0 (fix historic memory state) (#3946)
* Update to FSRS-rs v3.0.0 (fix historic memory state)

* format
2025-04-25 20:09:19 +10:00
Jarrett Ye
e096c462fa
Feat/FSRS-6 (#3929)
* Feat/FSRS-6

* update comment

* add decay to Card

* ./ninja fix:minilints

* pass check

* fix NaN in evaluation

* remove console

* decay should fallback to 0.5 when it's None.

* Update SimulatorModal.svelte

* Update a few comments

* Update FSRS decay defaults to use constants for better maintainability and clarity

* Update rslib/src/storage/card/data.rs
2025-04-25 16:44:34 +10:00
Damien Elmes
ffbc9a77b7 Update tokio, crossbeam-channel and cargo-deny 2025-04-10 15:18:55 +10:00
Damien Elmes
475fdf04a4 Latest Rust CVEs 2025-04-10 15:03:02 +10:00
Jarrett Ye
d52889f45c
Feat/simplified relearning steps logic with updated FSRS training API (#3867)
* Feat/simplified relearning steps logic with updated FSRS training API

* Update params.rs

* use ComputeParametersInput

* update fsrs-rs dependency

* update cargo/format/rust-toolchain
2025-03-20 14:04:38 +07:00
Luc Mcgrady
79b6f658c3
Feat: Simulator suspend after lapse count (#3837)
* Added: Leech suspend to simulator

* Added: leech threshold spin box

* Update git rev

* Added: Save to preset options

* ./check

* Added: "Advanced settings" dropdown

* Removed: Indent

* Added: Easy days

* Added: Sticky header

* Removed: Easy Day updating without saving

* un-nest disclosure

* bump fsrs

* Update a VSCode setting to match recent releases

* Move Easy Days above the Advanced settings

I think it's a bit more logical to have Advanced come last.

* Ensure graph fits inside screen height

* Bump fsrs version
2025-03-15 17:28:15 +07:00
Jarrett Ye
a6426bebe2
Feat/support load balance and easy days in FSRS simulator (#3829)
* Feat/support load balance and easy days in FSRS simulator

* format

* consider LoadBalancerEnabled

* use fsrs::PostSchedulingFn

* add load balance and easy days to compute_optimal_retention

* move simulator to a pop-over

* fix incorrect simulationNumber when error 500

* Feat: Save to Preset Options

* update tabs when update newPerDay & reviewsPerDay

* don't reset deckSize & daysToSimulate when save options

* fix missing easy days

* plan to support review priority

* Fix graph line rendering with non-scaling stroke

* simplify review priority function with helper wrapper

* fallback to default ReviewPriority for Added & ReverseAdded

* Update ts/routes/deck-options/SimulatorModal.svelte

Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com>

* Wrap review priority function in Arc for thread-safe sharing

* more granularity for R sorting

* Add graph smoothing option to FSRS simulator

* Improve graph resize handling in FSRS simulator

* simplify review priority calculation

* Add review order selection to FSRS simulator modal

* Refactor review priority function using macro for conciseness

* Add copyright and license header to SimulatorModal.svelte

* cargo clippy

* ./ninja fix:eslint

* update fsrs-rs

* Update FSRS dependencies and refactor load balancing functions

- Update fsrs-rs dependency to latest commit
- Modify retention and simulator modules to use Arc instead of Box
- Update function signatures and imports in simulator module
- Simplify review card order handling with direct enum usage

* resolve reviewed changes

* replace .unwrap() with ?

* move simulating into SimulatorModal

* add (crate) to interval_to_weekday

* Update FsrsOptions.svelte

* format

---------

Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com>
2025-02-27 10:53:01 +07:00
Damien Elmes
de7a693465 Latest openssl CVE 2025-02-03 15:17:07 +07:00
Jarrett Ye
7781d1b471
Update to FSRS-rs v2.0.3 (fix simulator) (#3784) 2025-02-02 23:35:34 +07:00
Damien Elmes
92b1144d97 Bump Rust to 1.84
+ fix new warnings/lints
+ update pyo3 to fix some other warnings
2025-01-26 18:51:21 +11:00
Jarrett Ye
d2ced60f7c
Update to FSRS-rs v2.0.2 (L2 regularization) (#3737) 2025-01-18 16:43:53 +11:00
Jarrett Ye
c4ad27a2db
Feat/support new cards ignore review limit in simulator (#3707)
* Feat/support new cards ignore review limit in simulator

* ./ninja fix:minilints & ./ninja format

* use published crate

* make newCardsIgnoreReviewLimit reactive

* format

---------

Co-authored-by: Damien Elmes <gpg@ankiweb.net>
2025-01-09 22:49:13 +11:00
Jarrett Ye
58bcab2484
Sort FSRSItems by RevlogId for training (#3660)
* Sort FSRSItems by RevlogId for training

* update fsrs-rs v1.5.0
2025-01-08 21:32:00 +11:00
Luc Mcgrady
c985acb9fe
Add memorized option to FSRS simulation graph (#3655)
* Added: Memorized option to graph

* Count -> Reviews

* Added: Margin to radio button input

* Fix: Labels

* ./check

* Check errors?

* bump fsrs to 1.4.6

* ./ninja fix:minilints

* Added: Don't show hidden simulator values.

* Bump to fsrs 1.4.7
2024-12-22 11:40:51 +10:00
Jarrett Ye
4d20945319
Fix/FSRS Simulator Failure: min > max (#3644) 2024-12-17 11:45:43 +03:00
Jarrett Ye
adcac61b44
Update to FSRS-rs v1.4.4 (clipping post-lapse stability) (#3628)
* Update to FSRS-rs v1.4.4 (clipping post-lapse stability)

* ./ninja fix:minilints
2024-12-14 22:01:34 +11:00
Damien Elmes
d014f72377 Update url crate to fix idna vuln 2024-12-14 21:03:02 +11:00
Damien Elmes
13865dc0bb Rust updates for CVE and yanked package 2024-11-26 20:53:05 +10:00
Jarrett Ye
0fa9e0ef51
Feat/align FSRS-rs with PyTorch Implementation (#3540)
* Feat/align FSRS-rs with PyTorch Implementation

* Update to FSRS-rs v1.4.2

fix https://forums.ankiweb.net/t/anki-24-10-release-candidate/51191/37?u=l.m.sherlock

* Update to FSRS-rs v1.4.3

improve performance: https://github.com/open-spaced-repetition/fsrs-rs/pull/252
2024-11-05 18:20:28 +10:00
Jarrett Ye
5caeac530e
Update to FSRS-rs v1.3.5 (FSRS-5 model update) && keep three decimals for stability (#3520)
* Update to FSRS-rs v1.3.5 (FSRS-5 model update)

* keep three decimals for stability

fix https://forums.ankiweb.net/t/fsrs-5-1d-scheduling-and-learning-steps/50242/122?u=l.m.sherlock
2024-10-26 19:36:27 +10:00
Damien Elmes
30e734b925 Bump Rust deps
Primarily for prost, which had incompatible changes
2024-10-21 15:34:04 +10:00
Jarrett Ye
6ff309e08f
Feat/option to enable FSRS short-term scheduler when (re)learning steps run out && speed up features based on simulation (#3505)
* Update to FSRS-rs v1.3.2

* add fsrs_short_term_with_steps_enabled to config

* ./ninja fix:minilints

* fix defaults_for_testing

* if current parameters are invalid, skip comparison

fix #3498

* fix redundant_field_names

* cargo clippy --fix

* Update to FSRS-rs v1.3.3

* Update to FSRS-rs v1.3.4

* Avoid an extra config lookup on each card answer (dae)
2024-10-21 15:09:07 +10:00
Han Yeong-woo
25070c505a
Fully switch to File::set_times() from utime crate (#3503)
* Fully switch to File::set_times() from utime crate

* Switch to open_file()

Future me will end up wondering why we're explicitly declaring read=true

* Fix failing on windows

* Minor tidy-up (dae)

* Fix comment typo
2024-10-16 02:35:37 +10:00
Damien Elmes
f3ca4646fc
Revert "Fully switch to File::set_times() from utime crate (#3501)" (#3502)
This reverts commit 723b5e9bcc.
2024-10-16 00:35:26 +10:00
Han Yeong-woo
723b5e9bcc
Fully switch to File::set_times() from utime crate (#3501)
* Fully switch to File::set_times() from utime crate
 
* Switch to open_file() (dae)

Future me will end up wondering why we're explicitly declaring read=true
2024-10-16 00:31:17 +10:00
Damien Elmes
b75fd94c96 Update Rust deps
- Primarily for the latest RUSTSEC on pyo3
- utime has been pinned, as they've introduced a deprecation warning
without a solution being available for folder mtimes
2024-10-15 23:00:45 +10:00
Jarrett Ye
598233299e
Let FSRS control short term schedule (#3375)
* graduate card when user press hard and has 0 learning steps

* fix error: useless conversion to the same type

* do the same thing to again

* fix expected `Option<u32>`, found integer

* ./ninja format

* let FSRS control short term schedule

* Update to FSRS-rs v1.3.0

* ./ninja check:clippy

* Update to FSRS-rs v1.3.1

* Pin FSRS version (dae)

https://github.com/ankidroid/Anki-Android-Backend/pull/417

* Remove redundant parens (dae)
2024-10-06 12:20:18 +10:00
Jarrett Ye
db5c472e20
Fix/keep the same-day reviews for training & optimized parameters should be consistent if the inputs are consistents (#3450)
* keep the same-day reviews in feature

* Update to FSRS-rs v1.2.3

* format

* don't remove short-term reviews if not training

* Update to FSRS-rs v1.2.4
2024-09-30 23:43:26 +10:00
a.r
d9969a9f4f
lazy_static → once_cell → stabilized versions (#3447)
* Anki: Replace lazy_static with once_cell

Unify to once_cell, lazy_static's replacement. The latter in unmaintained.

* Anki: Replace once_cell with stabilized LazyCell / LazyLock as far as possible

Since 1.80: https://github.com/rust-lang/rust/issues/109736 and https://github.com/rust-lang/rust/pull/98165

Non-Thread-Safe Lazy → std::cell::LazyCell https://doc.rust-lang.org/nightly/std/cell/struct.LazyCell.html

Thread-safe SyncLazy → std::sync::LazyLock https://doc.rust-lang.org/nightly/std/sync/struct.LazyLock.html

The compiler accepted LazyCell only in minilints.

The final use in rslib/src/log.rs couldn't be replaced since get_or_try_init has not yet been standardized: https://github.com/rust-lang/rust/issues/109737

* Declare correct MSRV (dae)

Some of our deps require newer Rust versions, so this was misleading.

Updating the MSRV also allows us to use .inspect() on Option now
2024-09-30 23:35:06 +10:00
Jarrett Ye
34809f2520
Fix/simulator crashes if no history (#3405)
* Fix/simulator crashes if no history

* ./ninja format

* remove (experimental) from ComputeOptimalRetention

* update to fsrs-rs v1.2.2
2024-09-10 23:15:33 +07:00
Damien Elmes
b241ab9492
Dependency updates (#3403)
* Bump Python deps

Primarily for flask-cors CVE

* Bump TS deps; pin license checker

Current checker is missing the binary
https://github.com/RSeidelsohn/license-checker-rseidelsohn/issues/118

* Update Rust deps

Hyper and axum are held back as we currently make use of the older
http library that reqwest pulls in
2024-09-04 12:21:50 +07:00
Jarrett Ye
b7cb0c0d00
graduate card when user presses again or hard and has 0 learning steps (#3367)
* graduate card when user press hard and has 0 learning steps

* fix error: useless conversion to the same type

* do the same thing to again

* fix expected `Option<u32>`, found integer

* ./ninja format

* Update to FSRS-rs v1.2.0

* if else -> match

* Weight length check has been moved into FSRS (dae)

* Don't mention the number of FSRS parameters (dae)

It has changed, and may change again.
2024-08-29 22:20:11 +07:00