Skip to content

Commit

Permalink
Merge pull request #3 from RyoJerryYu/feat-refactor-for-import-path
Browse files Browse the repository at this point in the history
refactor: gen proto for import path
  • Loading branch information
RyoJerryYu authored Jun 9, 2024
2 parents 8217943 + 3c11575 commit a6e88f4
Show file tree
Hide file tree
Showing 42 changed files with 41 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ freeze:
@pip freeze > requirements.txt

test:
@python -m unittest discover -p "*_test.py" src
@python -m unittest discover -p "*_test.py" memos_webhook

.PHONY: package_build package_clean package_publish

Expand Down
8 changes: 4 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import asyncio

from src.app import app
from src.dependencies.config import new_config
from src.utils.logger import logger as util_logger
from src.utils.logger import logging_config
from memos_webhook.app import app
from memos_webhook.dependencies.config import new_config
from memos_webhook.utils.logger import logger as util_logger
from memos_webhook.utils.logger import logging_config

logger = util_logger.getChild("main")

Expand Down
1 change: 1 addition & 0 deletions memos_webhook/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
proto_gen/** linguist-generated
File renamed without changes.
21 changes: 11 additions & 10 deletions src/app.py → memos_webhook/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@

from fastapi import BackgroundTasks, Depends, FastAPI

import proto.gen.memos.api.v1 as v1
from src.dependencies.config import get_config, new_config
from src.dependencies.memos_cli import MemosCli, get_memos_cli, new_memos_cli
from src.dependencies.plugin_manager import (get_plugin_executor,
new_plugin_executor)
from src.plugins.base_plugin import PluginExecutor
from src.plugins.you_get_plugin import YouGetPlugin
from src.utils.logger import logger as util_logger
from src.utils.logger import logging_config
from src.webhook.types.webhook_payload import WebhookPayload
import memos_webhook.proto_gen.memos.api.v1 as v1
from memos_webhook.dependencies.config import get_config, new_config
from memos_webhook.dependencies.memos_cli import (MemosCli, get_memos_cli,
new_memos_cli)
from memos_webhook.dependencies.plugin_manager import (get_plugin_executor,
new_plugin_executor)
from memos_webhook.plugins.base_plugin import PluginExecutor
from memos_webhook.plugins.you_get_plugin import YouGetPlugin
from memos_webhook.utils.logger import logger as util_logger
from memos_webhook.utils.logger import logging_config
from memos_webhook.webhook.types.webhook_payload import WebhookPayload

logger = util_logger.getChild("app")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from pydantic import BaseModel

from src.utils.config_decorators import (ArgsConfigProvider, BaseArgsConfig,
BaseDotenvConfig, BaseUnmarshalConfig,
default, from_env, from_unmarshal,
it_is)
from memos_webhook.utils.config_decorators import (ArgsConfigProvider,
BaseArgsConfig,
BaseDotenvConfig,
BaseUnmarshalConfig,
default, from_env,
from_unmarshal, it_is)


class YouGetPluginConfig(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from grpclib.client import Channel

import proto.gen.memos.api.v1 as v1
from src.utils.logger import logger as util_logger
import memos_webhook.proto_gen.memos.api.v1 as v1
from memos_webhook.utils.logger import logger as util_logger

from .config import Config

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from src.plugins.base_plugin import PluginExecutor, PluginProtocol
from src.plugins.you_get_plugin import YouGetPlugin
from memos_webhook.plugins.base_plugin import PluginExecutor, PluginProtocol
from memos_webhook.plugins.you_get_plugin import YouGetPlugin

from .config import Config, PluginConfig, YouGetPluginConfig
from .memos_cli import MemosCli
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

import betterproto.lib.google.protobuf as pb

from proto.gen.memos.api import v1
from src.dependencies.memos_cli import MemosCli
from src.utils.logger import logger
from src.webhook.types.webhook_payload import WebhookPayload
from memos_webhook.dependencies.memos_cli import MemosCli
from memos_webhook.proto_gen.memos.api import v1
from memos_webhook.utils.logger import logger
from memos_webhook.webhook.types.webhook_payload import WebhookPayload

pluginLogger = logger.getChild("plugin")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import unittest
from typing import TypedDict, override

import src.webhook.types.memo_service as webhook_types
from proto.gen.memos.api import v1
from src.dependencies.memos_cli import MemosCli
from src.webhook.types.webhook_payload import WebhookPayload
import memos_webhook.webhook.types.memo_service as webhook_types
from memos_webhook.dependencies.memos_cli import MemosCli
from memos_webhook.proto_gen.memos.api import v1
from memos_webhook.webhook.types.webhook_payload import WebhookPayload

from .base_plugin import BasePlugin

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import aiofiles.os
import betterproto.lib.google.protobuf as pb

from proto.gen.memos.api import v1
from src.dependencies.config import YouGetPluginConfig
from src.dependencies.memos_cli import MemosCli
from src.webhook.types.webhook_payload import WebhookPayload
from memos_webhook.dependencies.config import YouGetPluginConfig
from memos_webhook.dependencies.memos_cli import MemosCli
from memos_webhook.proto_gen.memos.api import v1
from memos_webhook.webhook.types.webhook_payload import WebhookPayload

from .base_plugin import BasePlugin, pluginLogger

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion proto/buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ plugins:
# https://github.com/danielgtaylor/python-betterproto/issues/574
- local: protoc-gen-python_betterproto
# https://github.com/danielgtaylor/python-betterproto
out: gen
out: ../memos_webhook/proto_gen
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ dependencies = { file = ["requirements.txt"] }

[tool.setuptools.packages.find]
where = ["."]
include = ["proto*", "src*"]
include = ["proto*", "memos_webhook*"]
exclude = ["*_test.py"]
Empty file removed src/webhook/__init__.py
Empty file.
Empty file removed src/webhook/types/__init__.py
Empty file.

0 comments on commit a6e88f4

Please sign in to comment.