Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ verify_ssl = true
name = "pypi"

[packages]
aw-core = {ref = "master",git = "https://github.com/ActivityWatch/aw-core.git"}
aw_core = {editable = true, path = "../aw-core"}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

aw-server = {editable = true, path = "."}
flask-restplus = ">=0.9.2"
appdirs = ">=1.4.0"
python-json-logger = ">=0.1.5"
Expand Down
64 changes: 51 additions & 13 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion aw_server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
from .server import create_app

from . import api
from . import rest
from . import resources

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ P2 — The import change in aw_server/init.py from 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.


from .main import main
3 changes: 1 addition & 2 deletions aw_server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
from .server import _start
from .config import config

logger = logging.getLogger(__name__)


def main():
"""Called from the executable and __main__.py"""
Expand All @@ -23,6 +21,7 @@ def main():
setup_logging("aw-server", testing=settings.testing, verbose=settings.verbose,
log_stderr=True, log_file=True, log_file_json=False)

logger = logging.getLogger(__name__)
logger.info("Using storage method: {}".format(settings.storage))

if settings.testing:
Expand Down
Empty file added aw_server/resources/__init__.py
Empty file.
7 changes: 4 additions & 3 deletions aw_server/rest.py → aw_server/resources/rest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Dict
import traceback
import json
import logging

from flask import request, Blueprint, jsonify, current_app, make_response
from flask_restplus import Api, Resource, fields
Expand All @@ -10,11 +11,11 @@
from aw_core import schema
from aw_core.models import Event

from . import logger
from .api import ServerAPI
from .exceptions import BadRequest, Unauthorized
from aw_server.api import ServerAPI
from aw_server.exceptions import BadRequest, Unauthorized
from aw_analysis.query2_error import QueryException

logger = logging.getLogger(__name__)

# SECURITY
# As we work our way through features, disable (while this is False, we should only accept connections from localhost)
Expand Down
6 changes: 3 additions & 3 deletions aw_server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import aw_datastore
from aw_datastore import Datastore

from .log import FlaskLogHandler
from .api import ServerAPI
from . import rest
from aw_server.log import FlaskLogHandler
from aw_server.api import ServerAPI
from aw_server.resources import rest


logger = logging.getLogger(__name__)
Expand Down
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
except ImportError: # for pip <= 9.0.3
from pip.req import parse_requirements

from setuptools import setup
from setuptools import setup, find_packages

here = os.path.abspath(os.path.dirname(__file__))

Expand All @@ -22,14 +22,18 @@

requirements = parse_requirements("./requirements.txt", session=False)

packages = find_packages()
if packages != ["aw_server", "aw_server.resources"]:
print(f"Found extra packages: {packages}")

setup(name='aw-server',
version=about["__version__"],
description='ActivityWatch server',
long_description=readme,
author='Erik Bjäreholt',
author_email='erik@bjareho.lt',
url='https://github.com/ActivityWatch/aw-server',
packages=['aw_server'],
packages=packages,
include_package_data=True,
install_requires=[str(requirement.req) for requirement in requirements],
entry_points={
Expand Down