Cyclic imports between app/desktop/server/core flagged by pylint (R0401)

Đang mở
#42 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
cli

Hướng nghiên cứu

Run pylint src/profiles to list the cyclic-import warnings. Read AGENTS.md for the boundary rule, then inspect app.py and profiles/__init__.py as hubs. Extract server bootstrap from app.py and keep core/config/models.py free of imports. Done means pylint src/profiles reports zero R0401 without new lazy-import workarounds.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

code-quality tech-debt

pylint src/profiles reports 16 cyclic-import warnings rooted in profiles.app reaching into every layer while those layers (or their shared models) are also imported transitively from it. Representative chain:

profiles -> profiles.app -> profiles.desktop.lifecycle -> profiles.server.app
         -> profiles.server.routes.scan -> profiles.core.processing.scanner
         -> profiles.core.config.service -> profiles.core.config.matcher
         -> profiles.core.config.models

It works today because the cycles close on import-order luck (module-level imports at the bottom of app.py, lazy imports elsewhere), but it violates the AGENTS.md boundary rule ("Aucune dépendance circulaire entre modules") and makes refactoring fragile.

Likely levers:

  • app.py is the hub: extract the server bootstrap wiring (routes needing server_state, static mount, port discovery) into a dedicated bootstrap module so app.py only calls it, instead of importing route modules transitively.
  • core.config.models is imported by everything including app — keep it dependency-free (the cycle enters through service/matcher chains).
  • Consider making profiles/__init__ (which resolves __version__) not import subpackages.

Acceptance: pylint src/profiles reports zero R0401 without new import-outside-toplevel workarounds beyond the documented lazy imports.

Ngôn ngữ chính
Python
Star
1
Fork
1
Merge trung bình
4 giờ 46 phút
Pull request đã merge (30 ngày)
55

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của falbany/ProFiles

Tất cả issue của falbany/ProFiles

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.