Giter Site home page Giter Site logo

sea's Introduction

sea's People

Contributors

apocelipes avatar dependabot-preview[bot] avatar dependabot[bot] avatar fenngwd avatar greyli avatar gukz avatar hanaasagi avatar heathlee avatar hj24 avatar johnnyzhao avatar nicholasxuu avatar sljeff avatar stdioa avatar yandy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sea's Issues

pytest fixture session problems

Why the scopes of app and cache in test fixtures are not session nor module?

@pytest.fixture
def app():
    return current_app

@pytest.fixture
def cache(app):
    cache = app.extensions.cache
    cache.clear()
    yield cache
cache.clear()

gRPC Python 不支持 details 不支持 Unicode

Python grpc doesn't handle unicode inside an exception message #11442

因此 sea 的 RpcException 实现会导致出现非 ASCII 字符时产生错误, 同时客户端收到 Internal Server Error 错误.

class RpcException(Exception):

    code = None
    details = None

    def __init__(self, message=None, *args, **kwargs):
        if isinstance(message, (list, dict)):
            message = json.dumps(
                message, default=str, ensure_ascii=False)
        if not isinstance(message, str):
            message = str(message)
        if message is not None:
            self.details = message
        super().__init__(message, *args, **kwargs)

另外我尝试使用 metadata 发送 Unicode 内容, 但同样是不行的.
因此如果需要传送 Unicode 内容时, 可以将 Unicode 字符串转义为 ASCII, 具体做法是使json.dumpsensure_ascii=True, 对于一般字符串, 可以调用json.encoder.py_encode_basestring_ascii 对Unicode字符串进行转义.

或者用 base64 之类的方法进行编码.

此类方法需要调用端做响应的配合, 加大了 client 和 server 的 耦合程度.

msg2dict不是递归的

request对象包含另一个对象的时候,msg2dict(request)没有把子对象变成字典,得要再手动msg2dict一次。

sea server是否有后台启动的参数

目前sea server会一直挂在命令行监听相关信息:

(rpc_demo) macbookdeMacBook-Air-2:helloworld HJ$ sea server
[2019-12-14 22:01:24,838 INFO in middleware] [2019-12-14T14:01:24.838320+00:00] HelloworldServicer.SayHello Called. Processed in 8.8e-05s
[2019-12-14 22:01:25,873 INFO in middleware] [2019-12-14T14:01:25.873557+00:00] HelloworldServicer.SayHello Called. Processed in 5.5e-05s

  1. 运行sea server -h没有查看到对应信息
  2. 查看https://shanbay.github.io/sea/#/configuration 配置文档目前也没找到相关配置

project startup

  • README
  • LICENSE
  • Test Framewrok
  • Travis CI integration
  • Coverall integration

关于配置模块中的配置项是否强制要求大写的问题

由于在本地测试时顺手将Redis扩展配置写为了REDIS_h:

# Redis相关配置
REDIS_h = 'localhost'
REDIS_p = 6699
REDIS_d = 0

结果调试时发现sea的Config类在读取处理时并不会将它解析,看完Config.from_objectConfig.get_namespace源码后发现在读取时加了if key.isupper():这个判断。

虽然REDIS_h大小写混合的写法并不规范,不过翻看了一遍sea的文档,似乎在配置项部分没有要求全部大写->sea项目配置

是否需要将文档更新,或者是在源码中取消if key.isupper():这一判断?

[讨论] 依赖中移除 pendulum

目前仅在 ServiceLogMiddleware 中用到了…
而且这个库对 Windows 开发者不友好

假如觉得可行的话,我提个 PR?

为什么执行sea new helloworld 报错呢?

Traceback (most recent call last):
File "d:\anaconda\envs\python3\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "d:\anaconda\envs\python3\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "D:\anaconda\envs\python3\Scripts\sea.exe_main
.py", line 9, in
File "d:\anaconda\envs\python3\lib\site-packages\sea\cli.py", line 113, in main
return _run(root)
File "d:\anaconda\envs\python3\lib\site-packages\sea\cli.py", line 100, in _run
return handler(**kwargs)
File "d:\anaconda\envs\python3\lib\site-packages\sea\cmds.py", line 126, in new
_gen_project(path, skip=_build_skip_files(extra), ctx=ctx)
File "d:\anaconda\envs\python3\lib\site-packages\sea\cmds.py", line 114, in _gen_project
tmpl = env.get_template(relfn)
File "d:\anaconda\envs\python3\lib\site-packages\jinja2\environment.py", line 830, in get_template
return self._load_template(name, self.make_globals(globals))
File "d:\anaconda\envs\python3\lib\site-packages\jinja2\environment.py", line 804, in _load_template
template = self.loader.load(self, name, globals)
File "d:\anaconda\envs\python3\lib\site-packages\jinja2\loaders.py", line 113, in load
source, filename, uptodate = self.get_source(environment, name)
File "d:\anaconda\envs\python3\lib\site-packages\jinja2\loaders.py", line 168, in get_source
pieces = split_template_path(template)
File "d:\anaconda\envs\python3\lib\site-packages\jinja2\loaders.py", line 31, in split_template_path
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: app\extensions.py.tmpl

pytest-cov和coverage版本冲突了

运行pip install -r test-requirements.txt有这么一句,
pytest-cov 2.7.1 has requirement coverage>=4.4, but you'll have coverage 4.3.4 which is incompatible.
然后安装了低版本pytest-cov解决了,是不是要在test-requirements.txt里改一下配置?

记录一下:sea generate这个命令不应该跟current_app挂钩

sea generate这个命令前会create_app然后拿current_app.root_path。

但是有了代码但是没有生成protos/pb2.py文件的时候,或者git merge的时候pb2文件有conflict(pb2.py文件里有了很多<<<<<,不是合法的Python代码了)。这时因为pb2文件有问题,app/servicers.py又import了它,sea g这个命令就没办法执行了。

ConstantsObject 没有作用

class ConstantsObject(ImmutableDict):

    def __getattr__(self, name):
        return self[name]

    def __dir__(self):
        return self.keys()

ImmutableDictConstantsObject 都没有重载 __setattr__ , 因此给一个 ConstantsObject 赋值将改变原来的值.

In[25]: c = ConstantsObject({'a':1})
In[26]: c.a
Out[26]: 1
In[27]: c.a = 2
In[28]: c.a
Out[28]: 2

DAL

DAL built on SQLAlcemy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.