Conversation
|
Why are you working on refactoring aw-server-python when aw-server-rust has feature parity and will be replacing it? |
|
Because it is still the reference implementation, and faster to prototype stuff in. |
|
But it's just refactorization, it doesn't add any functionality? Why spend time on refactoring something that we don't intend to keep for a longer period of time? |
🤖 AI code reviewThis PR refactors the aw-server API code into a subpackage: it renames aw_server/rest.py to aw_server/resources/rest.py, updates imports in server.py and init.py to use the new module path, and adds an empty aw_server/resources/init.py. It also changes setup.py to use find_packages() instead of a hardcoded package list, and updates Pipfile to use editable local paths for aw_core and aw-server instead of a git reference. Not safe to merge — 1 P1 openConfidence 3/5
3 findings · ❌ 1 P1 · 2 inline❌ P1 high — The Pipfile change replaces the aw_core git reference with an editable local path How this was verified: Checked the diff: the original line was
The import change in aw_server/init.py from How this was verified: Searched the repository for references to Comments outside the diffThese could not be anchored to a line GitHub accepts, so they appear only here.
The How this was verified: Checked the class definition in aw_server/resources/rest.py lines 33-45. Flask's JSON encoder is instantiated with app.json_encoder and may pass configuration. The init signature accepts *args and **kwargs but discards them. 1 advisory finding (summary-only, not scored)These P2 guard, heuristic, trade-off, or documentation claims are retained for judgment without opening review threads.
The setup.py change replaces the hardcoded packages=['aw_server'] with packages=find_packages(), which will include any subpackage that has an init.py. The new aw_server/resources/init.py is empty, so find_packages() returns ['aw_server', 'aw_server.resources']. However, the check How this was verified: Read setup.py lines 25-27. The condition only prints a message; it does not raise an error. The list order from find_packages() is not guaranteed to be sorted, so the comparison may be unreliable. Files changed (6) — the diff as I read it
Also changed, not described above: Reviewed Maintainer commands
|
|
|
||
| [packages] | ||
| aw-core = {ref = "master",git = "https://github.com/ActivityWatch/aw-core.git"} | ||
| aw_core = {editable = true, path = "../aw-core"} |
There was a problem hiding this comment.
❌ P1 — The Pipfile change replaces the aw_core git reference with an editable local path ../aw-core. This is a development-only dependency specification that will break for anyone who clones the aw-server repository without also having a sibling aw-core checkout at that exact relative path. The original aw-core = {ref = "master", git = "https://github.com/ActivityWatch/aw-core.git"} was self-contained and installable from a fresh clone. With this change, pipenv install will fail with a FileNotFoundError if ../aw-core does not exist. This is a contract break for contributors and CI environments that do not manually clone aw-core first. The PR description does not mention this as an intentional workflow change, and it is not part of the refactoring goal. The same applies to the aw-server = {editable = true, path = "."} entry, which is redundant because the project itself is already the package being installed, but that is less harmful.
|
|
||
| from . import api | ||
| from . import rest | ||
| from . import resources |
There was a problem hiding this comment.
from . import rest to from . import resources is correct for the new package layout, but the empty aw_server/resources/__init__.py does not re-export rest. Code that previously did from aw_server import rest (or from . import rest inside the package) will now break because aw_server.rest no longer exists. The PR moves the module but does not provide a compatibility shim. Any external caller or plugin that imports aw_server.rest directly will get an ImportError. The PR description says the goal is to split the big resources.py file, but this PR only moves it; a compatibility import in aw_server/__init__.py (e.g., from .resources import rest) would preserve the old API. Without it, this is a breaking change for any code that relied on the old module path.
The idea is to split the big resources.py file into smaller files, like the code examples for flask-restplus.