Commit graph

173 commits

Author SHA1 Message Date
€šm̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰�Ř§Ů Â£╟©舐æØ¢£ðsÞ¥¿—
e3d0a30443
Fix ninja BuildAction name sanitization (#4291)
rust commit 8296ad0 changes the output of std::any::type_name to include
regions such as lifetime and generic arguments, which results in invalid
Ninja rule names being generated, such as `CargoBuild<_>`.
2025-09-01 15:08:29 +10:00
Damien Elmes
71ec878780 Fixes for Rust 1.89
Closes #4287
2025-09-01 14:55:49 +10:00
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
Damien Elmes
834fb41015 Exclude VIRTUAL_ENV from environ as well
https://forums.ankiweb.net/t/anki-25-08-beta/63645/51
2025-07-15 17:03:51 +07:00
Damien Elmes
51cf09daf3 Strip only UV_* env vars
If we don't preserve env vars like TEMP, it results in run failures
on Windows:
https://forums.ankiweb.net/t/anki-25-08-beta/63645/28
2025-07-09 21:38:45 +07:00
Kevin Nakamura
dfbb7302e8
set UV_PYTHON_DOWNLOADS=auto when doing uv sync (#4191)
* set UV_PYTHON_DOWNLOADS=auto when doing `uv sync`

* Clear env vars prior to invoking uv, and add --no-config

---------

Co-authored-by: Damien Elmes <gpg@ankiweb.net>
2025-07-09 17:57:37 +07:00
Alexander Bocken
b205008a5e
respect env var UV_BINARY with OFFLINE_BUILD being set (#4170)
* respect env var UV_BINARY with OFFLINE_BUILD being set

* cleanup formatting, fix import

* Fix build error (dae)
2025-07-07 15:16:00 +07:00
Damien Elmes
ee5e8c9230 Update to latest node LTS; add update helper 2025-07-01 17:06:27 +07:00
Damien Elmes
66f34da7ef Fix lint, and ensure Rust checks get re-run on launcher change 2025-06-29 15:54:31 +07:00
Abdo
f94d05bcbe
Switch to Ruff (#4119)
* Add check:ruff build action

* Add fix:ruff action

* Add Ruff config

Mostly generated by Cursor

* Handle rest of lints

* Fix formatting

* Replace black and isort with ruff-format

* Run ruff-format

* Fix lint errors

* Remove pylint disables

* Remove .pylintrc

* Update docs

* Fix check:format not just checking

* Fix isort rule being ignored

* Sort imports

* Ensure ./ninja format also handles import sorting

* Remove unused isort cfg

* Enable unsafe fixes in fix:ruff, and enable unused var warning

* Re-run on config change; enable unnecessary ARG ignores

* Use all pycodestyle errors, and add some more commented-out ones

Latter logged on https://github.com/ankitects/anki/issues/4135
2025-06-29 14:38:35 +07:00
Damien Elmes
f89ab00236 Update to Rust 1.88
We'll need to handle https://github.com/ankitects/anki/issues/4134 before
we get access to let chains.
2025-06-29 11:50:49 +07:00
Luc Mcgrady
e505ca032b
Fix/Add check_output_timestamps to PythonEnvironment (#4113)
* Fix/explicitly set restat

* Revert "Fix/explicitly set restat"

This reverts commit ace2e5ef6a.

* add check_output_timestamps to python.rs
2025-06-27 16:41:50 +07:00
Abdo
fdce765861
Make PYTHONPYCACHEPREFIX point to an absolute path (#4111) 2025-06-27 16:36:27 +07:00
Damien Elmes
9b287dc51a Python dependency/wheel tweaks
- Use --locked to assert that the lockfile won't change, so we need
to explicitly 'uv lock' when making changes. Still trying to get to
the bottom of why the lockfile sometimes has editable entries, which
break things when switching between platforms.
- Exclude __pycache__ from wheels
- Move the typing stubs to our dev deps
(https://github.com/ankitects/anki/pull/4074#pullrequestreview-2948088436)
2025-06-27 16:10:12 +07:00
Damien Elmes
d542ae9065 Fix check action on Windows ARM
- Update nextest (not required)
- Build nextest without self-update, which pulls in ring
- Disable running of tests in rsbridge, as it has no tests, and
requires host arch's python.lib to execute
- A double \ in CARGO_TARGET_DIR was breaking update_* tests
2025-06-20 16:52:25 +07:00
Damien Elmes
a60a955c61 Handle beta/rc tags, bump beta, add exact version pin to aqt 2025-06-20 16:13:50 +07:00
Damien Elmes
8e20973c52 Drop remaining qt5 code 2025-06-20 16:13:50 +07:00
Damien Elmes
cd411927cc Split libankihelper into a separate module
It's rarely updated, and the old approach resulted in a 'proper' aqt
build only being done on a Mac.
2025-06-20 16:13:49 +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
Damien Elmes
e728e8bcb1 Recreate pyenv if it was created with uv
Temporary fix for #4074 breaking normal builds
2025-06-12 12:20:02 +07:00
Damien Elmes
cbb202a46f Re-run minilints on .md change
While trivial updates to our docs don't really need a license
declaration, they were causing CI to fail after merge.
2025-05-05 19:10:13 +10:00
Damien Elmes
8e13e6bfc1 Update n2 [action required]
Make sure to run tools/install-n2 after updating to this commit.
n2 have merged in some changes we were previously hosting in a fork,
but the parsing of the flags was altered.
2025-02-19 10:34:45 +07:00
Damien Elmes
c398baca7a Bundling got broken in the revert to Qt 6.6 2025-01-26 19:32:01 +11:00
Damien Elmes
7884edfd3a
Yarn 4 (#3772)
* Update to yarn 4, and pin the version

* Use yarn to invoke prettier, as yarn 4 is not setting +x

* Fix a few peer dependency warnings
2025-01-26 14:40:17 +11:00
Damien Elmes
c253d40d1d Use prettier's cache
Approximately halves runtime on my system
2025-01-25 22:52:25 +11:00
Damien Elmes
3d13d259bb Use Qt 6.8 on ARM Linux; add tools/run-qt6.8
Prior to this change, ./run fails out of the box on ARM systems, as Qt
wasn't available on PyPI until the 6.8 release.

Also added a script in tools/ for testing Qt6.8 issues on other platforms.
2025-01-25 21:59:31 +11:00
Damien Elmes
cd1824165f Revert "Qt 6.8.1"
This reverts commit 04228de666.

Anki 25.01 Beta 1 revealed a bunch of regressions with the latest
Qt, and zero reports of improvements from it, so we'll be better off
holding off on it for now, and perhaps reporting the deadkeys issue
to Qt once we've got a proper reproduction process.
2025-01-25 21:41:33 +11:00
Damien Elmes
455677a5c0 Ensure sveltekit gets built before congrats page
Fixes race condition in build
2025-01-24 18:32:19 +11:00
Damien Elmes
774d57cdc8 Restore the missing external congrats page 2025-01-24 16:21:36 +11:00
Damien Elmes
06ef25755b Ensure pyoxidizer rebuilt on arch change
Fixes broken builds when switching between ARM and AMD on a Mac.
2025-01-24 12:50:00 +11:00
Abdo
2c1a4895ba Switch back to Prettier for Svelte formatting
Closes #3649
Closes #3713
2025-01-13 15:53:55 +11:00
Damien Elmes
6966da14c2 Start installing PyQt6 into the Linux ARM64 venv by default
Now that an ARM wheel is on PyPI, we no longer need to rely on a
system PyQt to build on ARM. The install is skipped when PYTHONPATH
is set, so older distros with glibc <2.39 can continue to use the
system packages instead.
2025-01-10 22:26:30 +11:00
Damien Elmes
256822bbb1 Improve error when n2/ninja missing 2025-01-10 22:26:30 +11:00
Damien Elmes
3bdf61e2fd Improve error when git not installed 2025-01-10 22:26:30 +11:00
Damien Elmes
5d150c74a4
Qt 6.8.1 (#3633)
* Qt 6.8.1

Bumps minimum glibc to 2.35, and minimum macOS to 12

* Drop generation of Qt5 packaged build

Closes #3615

* Include qt6 requirements in aqt wheel; drop extra deps

* Fix aqt wheels growing over time
2025-01-09 20:07:12 +11:00
Damien Elmes
9c3f89466d Fix glibc tag for AMD build 2024-12-09 19:40:16 +11: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
Damien Elmes
5335d748cf Bump Rust to 1.81 for latest CVE 2024-09-05 12:39:59 +07:00
Damien Elmes
ca4393142e Update to Rust 1.80
https://github.com/ankitects/anki/pull/3329#issuecomment-2254538270
2024-08-05 15:37:59 +07:00
Abdo
d108bff862
Fix remaining accessibility warnings (#3241)
* Remove unused build var

* Fix accessibility warnings in CollapseLabel

* Fix accessibility warnings in PlainTextBadge

* Add ARIA role to Autocompleteitem

* Fix accessibility warnings in HandleBackground

* Fix accessibility warnings in HandleControl

* Fix accessibility warnings in EditorField

* Fix accessibility warnings in RichTextBadge

* Fix accessibility warnings in StickyBadge

* Remove ignored a11y warnings
2024-07-10 19:55:08 +07:00
Damien Elmes
a739d6257c Fix check:svelte/vitest running indiscriminately 2024-07-06 18:40:36 +07:00
antecrescent
60b25535ef
Make SvelteCheck and ViteTest respect YARN_BINARY (#3231) 2024-06-28 18:00:38 +07:00
Alexander Bocken
4fb2efb8aa
fix sveltekit respecting yarn env var (#3226)
* fix sveltekit respecting yarn env var

* adding myself to CONTRIBUTORS
2024-06-07 23:01:40 +01:00
Mani
477f932f35
fix select all and change ordinal in edit mode in io (#3109)
* fix select all and change ordinal in edit mode in io

* make ordinal undefined for all shapes in group/ungroup

* fix group shapes and some ui fixes

* Don't add node_modules/* to dprint deps

* use minimum ordinal when shape merged, use max ordinal++ when ungrouped, in add mode no ordinal preset so NaN

* use state for ungroup shape

* maintain existing ordinal in editing mode

* fix order of ordinal in ungroup shape

* refactor: remove for loop, use forEach
2024-04-11 08:08:07 +01:00
Damien Elmes
bdc9be2bbb Ensure ankihelper is rebuilt on arch change
https://forums.ankiweb.net/t/24-04-breaks-dark-mode-on-mac/43048
2024-04-03 15:07:50 +07:00
Damien Elmes
7121cb5132 Fix arm64 node checksum 2024-04-01 17:17:44 +07:00
Damien Elmes
9f55cf26fc
Switch to SvelteKit (#3077)
* Update to latest Node LTS

* Add sveltekit

* Split tslib into separate @generated and @tslib components

SvelteKit's path aliases don't support multiple locations, so our old
approach of using @tslib to refer to both ts/lib and out/ts/lib will no
longer work. Instead, all generated sources and their includes are
placed in a separate out/ts/generated folder, and imported via @generated
instead. This also allows us to generate .ts files, instead of needing
to output separate .d.ts and .js files.

* Switch package.json to module type

* Avoid usage of baseUrl

Incompatible with SvelteKit

* Move sass into ts; use relative links

SvelteKit's default sass support doesn't allow overriding loadPaths

* jest->vitest, graphs example working with yarn dev

* most pages working in dev mode

* Some fixes after rebasing

* Fix/silence some svelte-check errors

* Get image-occlusion working with Fabric types

* Post-rebase lock changes

* Editor is now checked

* SvelteKit build integrated into ninja

* Use the new SvelteKit entrypoint for pages like congrats/deck options/etc

* Run eslint once for ts/**; fix some tests

* Fix a bunch of issues introduced when rebasing over latest main

* Run eslint fix

* Fix remaining eslint+pylint issues; tests now all pass

* Fix some issues with a clean build

* Latest bufbuild no longer requires @__PURE__ hack

* Add a few missed dependencies

* Add yarn.bat to fix Windows build

* Fix pages failing to show when ANKI_API_PORT not defined

* Fix svelte-check and vitest on Windows

* Set node path in ./yarn

* Move svelte-kit output to ts/.svelte-kit

Sadly, I couldn't figure out a way to store it in out/ if out/ is
a symlink, as it breaks module resolution when SvelteKit is run.

* Allow HMR inside Anki

* Skip SvelteKit build when HMR is defined

* Fix some post-rebase issues

I should have done a normal merge instead.
2024-03-31 09:16:31 +01:00
antecrescent
58ce29f461
Refactor offline build process and add offline generation of Sphinx docs (#3082)
* Simplify the offline build

The two environment variables OFFLINE_BUILD and NO_VENV jointly provide
the ability to build Anki fully offline. This commit boils them down
into just one, namely OFFLINE_BUILD.

The rationale being that first, OFFLINE_BUILD implies the use of
a custom non-networked Python environment.
Second, building Anki with a custom Python environment in a networked
setting is a use case, that we currently do not support.
Developers in need of such a solution may want to give containerized
development environments a try. Users could also look into building
Anki fully offline instead.

* Add documentation for offline builds.

* Add support for offline generation of Sphinx documentation.

Control installation of Sphinx dependencies via the network through the
OFFLINE_BUILD environment variable.

* Add documentation for offline generation of Sphinx documentation.
2024-03-27 13:51:09 +00:00
Damien Elmes
cadbb6ad8d Ensure rsbridge gets rebuilt when buildhash changes
Hopefully fixes https://forums.ankiweb.net/t/anki-24-04-beta/41792/2
2024-03-01 13:25:56 +07:00
Damien Elmes
bfaa28feda Mac Qt bundle rebuilt without .dSYM files 2024-02-29 13:33:12 +07:00