Skip to content

refactor: merge Final2x-core into the Final2x repo - #704

Merged
Tohrusky merged 143 commits into
EutropicAI:mainfrom
NULL204:codex/merge-core-monorepo
Aug 20, 2026
Merged

Tohrusky merged 143 commits into
EutropicAI:mainfrom
NULL204:codex/merge-core-monorepo

Conversation

@NULL204

@NULL204 NULL204 commented Jul 11, 2026 •

Copy link
Copy Markdown
Member

Summary

  • import the full Final2x-core project under the top-level core/ directory
  • build bundled Windows and macOS Core executables from local monorepo source instead of downloading another repository release
  • keep imported Core and frontend business behavior unchanged; precision switching and unrelated feature fixes are intentionally deferred to separate PRs
  • expose Core development, lint, test, wheel, and PyInstaller commands through the root package.json
  • keep the Python CLI and desktop app on one shared version with tag/version validation
  • generate frontend model options directly from the Python model registry

CI and release model

Frontend checks remain in CI-test.yml. The new CI-test-core.yml preserves the former Final2x-core coverage:

  • lint and pytest on Windows, Ubuntu, and macOS with Python 3.11
  • PyInstaller builds and full no-argument executable tests on all three platforms
  • wheel build and clean wheel installation test
  • PyTorch compatibility tests for 2.7.1, 2.1.2, and 2.0.0

All Core commands are invoked through root pnpm shortcuts. GitHub Actions dependency caching is explicitly disabled for every setup-uv use.

Release.yml contains no smoke tests or test suites. Its validate job checks only the shared version and tag. Desktop jobs build their artifacts normally. The PyPI job checks out the same commit, builds wheel and sdist in place, and publishes directly through GitHub OIDC without transferring Python distributions between jobs.

package.json remains the release version source. pnpm run version:sync updates the Python PEP 621 version and lockfile. One-time maintainer setup is documented in docs/releasing.md.

Desktop bundle flow

The original Final2x workflows downloaded Core into resources/Final2x-core before pnpm run build:*. The monorepo workflows preserve that boundary: core:bundle creates core/dist/Final2x-core, then CI-build and Release copy it directly into resources/ before the desktop build. macOS uses cp -R to preserve PyInstaller relative symlinks, Windows uses Copy-Item -Recurse, and no custom staging script is involved.

The self-contained macOS regression check stays in CI-build, where tests belong. It is intentionally absent from Release.

Local validation

  • root frontend and Core lint, including the former Core pre-commit checks
  • TypeScript and Vue typecheck
  • 14 Vitest tests
  • 10 upstream Core pytest tests
  • generated frontend model options check
  • Python wheel and source distribution build
  • local macOS PyInstaller bundle build and CLI help execution
  • actionlint for all changed workflows

Precision switching is not part of this migration because the pinned CCCV version does not support the proposed behavior. It can be implemented in a follow-up PR after the dependency supports it.

NULL204 and others added 6 commits June 17, 2026 00:44
Add a precision config field (fp32/fp16/bf16, default fp32) and map it to
cccv's fp16/bf16 arguments. bf16 avoids the fp16 numerical overflow that
yields NaN output on some transformer models, at the same VRAM savings as
fp16.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a precision selector to the settings page (default fp32) that is sent
to the core. bf16 keeps fp16's VRAM savings without the overflow that
produces black/NaN output on some transformer models.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
git-subtree-dir: packages/core
git-subtree-mainline: e7fe1cb
git-subtree-split: b904b89

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request integrates the Python-based core backend (packages/core) directly into the monorepo, replacing the external Final2x-core repository. It adds image super-resolution processing using cccv and PyTorch, introduces new precision settings (FP32, FP16, BF16) with corresponding UI controls and localization, and sets up build and version synchronization scripts. Feedback on the changes includes addressing a potential AttributeError when image decoding fails, leveraging Pydantic's built-in validation for configuration fields, supporting device indices in PyTorch device selection, and cleaning up redundant code and misleading error messages.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/core/Final2x_core/SRqueue.py
Comment thread packages/core/Final2x_core/config.py
Comment thread packages/core/Final2x_core/util/device.py
Comment thread packages/core/Final2x_core/SRclass.py Outdated
Comment thread packages/core/scripts/gen_pretrained_model_name.py
Comment thread packages/core/Final2x_core/util/progressLog.py
Comment thread core/Final2x_core/SRqueue.py
@NULL204
NULL204 marked this pull request as ready for review July 11, 2026 09:43
@NULL204
NULL204 requested review from Tohrusky and Copilot July 11, 2026 09:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors Final2x into a monorepo by bringing the Python “core” backend into packages/core, aligning desktop + PyPI releases on a single version source, and updating CI/release automation to build core artifacts locally instead of downloading prebuilt bundles.

Changes:

  • Added a precision (fp32/fp16/bf16) setting to the renderer UI and included it in the core config payload.
  • Introduced monorepo core version sync + local core bundling/staging scripts; removed the old “download core release” script.
  • Reworked CI and Release workflows to run frontend checks, core lint/tests/builds, package publishing, and GitHub releases in one pipeline.

Reviewed changes

Copilot reviewed 47 out of 64 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/shared/type/core.ts Extends shared core config typing with precision.
src/renderer/src/views/Final2xSettings.vue Adds precision selector UI and wiring to the settings store.
src/renderer/src/utils/SROptions.ts Defines selectable precision options for the UI.
src/renderer/src/utils/getFinal2xCoreConfig.ts Includes precision in the generated core config payload.
src/renderer/src/store/SRSettingsStore.ts Adds persisted precision setting (default fp32).
src/renderer/src/locales/zh.ts Adds locale strings for precision UI/help text.
src/renderer/src/locales/ja.ts Adds locale strings for precision UI/help text.
src/renderer/src/locales/fr.ts Adds locale strings for precision UI/help text.
src/renderer/src/locales/en.ts Adds locale strings for precision UI/help text.
scripts/sync-core-version.mjs Adds version/tag validation and sync between desktop and Python core.
scripts/stage-core.mjs Stages locally-built core bundle into resources/Final2x-core.
resources/download-core.js Removes legacy script that downloaded core bundles from a separate repo release.
README.md Updates project references to reflect the new monorepo core location/versioning.
pnpm-workspace.yaml Introduces pnpm workspace config and attempted overrides/built-deps settings.
packages/core/tests/util.py Test helpers for loading images and validating SR output.
packages/core/tests/test_targetscale.py Adds tests for target scale behavior.
packages/core/tests/test_srqueue.py Adds tests for queue behavior and invalid image handling.
packages/core/tests/test_singleton.py Adds tests for singleton utilities.
packages/core/tests/test_save_format.py Adds tests for output save format variations.
packages/core/tests/test_progresslog.py Adds tests for progress logging behavior.
packages/core/tests/test_device.py Adds tests for device parsing behavior.
packages/core/tests/test_config.py Adds tests for config parsing/serialization and precision validation.
packages/core/tests/init.py Initializes core test package.
packages/core/scripts/post_pyinstaller.py Post-processes PyInstaller output (copies config into dist bundle).
packages/core/scripts/gen_pretrained_model_name.py Generates checked-in frontend model options from Python registry.
packages/core/scripts/gen_config.py Generates example config YAML for core/CI usage.
packages/core/scripts/CItestpip.py Adds a CLI smoke-test script for CI usage.
packages/core/README.md Documents the Python core package now maintained in the monorepo.
packages/core/pyproject.toml Defines Python package metadata, dependencies, and tooling config.
packages/core/Makefile Adds core dev/test/lint/build shortcuts (uv/ruff/mypy/pytest/pyinstaller).
packages/core/LICENSE Adds BSD-3-Clause license for the core package.
packages/core/Final2x_core/util/singleton.py Adds singleton utility implementation.
packages/core/Final2x_core/util/progressLog.py Adds progress logging singleton used by core processing.
packages/core/Final2x_core/util/device.py Adds device parsing/resolution helper for torch/DirectML/default device.
packages/core/Final2x_core/util/init.py Exposes core utility helpers.
packages/core/Final2x_core/SRqueue.py Adds SR queue processing logic for batches of images.
packages/core/Final2x_core/SRclass.py Adds SR wrapper for cccv model inference with precision options.
packages/core/Final2x_core/config.py Adds pydantic config model + validation (precision, target_scale, device).
packages/core/Final2x_core/main.py Adds CLI entrypoint for the core package.
packages/core/Final2x_core/init.py Exposes core API surface (SRConfig/SRWrapper/sr_queue).
packages/core/.gitignore Ignores venv/build/dist/artifacts for the core package.
package.json Adds monorepo scripts (version sync/check, core lint/test/build/bundle) and pnpm metadata.
eslint.config.js Updates lint ignores for Python/core artifacts and staged core bundle.
electron-builder.yml Excludes core sources from app packaging inputs while shipping staged core via extraResources.
docs/releasing.md Documents new release model, version syncing, and PyPI Trusted Publisher setup.
.gitignore Ignores core build outputs, core venv, and coverage artifacts.
.github/workflows/Release.yml Reworks release workflow to validate version/tag, build artifacts, publish PyPI, and create GitHub Release.
.github/workflows/CI-test.yml Splits CI into frontend, core, and python-package jobs with generation checks and coverage upload.
.github/workflows/CI-build.yml Updates build workflow to build desktop artifacts per-platform with locally-built core bundles.
Comments suppressed due to low confidence (1)

electron-builder.yml:19

  • resources/Final2x-core is gitignored and is only created by core:bundle, but Linux CI jobs build the desktop app without running core:bundle. Because extraResources is configured at the top level, electron-builder will fail when the directory is missing. Scope extraResources to Windows/macOS (or ensure the directory exists for Linux builds).
  - '!packages/core/**'
  - '!resources/Final2x-core/**'

asarUnpack:
  - resources/*.png

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/shared/type/core.ts Outdated
Comment thread packages/core/Final2x_core/util/progressLog.py Outdated
Comment thread scripts/sync-core-version.mjs Outdated
Comment thread pnpm-workspace.yaml
Comment thread .github/workflows/Release.yml Outdated
@Tohrusky Tohrusky changed the title refactor: merge Final2x-core into the Final2x monorepo refactor: merge Final2x-core into the Final2x repo Aug 12, 2026
@Tohrusky
Tohrusky merged commit 37d5f71 into EutropicAI:main Aug 20, 2026
18 checks passed
@Tohrusky
Tohrusky deleted the codex/merge-core-monorepo branch September 1, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants