Pyproject rework#198
Open
OmniTroid wants to merge 17 commits into
Open
Conversation
Dependencies move into [project] with a [dependency-groups].dev for pytest/black/tox; Dockerfile, Travis, tox.ini, start scripts and README are updated to install/run via uv. uv.lock is committed for reproducible installs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tox 4 reads native TOML config from [tool.tox], so the standalone tox.ini is redundant. tox-uv is pinned alongside tox in the dev group so `uv run tox` works straight out of `uv sync`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Brings over the real-server pytest fixture and AO-protocol MockClient so tests can drive a live TsuServer3 over WebSocket on an ephemeral port. Adds handshake/select/IC and /login coverage; drops the old AOProtocol-direct mocks. - server.tsuserver: extract `serve_websocket(host, port)` so the fixture can bind without running the full `start()` loop - server.constants: add `decode_ao_packet` (inverse of the existing encode_ao_packet) — needed by MockClient - tests.conftest: neutralize TsuServer3's mid-init `sys.setrecursionlimit(50)` for the fixture only (it breaks PyYAML and pytest-asyncio's stack) - MockClient MS defaults: send "0" instead of "" for frames_* / effect to satisfy KFO's stricter STR (vs STR_OR_EMPTY) validation - test_exception_does_not_disconnect is xfail-strict: aoprotocol.data_received intentionally KKs + disconnects on unhandled exceptions, unlike czar Skipped czar tests with no KFO counterpart: test_timer.py (Timer is a nested class on Area/AreaManager here, not server.timer) and test_ms_parser.py (MS is parsed inline in net_cmd_ms). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds ruff config for intentional patterns (scripts/ ad-hoc utilities; star imports + post-decorator imports in server/commands/__init__.py) and fixes the remaining 37 lint findings in-code: - E711/E712: replace `== None` / `== True/False` with `is`/truthy checks - E722: replace bare `except:` with `except Exception:` (15 sites) - E741: rename ambiguous `l` to `p` in a pos comprehension - F841: remove dead locals (commented-out y-offset parsing, unused fighter_name, unused cid in send_discord_chat, unused timer flag) Notable behavior change (F811): - client_manager.py: the `latest_area` setter was mistakenly decorated `@inventory.setter`, binding it to the wrong property — writes to `client.latest_area` previously silently no-op'd. Now correctly `@latest_area.setter`, so kick_to_latest_area / latest-area tracking actually persist. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Removes black and its transitive deps from the dev group, moves line-length/target-version onto [tool.ruff] so both `ruff check` and `ruff format` honor them, and updates the README to point at `uv run ruff format .`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the old flake8/requirements.txt/Python-3.12 workflow with a uv-based pipeline that runs `ruff check`, `ruff format --check`, and `pytest` on push to master and on PRs. Uses astral-sh/setup-uv with caching and cancels stale runs on the same branch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- tests/__init__.py: docstring pointed at the deleted tests.mock.mocks - start_server.py: drop check_deps() import-shim and version check (uv + requires-python enforce both); update banner KFO-Server - docker-compose.yml: drop deprecated version: "3.3" key; rename service/image from tsuserver to kfo-server Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Class renamed to match the project name; module file renamed via git mv so history follows. Updates the two import sites (start_server.py, tests/conftest.py), test docstrings, and a stale TODO in client_manager.py that pointed at the old filename. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- /help welcome banner: "Welcome to tsuserver3!" -> "Welcome to KFO-Server!" - Default Discord webhook username: "tsuserver webhook" -> "KFO-Server webhook" Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.