larksuite / larksuite/oapi-sdk-python

Import is toooooo heavy | 导入太重了 应当解耦

Open
#121 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
559
Forks
102
PR merge metrics
No merged PRs in 30d

Description

我在使用 lark_oapi 时,感受到一个比较明显的问题:顶层导入太“重”了。

https://github.com/larksuite/oapi-sdk-python/blob/v2_main/lark_oapi/__init__.py 看,即使用户只想用到发消息的IM service,也会把一堆类都拉进来,不仅消耗内存,还占用很长的导入时间,初始化时间久。

希望:Client 或各 service 能更接近懒加载;避免 import lark_oapi 就触发一大串导入 (当然也会导致巨大的内存开销)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading lark_oapi/init.py and tracing which classes and services it imports when users run import lark_oapi. Measure import time and memory, then identify how the Client or individual services could be loaded more lazily. Done means importing the package no longer eagerly loads unrelated services while the requested IM service remains usable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
developer-experience
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.