mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-10-03 02:21:04 +08:00
* ci: add informational (non-blocking) ty type-check job * ci: pin ty environment python-version to 3.14 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * pyproject.toml: Ignore some ty rules * Refactor ty.yml for dependency installation and checks Updated ty.yml to install test dependencies and modify ty check command. * Add virtual environment setup to workflow * ci(ty): install deps with 'uv sync' instead of 'uv pip install .' The previous 'uv pip install ".[test]"' step failed because this repo is a flat-layout collection of algorithms, not an installable package: setuptools' legacy backend errors with 'Multiple top-level packages discovered in a flat-layout'. Rather than restructuring into a src-layout, mirror the existing 'build' job and use 'uv sync' -- pyproject.toml has no [build-system], so uv treats the project as virtual and installs only its dependencies. Pin a regular GIL 3.14 so typed third-party deps resolve, and pull ty in ephemerally with 'uv run --with ty' so it needn't touch the lockfile. Also drop the stray per-step 'source .venv/bin/activate' (each run: is its own shell, so it was a no-op). Job stays continue-on-error (informational). * ci(ty): keep the advisory job green with inline annotations ty emits ::error annotations via --output-format=github; those render on the PR diff regardless of the step's exit code. Add '|| true' so the check stays green (it's informational, not a gate) while findings remain visible as inline annotations -- avoids a permanent red X on every commit. Remove '|| true' and continue-on-error to promote ty to a required gate later. * ci(ty): keep ty's real exit status (drop || true), rely on continue-on-error for non-blocking * ci(ty): pin the ty run to regular 3.14 and use native --exit-zero The ty step ran 'uv run --with ty' without --python, so uv re-resolved the project default (free-threaded 3.14t), where many third-party stubs don't resolve -- that env-resolution failure, not real type errors, produced the unresolved-import/unresolved-attribute noise and masked whether [tool.ty.rules] severities apply. Pin the run to regular 3.14 so ty sees the synced deps. Replace the continue-on-error/real-status juggling with ty's native --exit-zero (the analog of 'ruff check --exit-zero'): always exit 0 while --output-format=github still surfaces findings as inline annotations. continue-on-error stays only as a crash guard. Documents the --exit-zero -> --exit-zero-on-warning -> gate path. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com>